Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
b1b9712
Add SRAM Testfilter
mrvanes Dec 20, 2024
2f8e550
Add sbs-stub
mrvanes Jan 23, 2025
d4df9a6
Change the ValidateAllowedConnection input filter so that collab_enab…
johanib Feb 27, 2025
c268af7
Implement sbs integration flow
johanib Mar 4, 2025
0d4a41e
Several fixes
mrvanes Mar 25, 2025
df8de3a
WIP
mrvanes Mar 25, 2025
1b08684
Adjust SBS flow integration test to updated specs
johanib Mar 26, 2025
8cdadf9
Add SBS message logging
mrvanes Mar 26, 2025
10d6a2a
Use collabPersonId for sbs user_id
mrvanes Mar 28, 2025
a2b62f9
Add SHO and EPPN to SBS authz call
mrvanes Mar 31, 2025
1924a86
Add message to sbs authz response
mrvanes Mar 31, 2025
c127771
Fix tests
mrvanes Apr 7, 2025
e5374fe
Reinstate attributes endpoint
mrvanes Apr 9, 2025
e911fa8
Rename entitlements to attributes
mrvanes Apr 11, 2025
5658873
Better SBS interrupt reason logging
mrvanes Apr 14, 2025
9ad1746
Reinstate attributes endpoint test
mrvanes Apr 14, 2025
dca9815
Refactoring attempt
mrvanes Apr 17, 2025
6992b69
SRAM enabled false by default
mrvanes Apr 22, 2025
73a154a
Fix SRAM RP entityId behind oidcng trusted proxy
mrvanes May 6, 2025
be531d6
Fix SRAMInterruptFilterTest
mrvanes May 6, 2025
0812f83
Improve SBS response debugging
mrvanes May 12, 2025
3e51a7f
Don't restart test mariadb container
mrvanes May 12, 2025
a6f6d90
Fixes after rebase
johanib Oct 21, 2025
f6bd380
WIP - Handle mock idp/sp serialization
johanib Oct 23, 2025
94a1088
wip - fix sram
johanib Oct 27, 2025
9c61e0a
Fix deserialization of mock idp/sp
johanib Oct 28, 2025
e1fbb07
Rework test, di, enum
johanib Oct 28, 2025
82d755c
rework sbs flow
johanib Oct 28, 2025
11ff3d9
make sram filter handle attribute types correctly
johanib Oct 29, 2025
b8b40f0
cleanup
johanib Oct 29, 2025
2adb678
Add scenario's that test if SBS integrates well with other EB features
johanib Oct 30, 2025
111a20f
Small Rework
johanib Oct 30, 2025
ab034aa
Small Rework
johanib Oct 30, 2025
418e411
Do not skip the ValidateAllowedConnection filter if SRAM feature flag…
johanib Oct 30, 2025
150c397
Rename SRAM > Sram to match EB conventions
johanib Nov 3, 2025
5796ee7
Update copyright
johanib Nov 3, 2025
c6955e2
Ensure Stepup is performed before SRAM
johanib Nov 3, 2025
9452e55
Fixed & docs
johanib Nov 3, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ci/qa-config/rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,5 @@
\Rector\Php81\Rector\FuncCall\NullToStrictStringFuncCallArgRector::class,
\Rector\Php81\Rector\Property\ReadOnlyPropertyRector::class,
\Rector\DeadCode\Rector\StaticCall\RemoveParentCallWithoutParentRector::class,
\Rector\Php82\Rector\Class_\ReadOnlyClassRector::class,
]);
1 change: 1 addition & 0 deletions config/packages/engineblock_features.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ parameters:
eb.feature_enable_idp_initiated_flow: "%feature_enable_idp_initiated_flow%"
eb.stepup.sfo.override_engine_entityid: "%feature_stepup_sfo_override_engine_entityid%"
eb.stepup.send_user_attributes: "%feature_stepup_send_user_attributes%"
eb.feature_enable_sram_interrupt: "%feature_enable_sram_interrupt%"
18 changes: 18 additions & 0 deletions config/packages/parameters.yml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@ parameters:
feature_enable_idp_initiated_flow: true
feature_stepup_sfo_override_engine_entityid: false
feature_stepup_send_user_attributes: false
feature_enable_sram_interrupt: false

##########################################################################################
## PROFILE SETTINGS
Expand Down Expand Up @@ -307,3 +308,20 @@ parameters:
# used in the authentication log record. The attributeName will be searched in the response attributes and if present
# the log data will be enriched. The values of the response attributes are the final values after ARP and Attribute Manipulation.
auth.log.attributes: []

##########################################################################################
## SRAM Settings
##########################################################################################
## Config for connecting with SBS server
## base_url must end with /. Locations must not start with /.
sram.api_token: xxx
sram.base_url: 'https://engine.dev.openconext.local/functional-testing/'
sram.authz_location: authz
sram.attributes_location: attributes
sram.interrupt_location: interrupt
sram.verify_peer: false
sram.allowed_attributes:
- 'urn:mace:dir:attribute-def:eduPersonEntitlement'
- 'urn:mace:dir:attribute-def:eduPersonPrincipalName'
- 'urn:mace:dir:attribute-def:uid'
- 'urn:oid:1.3.6.1.4.1.24552.500.1.1.1.13'
15 changes: 15 additions & 0 deletions config/routes/functional_testing/functional_testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,18 @@ functional_testing_gateway:
path: "/gateway/second-factor-only/single-sign-on"
defaults:
_controller: engineblock.functional_test.controller.stepup_mock::ssoAction

functional_testing_sram_authz:
path: "/authz"
defaults:
_controller: engineblock.functional_test.controller.sbs::authzAction

functional_testing_sram_interrupt:
path: "/interrupt"
defaults:
_controller: engineblock.functional_test.controller.sbs::interruptAction

functional_testing_sram_attributes:
path: "/attributes"
defaults:
_controller: engineblock.functional_test.controller.sbs::attributesAction
6 changes: 6 additions & 0 deletions config/services/ci/controllers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,9 @@ services:
- '@OpenConext\EngineBlock\Validator\UnsolicitedSsoRequestValidator'
- '@OpenConext\EngineBlock\Service\AuthenticationStateHelper'
- '@engineblock.functional_testing.fixture.features'

engineblock.functional_test.controller.sbs:
class: OpenConext\EngineBlockFunctionalTestingBundle\Controllers\SbsController
arguments:
- '@engineblock.functional_testing.fixture.sbs_client_state_manager'
- '@engineblock.functional_testing.data_store.sbs_server_state'
15 changes: 15 additions & 0 deletions config/services/ci/services.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ parameters:
engineblock.functional_testing.attribute_aggregation_data_store.file: "/tmp/eb-fixtures/attribute_aggregation.json"
engineblock.functional_testing.stepup_gateway_mock_data_store.file: "/tmp/eb-fixtures/stepup_gateway_mock.json"
engineblock.functional_testing.translator_mock_data_store.file: "/tmp/eb-fixtures/translator_mock.json"
engineblock.functional_testing.sbs_client_state_manager_data_store.file: "/tmp/eb-fixtures/sbs_client_state_manager.json"
engineblock.functional_testing.sbs_controller_data_store.file: "/tmp/eb-fixtures/sbs_server_state.json"

services:
_defaults:
Expand Down Expand Up @@ -58,6 +60,11 @@ services:
- '@engineblock.mock_entities.sp_factory'
- "@engineblock.compat.application"

engineblock.functional_testing.fixture.sbs_client_state_manager:
class: OpenConext\EngineBlockFunctionalTestingBundle\Fixtures\SbsClientStateManager
arguments:
- "@engineblock.functional_testing.data_store.sbs_client_state_mananger"

#endregion Fixtures

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

engineblock.functional_testing.data_store.sbs_client_state_mananger:
class: OpenConext\EngineBlockFunctionalTestingBundle\Fixtures\DataStore\JsonDataStore
arguments: ['%engineblock.functional_testing.sbs_client_state_manager_data_store.file%']

engineblock.functional_testing.data_store.sbs_server_state:
class: OpenConext\EngineBlockFunctionalTestingBundle\Fixtures\DataStore\JsonDataStore
arguments: [ '%engineblock.functional_testing.sbs_controller_data_store.file%' ]

engineblock.function_testing.data_store.attribute_aggregation_client:
class: OpenConext\EngineBlockFunctionalTestingBundle\Fixtures\DataStore\JsonDataStore
arguments: ['%engineblock.functional_testing.attribute_aggregation_data_store.file%']
Expand Down
30 changes: 30 additions & 0 deletions config/services/services.yml
Original file line number Diff line number Diff line change
Expand Up @@ -342,3 +342,33 @@ services:
symfony.mailer:
public: true
alias: mailer

engineblock.sbs.sbs_client:
class: OpenConext\EngineBlockBundle\Sbs\SbsClient
arguments:
- "@engineblock.sbs.http_client"
- "%sram.base_url%"
- "%sram.authz_location%"
- "%sram.attributes_location%"
- "%sram.interrupt_location%"
- "%sram.api_token%"
- "%sram.verify_peer%"

engineblock.sbs.http_client:
class: OpenConext\EngineBlock\Http\HttpClient
arguments:
- "@engineblock.sbs.guzzle_http_client"

engineblock.sbs.guzzle_http_client:
class: GuzzleHttp\Client
arguments:
- base_uri: "%sram.base_url%/"
options:
headers:
Authentication: "%sram.api_token%"
timeout: "%http_client.timeout%"

engineblock.sbs.attribute_merger:
class: OpenConext\EngineBlockBundle\Sbs\SbsAttributeMerger
arguments:
- "%sram.allowed_attributes%"
4 changes: 4 additions & 0 deletions config/services_ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,7 @@ services:

OpenConext\EngineBlockFunctionalTestingBundle\Features\Context\MinkContext:
tags: ['fob.context']

OpenConext\EngineBlockFunctionalTestingBundle\Fixtures\SbsClientStateManager:
arguments:
- "@engineblock.functional_testing.data_store.sbs_client_state_mananger"
2 changes: 0 additions & 2 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ services:

mariadb:
image: mariadb:10.6
restart: always
container_name: eb-db-test
environment:
MYSQL_ROOT_PASSWORD: "root"
Expand Down Expand Up @@ -62,5 +61,4 @@ services:
- ../theme:/theme

volumes:
eb-mysql-data:
eb-mysql-test-data:
24 changes: 17 additions & 7 deletions docs/filter_commands.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# EngineBlock Input and Output Command Chains

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

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

## Input and Output Filters

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

Each Filter then executes Filter Commands in a specified order for Input (between receiving Assertion from IdP and
Consent) and Output (after Consent, before sending Response to SP).
Consent) and Output (after Consent, before sending Response to SP).
What the filter does is:
```
Loop over given Filter Commands, for each Command:
Expand All @@ -30,7 +30,7 @@ Loop over given Filter Commands, for each Command:
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)
execute the command
```
During the loop, the Response, responseAttributes and collabPersonId are retrieved from the previous command and are
During the loop, the Response, responseAttributes and collabPersonId are retrieved from the previous command and are
used by the commands that follows.

A command can also stop filtering by calling `$this->stopFiltering();`
Expand Down Expand Up @@ -67,7 +67,7 @@ Uses:
- EngineBlock_Saml2_ResponseAnnotationDecorator
- responseAttributes

### NormalizeAttributes
### NormalizeAttributes
Convert all OID attributes to URN and remove the OID variant

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

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

Depends On:
Expand Down Expand Up @@ -343,8 +343,18 @@ Uses:
- OpenConext\EngineBlock\Metadata\Entity\IdentityProvider
- EngineBlock_Saml2_AuthnRequestAnnotationDecorator

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

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.

If enabled, the SramInterruptFilter will call SBS with the sessionId.
If the sessionId is known in SBS, EB will merge the attributes supplied by SBS into the Auth request.
IF the sessionId is unknown, later in the Consume Assertion process, the browser will be redirected to SBS,
which will redirect back to EB after a successful check. Then the attributes from SBS will be merged after all.

See https://github.com/OpenConext/OpenConext-engineblock/issues/1804 for details.


[input]: https://github.com/OpenConext/OpenConext-engineblock/tree/master/library/EngineBlock/Corto/Filter/Input.php
Expand Down
12 changes: 12 additions & 0 deletions library/EngineBlock/Application/DiContainer.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
use OpenConext\EngineBlock\Stepup\StepupEntityFactory;
use OpenConext\EngineBlock\Stepup\StepupGatewayCallOutHelper;
use OpenConext\EngineBlock\Validator\AllowedSchemeValidator;
use OpenConext\EngineBlockBundle\Sbs\SbsAttributeMerger;
use OpenConext\EngineBlockBundle\Sbs\SbsClientInterface;
use Symfony\Component\DependencyInjection\ContainerInterface as SymfonyContainerInterface;
use Symfony\Component\Mailer\MailerInterface;
use Twig\Environment;
Expand Down Expand Up @@ -309,6 +311,16 @@ protected function getSymfonyContainer()
return $this->container;
}

public function getSbsAttributeMerger(): SbsAttributeMerger
{
return $this->container->get('engineblock.sbs.attribute_merger');
}

public function getSbsClient(): SbsClientInterface
{
return $this->container->get('engineblock.sbs.sbs_client');
}

public function getPdpClient()
{
return $this->container->get(\OpenConext\EngineBlockBundle\Pdp\PdpClient::class);
Expand Down
1 change: 0 additions & 1 deletion library/EngineBlock/Application/ErrorHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ public function exception(Throwable $e)
foreach ($this->_exitHandlers as $exitHandler) {
$exitHandler($e);
}
throw $e;

$this->_application->reportError($e);

Expand Down
3 changes: 1 addition & 2 deletions library/EngineBlock/Application/TestDiContainer.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
* limitations under the License.
*/

use OpenConext\EngineBlock\Stepup\StepupEndpoint;
use OpenConext\EngineBlockBundle\Pdp\PdpClientInterface;

/**
Expand Down Expand Up @@ -49,7 +48,7 @@ public function getPdpClient()
return $this->pdpClient ?? parent::getPdpClient();
}

public function setPdpClient(PdpClientInterface $pdpClient)
public function setPdpClient(?PdpClientInterface $pdpClient)
{
$this->pdpClient = $pdpClient;
}
Expand Down
5 changes: 5 additions & 0 deletions library/EngineBlock/Corto/Adapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,11 @@ public function processWayf()
$this->_callCortoServiceUri('continueToIdp');
}

public function processSramInterrupt()
{
$this->_callCortoServiceUri('SramInterruptService');
}

public function processConsent()
{
$this->_callCortoServiceUri('processConsentService');
Expand Down
Loading