Skip to content

Commit a8ce6d4

Browse files
authored
Merge pull request #1880 from OpenConext/feature/sram-interrupt_rebase_php82
Feature: Add SRAM integration through SBS
2 parents 2fd5773 + a52766d commit a8ce6d4

File tree

64 files changed

+2515
-75
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+2515
-75
lines changed

ci/qa-config/rector.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,5 @@
3333
\Rector\Php81\Rector\FuncCall\NullToStrictStringFuncCallArgRector::class,
3434
\Rector\Php81\Rector\Property\ReadOnlyPropertyRector::class,
3535
\Rector\DeadCode\Rector\StaticCall\RemoveParentCallWithoutParentRector::class,
36+
\Rector\Php82\Rector\Class_\ReadOnlyClassRector::class,
3637
]);

config/packages/engineblock_features.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,4 @@ parameters:
1515
eb.feature_enable_idp_initiated_flow: "%feature_enable_idp_initiated_flow%"
1616
eb.stepup.sfo.override_engine_entityid: "%feature_stepup_sfo_override_engine_entityid%"
1717
eb.stepup.send_user_attributes: "%feature_stepup_send_user_attributes%"
18+
eb.feature_enable_sram_interrupt: "%feature_enable_sram_interrupt%"

config/packages/parameters.yml.dist

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,7 @@ parameters:
223223
feature_enable_idp_initiated_flow: true
224224
feature_stepup_sfo_override_engine_entityid: false
225225
feature_stepup_send_user_attributes: false
226+
feature_enable_sram_interrupt: false
226227

227228
##########################################################################################
228229
## PROFILE SETTINGS
@@ -307,3 +308,20 @@ parameters:
307308
# used in the authentication log record. The attributeName will be searched in the response attributes and if present
308309
# the log data will be enriched. The values of the response attributes are the final values after ARP and Attribute Manipulation.
309310
auth.log.attributes: []
311+
312+
##########################################################################################
313+
## SRAM Settings
314+
##########################################################################################
315+
## Config for connecting with SBS server
316+
## base_url must end with /. Locations must not start with /.
317+
sram.api_token: xxx
318+
sram.base_url: 'https://engine.dev.openconext.local/functional-testing/'
319+
sram.authz_location: authz
320+
sram.attributes_location: attributes
321+
sram.interrupt_location: interrupt
322+
sram.verify_peer: false
323+
sram.allowed_attributes:
324+
- 'urn:mace:dir:attribute-def:eduPersonEntitlement'
325+
- 'urn:mace:dir:attribute-def:eduPersonPrincipalName'
326+
- 'urn:mace:dir:attribute-def:uid'
327+
- 'urn:oid:1.3.6.1.4.1.24552.500.1.1.1.13'

config/routes/functional_testing/functional_testing.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,3 +69,18 @@ functional_testing_gateway:
6969
path: "/gateway/second-factor-only/single-sign-on"
7070
defaults:
7171
_controller: engineblock.functional_test.controller.stepup_mock::ssoAction
72+
73+
functional_testing_sram_authz:
74+
path: "/authz"
75+
defaults:
76+
_controller: engineblock.functional_test.controller.sbs::authzAction
77+
78+
functional_testing_sram_interrupt:
79+
path: "/interrupt"
80+
defaults:
81+
_controller: engineblock.functional_test.controller.sbs::interruptAction
82+
83+
functional_testing_sram_attributes:
84+
path: "/attributes"
85+
defaults:
86+
_controller: engineblock.functional_test.controller.sbs::attributesAction

config/services/ci/controllers.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,9 @@ services:
5050
- '@OpenConext\EngineBlock\Validator\UnsolicitedSsoRequestValidator'
5151
- '@OpenConext\EngineBlock\Service\AuthenticationStateHelper'
5252
- '@engineblock.functional_testing.fixture.features'
53+
54+
engineblock.functional_test.controller.sbs:
55+
class: OpenConext\EngineBlockFunctionalTestingBundle\Controllers\SbsController
56+
arguments:
57+
- '@engineblock.functional_testing.fixture.sbs_client_state_manager'
58+
- '@engineblock.functional_testing.data_store.sbs_server_state'

config/services/ci/services.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ parameters:
77
engineblock.functional_testing.attribute_aggregation_data_store.file: "/tmp/eb-fixtures/attribute_aggregation.json"
88
engineblock.functional_testing.stepup_gateway_mock_data_store.file: "/tmp/eb-fixtures/stepup_gateway_mock.json"
99
engineblock.functional_testing.translator_mock_data_store.file: "/tmp/eb-fixtures/translator_mock.json"
10+
engineblock.functional_testing.sbs_client_state_manager_data_store.file: "/tmp/eb-fixtures/sbs_client_state_manager.json"
11+
engineblock.functional_testing.sbs_controller_data_store.file: "/tmp/eb-fixtures/sbs_server_state.json"
1012

1113
services:
1214
_defaults:
@@ -58,6 +60,11 @@ services:
5860
- '@engineblock.mock_entities.sp_factory'
5961
- "@engineblock.compat.application"
6062

63+
engineblock.functional_testing.fixture.sbs_client_state_manager:
64+
class: OpenConext\EngineBlockFunctionalTestingBundle\Fixtures\SbsClientStateManager
65+
arguments:
66+
- "@engineblock.functional_testing.data_store.sbs_client_state_mananger"
67+
6168
#endregion Fixtures
6269

6370
#region Data Stores
@@ -77,6 +84,14 @@ services:
7784
class: OpenConext\EngineBlockFunctionalTestingBundle\Fixtures\DataStore\JsonDataStore
7885
arguments: ['%engineblock.functional_testing.authentication_loop_guard_data_store.file%']
7986

87+
engineblock.functional_testing.data_store.sbs_client_state_mananger:
88+
class: OpenConext\EngineBlockFunctionalTestingBundle\Fixtures\DataStore\JsonDataStore
89+
arguments: ['%engineblock.functional_testing.sbs_client_state_manager_data_store.file%']
90+
91+
engineblock.functional_testing.data_store.sbs_server_state:
92+
class: OpenConext\EngineBlockFunctionalTestingBundle\Fixtures\DataStore\JsonDataStore
93+
arguments: [ '%engineblock.functional_testing.sbs_controller_data_store.file%' ]
94+
8095
engineblock.function_testing.data_store.attribute_aggregation_client:
8196
class: OpenConext\EngineBlockFunctionalTestingBundle\Fixtures\DataStore\JsonDataStore
8297
arguments: ['%engineblock.functional_testing.attribute_aggregation_data_store.file%']

config/services/services.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,3 +342,33 @@ services:
342342
symfony.mailer:
343343
public: true
344344
alias: mailer
345+
346+
engineblock.sbs.sbs_client:
347+
class: OpenConext\EngineBlockBundle\Sbs\SbsClient
348+
arguments:
349+
- "@engineblock.sbs.http_client"
350+
- "%sram.base_url%"
351+
- "%sram.authz_location%"
352+
- "%sram.attributes_location%"
353+
- "%sram.interrupt_location%"
354+
- "%sram.api_token%"
355+
- "%sram.verify_peer%"
356+
357+
engineblock.sbs.http_client:
358+
class: OpenConext\EngineBlock\Http\HttpClient
359+
arguments:
360+
- "@engineblock.sbs.guzzle_http_client"
361+
362+
engineblock.sbs.guzzle_http_client:
363+
class: GuzzleHttp\Client
364+
arguments:
365+
- base_uri: "%sram.base_url%/"
366+
options:
367+
headers:
368+
Authentication: "%sram.api_token%"
369+
timeout: "%http_client.timeout%"
370+
371+
engineblock.sbs.attribute_merger:
372+
class: OpenConext\EngineBlockBundle\Sbs\SbsAttributeMerger
373+
arguments:
374+
- "%sram.allowed_attributes%"

config/services_ci.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,3 +67,7 @@ services:
6767

6868
OpenConext\EngineBlockFunctionalTestingBundle\Features\Context\MinkContext:
6969
tags: ['fob.context']
70+
71+
OpenConext\EngineBlockFunctionalTestingBundle\Fixtures\SbsClientStateManager:
72+
arguments:
73+
- "@engineblock.functional_testing.data_store.sbs_client_state_mananger"

docker/docker-compose.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ services:
22

33
mariadb:
44
image: mariadb:10.6
5-
restart: always
65
container_name: eb-db-test
76
environment:
87
MYSQL_ROOT_PASSWORD: "root"
@@ -62,5 +61,4 @@ services:
6261
- ../theme:/theme
6362

6463
volumes:
65-
eb-mysql-data:
6664
eb-mysql-test-data:

docs/filter_commands.md

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# EngineBlock Input and Output Command Chains
22

33
EngineBlock pre-processes incoming and outgoing SAML Responses using so-called Filters. These filters provide specific,
4-
critical functionality, by invoking a sequence of Filter Commands. However, it is not easily discoverable what these
5-
Filters and Filter Commands exactly do and how they work. This document outlines how these Filters and Filter Commands
4+
critical functionality, by invoking a sequence of Filter Commands. However, it is not easily discoverable what these
5+
Filters and Filter Commands exactly do and how they work. This document outlines how these Filters and Filter Commands
66
work and what each filter command does.
77

88
The chains are:
@@ -13,11 +13,11 @@ The specific commands can be found in the [`library\EngineBlock\Corto\Filter\Com
1313

1414
## Input and Output Filters
1515

16-
These are called by [`ProxyServer`][ps], through [`filterOutputAssertionAttributes`][fOAA] and
16+
These are called by [`ProxyServer`][ps], through [`filterOutputAssertionAttributes`][fOAA] and
1717
[`filterInputAssertionAttributes`][fIAA] calling [`callAttributeFilter`][cAF], which invokes the actual Filter Commands.
1818

1919
Each Filter then executes Filter Commands in a specified order for Input (between receiving Assertion from IdP and
20-
Consent) and Output (after Consent, before sending Response to SP).
20+
Consent) and Output (after Consent, before sending Response to SP).
2121
What the filter does is:
2222
```
2323
Loop over given Filter Commands, for each Command:
@@ -30,7 +30,7 @@ Loop over given Filter Commands, for each Command:
3030
set the collabPersonId (either: string stored in session, string found in Response, string found in responseAttributes, string found in nameId response or null, in that order)
3131
execute the command
3232
```
33-
During the loop, the Response, responseAttributes and collabPersonId are retrieved from the previous command and are
33+
During the loop, the Response, responseAttributes and collabPersonId are retrieved from the previous command and are
3434
used by the commands that follows.
3535

3636
A command can also stop filtering by calling `$this->stopFiltering();`
@@ -67,7 +67,7 @@ Uses:
6767
- EngineBlock_Saml2_ResponseAnnotationDecorator
6868
- responseAttributes
6969

70-
### NormalizeAttributes
70+
### NormalizeAttributes
7171
Convert all OID attributes to URN and remove the OID variant
7272

7373
Depends on:
@@ -193,7 +193,7 @@ Modifies:
193193
See: [Engineblock Attribute Aggregation](attribute_aggregation.md) for more information.
194194

195195
### EnforcePolicy
196-
Makes a call to the external PolicyDecisionPoint service. This returns a response which details whether or not the
196+
Makes a call to the external PolicyDecisionPoint service. This returns a response which details whether or not the
197197
current User is allowed access to the Service Provider. For more information see [the PDP repository README][pdp-repo]
198198

199199
Depends On:
@@ -343,8 +343,18 @@ Uses:
343343
- OpenConext\EngineBlock\Metadata\Entity\IdentityProvider
344344
- EngineBlock_Saml2_AuthnRequestAnnotationDecorator
345345

346+
### SRAM test filter
347+
SRAM integration.
348+
In order to facilitate fine-grained access to SRAM, EB integrates with SRAM through the SBS service.
346349

350+
This process is only enabled if both the `feature_enable_sram_interrupt` feature flag is enabled and the `collabEnabled` coin of the SP is true.
347351

352+
If enabled, the SramInterruptFilter will call SBS with the sessionId.
353+
If the sessionId is known in SBS, EB will merge the attributes supplied by SBS into the Auth request.
354+
IF the sessionId is unknown, later in the Consume Assertion process, the browser will be redirected to SBS,
355+
which will redirect back to EB after a successful check. Then the attributes from SBS will be merged after all.
356+
357+
See https://github.com/OpenConext/OpenConext-engineblock/issues/1804 for details.
348358

349359

350360
[input]: https://github.com/OpenConext/OpenConext-engineblock/tree/master/library/EngineBlock/Corto/Filter/Input.php

0 commit comments

Comments
 (0)