From d6b82da95564b81e174279a2338972635f0ac3ab Mon Sep 17 00:00:00 2001 From: Pieter van der Meulen Date: Sat, 14 Nov 2026 12:04:12 +0100 Subject: [PATCH 1/3] Add configuration to use the OpenConext-devconf EntraID mock IdP --- config/openconext/institutions.yaml.dist | 48 +++++++++++++++++++++++- 1 file changed, 46 insertions(+), 2 deletions(-) diff --git a/config/openconext/institutions.yaml.dist b/config/openconext/institutions.yaml.dist index b728597..a9172ef 100644 --- a/config/openconext/institutions.yaml.dist +++ b/config/openconext/institutions.yaml.dist @@ -3,6 +3,48 @@ parameters: institution_configuration: # Configuration identifier data: # The root node institutions: + + # Configuration for the OpenConext-devconf stepup environment. This makes AzureMFA use an EntraID mock IdP + # hosed by OpenConext-devssp (https://ssp.dev.openconext.local/entra-mock/saml2/idp/metadata.php) + # All devssp test accounts have an email address in the dev.openconext.local domain: + # E.g. "jane-a1" has email "jane+jane-a1@dev.openconext.local". + # So all AzureMFA registrations and authentications from the devconf environment match this configuration entry + # in institutions.yaml. + dev.openconext.local: + entity_id: 'https://ssp.dev.openconext.local/entra-mock/saml2/idp/metadata.php' + sso_location: 'https://ssp.dev.openconext.local/entra-mock/module.php/saml/idp/singleSignOnService' + certificates: # The stepup/ssp/entra-mock-idp.crt certificate in OpenConext-devconf + - | + -----BEGIN CERTIFICATE----- + MIIEaTCCAtGgAwIBAgIUJMIyy4Cnz1if3CasoLChoWcIg5swDQYJKoZIhvcNAQEL + BQAwRDEZMBcGA1UEAwwQRW50cmFJRCBtb2NrIElkUDEnMCUGA1UECgweRGV2ZWxv + cG1lbnQgRG9ja2VyIGVudmlyb25tZW50MB4XDTI2MTExMzE0MTYyM1oXDTMxMTEx + MjE0MTYyM1owRDEZMBcGA1UEAwwQRW50cmFJRCBtb2NrIElkUDEnMCUGA1UECgwe + RGV2ZWxvcG1lbnQgRG9ja2VyIGVudmlyb25tZW50MIIBojANBgkqhkiG9w0BAQEF + AAOCAY8AMIIBigKCAYEA1V2+fFS2nFsdFTTuHore5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3AVgvg6UrDib6gkq04ZfBe77VRc4GqxIHf878fziXlUXhZAH2ge7CEqUU/zoXr + jbcu5Y7B9hFq1t3+GOQenSsPHa06zvP3wucjUk4= + -----END CERTIFICATE----- + email_domains: + - 'dev.openconext.local' + is_azure_ad: true # AzureAD (Entra) does not accept a SAML subject, ADFS does require this + institution-a.example.com: # The institution identifier (schacHomeOrganization) entity_id: 'https://azuremfa.dev.openconext.local/mock/metadata' # The Entity Id of the remote Azure MFA endpoint sso_location: 'https://azuremfa.dev.openconext.local/mock/sso' # Location of the Azure MFA endpoint @@ -34,10 +76,9 @@ parameters: -----END CERTIFICATE----- email_domains: # A list of email domains that are used to identify registering users (addresses must match the email domain of the institution) - - 'dev.openconext.local' - 'institution-a.example.com' - - '*.dev.openconext.local' # Wildcards are allowed is_azure_ad: true # AzureAD (Entra) does not accept a SAML subject, ADFS does require this + institution-b.example.com: # The institution identifier (schacHomeOrganization) entity_id: 'https://azuremfa.dev.openconext.local/mock/metadata' # The Entity Id of the remote Azure MFA endpoint sso_location: 'https://azuremfa.dev.openconext.local/mock/sso' # Location of the Azure MFA endpoint @@ -70,16 +111,19 @@ parameters: email_domains: # A list of email domains that are used to identify registering users (addresses must match the email domain of the institution) - 'institution-b.example.com' is_azure_ad: true # AzureAD (Entra) does not accept a SAML subject, ADFS does require this + institution-c.example.com: # The institution identifier (schacHomeOrganization) metadata_url: 'https://azuremfa.dev.openconext.local/mock/metadata' email_domains: # A list of email domains that are used to identify registering users (addresses must match the email domain of the institution) - 'institution-c.example.com' is_azure_ad: true # AzureAD (Entra) does not accept a SAML subject, ADFS does require this + institution-d.example.com: # The institution identifier (schacHomeOrganization) metadata_url: 'https://azuremfa.dev.openconext.local/mock/metadata-rollover' email_domains: # A list of email domains that are used to identify registering users (addresses must match the email domain of the institution) - 'institution-d.example.com' is_azure_ad: true # AzureAD (Entra) does not accept a SAML subject, ADFS does require this + harting-college.nl: sso_location: 'https://adfs.harting-college.nl/adfs/ls/' entity_id: 'https://azuremfa.dev.openconext.local/mock/metadata' # The Entity Id of the remote Azure MFA endpoint From 6867063b4fc8b744e97b92727a499b20cec478f3 Mon Sep 17 00:00:00 2001 From: Pieter van der Meulen Date: Sat, 14 Nov 2026 13:06:44 +0100 Subject: [PATCH 2/3] Update readme with testing and configuration instructions Tests need the dev container with the OpenConext-devconf configuration to run --- README.md | 100 +++++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 87 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index e0a8776..4b09a11 100644 --- a/README.md +++ b/README.md @@ -73,15 +73,18 @@ Install `$ cp config/openconext/parameters.yaml.dist config/openconext/parameters.yaml` **Bring up the container in dev-mode** -From you dev-conf installation start the `stepup` dev-env with AzureMFA in dev mode +From your OpenConext-devconf checkout, start the `stepup` dev-env with your local AzureMFA code mounted in the +`azuremfa` container (in dev mode). -For example: +For example, when OpenConext-devconf and Stepup-AzureMFA are checked out in the same directory: ```bash -cd stepup -./start-dev-env.sh azuremfa:../../OpenConext-stepup/Stepup-AzureMFA +cd OpenConext-devconf/stepup +./start-dev-env.sh azuremfa:../../Stepup-AzureMFA ``` +The path after `azuremfa:` is the path to your Stepup-AzureMFA checkout, relative to the `stepup` directory or absolute. + **Building frontend assets:** Run `composer frontend-install` and optionally after that: `yarn encore watch` for a development build @@ -95,7 +98,12 @@ If everything goes as planned you can go to: Configuring institutions using Azure MFA ---------- -The application can be thought to the Azure MFA GSSP via YAML configuration. +The institutions that can use the AzureMFA GSSP are configured in `config/institutions.yaml`. For each institution you +configure the Azure MFA IdP (EntraID or ADFS) to send users to, and the email domains of its users. +During registration and authentication, the domain of the user's email address selects the institution. +So it's the domain of the user's email address that selects the EntraID tenant or ADFS IdP that AzureMFA GSSP uses. +The schacHomeOrganization of the user (i.e. how the rest of stepup identifies the user's institution) is NOT used in +the AzureMFA GSSP. In `config/openconext/institutions.yaml.dist` you will find a sample configuration. This configuration should be copied to `config/openconext/institutions.yaml` and be configured to fit your use case. @@ -104,20 +112,86 @@ The dist file goes into details about the different configuration options. Debugging ------------------- -Xdebug is configured when provisioning your development Vagrant box. -It's configured with auto connect IDE_KEY=phpstorm. +Xdebug is installed and enabled in the `stepup-azuremfa-1` container when it runs with your local code mounted (see +[Bring up the container in dev-mode](#install)). It is configured with: + +- `xdebug.mode=debug` and `xdebug.start_with_request=default` (trigger mode): a debug session is only started when + requested, e.g. by an `XDEBUG_SESSION` cookie (set by an Xdebug browser extension) or by an `XDEBUG_SESSION` + environment variable for CLI commands +- `xdebug.client_host=host.docker.internal` and `xdebug.client_port=9003`: Xdebug connects to the IDE on your host +- `xdebug.idekey=PHPSTORM` + +In your IDE, listen for incoming debug connections on port 9003 and map your local Stepup-AzureMFA directory to +`/var/www/html` in the container. In PhpStorm, configure the path mapping on a server named +`azuremfa.dev.openconext.local` (Settings > PHP > Servers). To debug a CLI command, like a test, start it with the +trigger set and tell PhpStorm which server mapping to use, e.g.: + +```bash +docker exec -it -e XDEBUG_SESSION=PHPSTORM -e PHP_IDE_CONFIG=serverName=azuremfa.dev.openconext.local stepup-azuremfa-1 composer behat +``` Tests and metrics -====================== +================= + +The tests (PHPUnit and Behat) and the QA tools must be run in the `stepup-azuremfa-1` container of the +OpenConext-devconf `stepup` environment, with your local Stepup-AzureMFA code mounted in it. The tests depend on that +container and the configuration for OpenConext-devconf that it brings in: +- The SAML key and certificates are read from `/config/...` (see `config/openconext/parameters.yaml`). In the + container the `stepup` directory of OpenConext-devconf is mounted on `/config`. +- The tests use the dev/test-only mock Azure MFA IdP of this application (`https://azuremfa.dev.openconext.local/mock/...`), + so the institutions in `config/openconext/institutions.yaml` must match the ones the tests expect. + The tests do not use the EntraID mock IdP of the OpenConext-devconf `stepup` environment. + +Setting up the container +------------------------ + +1. From the `stepup` directory of OpenConext-devconf, start the environment with your local AzureMFA code mounted + in the `azuremfa` container: + + ```bash + ./start-dev-env.sh azuremfa:~/path/to/Stepup-AzureMFA + ``` + + This runs the container with `APP_ENV=dev` and your code mounted on `/var/www/html`. -To run all required test you can run the following commands from the dev env: +2. Install the dependencies and build the frontend assets in the container: -```bash - composer check - # To run the behat tests - composer behat + ```bash + docker exec -it stepup-azuremfa-1 composer install + docker exec -it stepup-azuremfa-1 composer frontend-install + ``` + + This will install the dependencies and build the frontend assets in the container. + The `institutions.yaml` and `parameters.yaml` are created from their .dist files if they do not exist. + +Running the tests +----------------- + +Run the tests from your host using `docker exec`: + +``` +docker exec -it stepup-azuremfa-1 bash +``` + +The test scripts select the Symfony `test` environment themselves, independent of the `APP_ENV` of the container. + +```bash +# PHPUnit: all tests, only the unit tests, or only the web tests +docker exec -it stepup-azuremfa-1 composer test +docker exec -it stepup-azuremfa-1 composer unit-tests +docker exec -it stepup-azuremfa-1 composer web-tests + +# Behat tests (tests/Functional/Features) +docker exec -it stepup-azuremfa-1 composer behat + + +# All QA checks (composer validate, docheader, lint, phpcs, phpmd, phpstan, rector, unit and web tests) +docker exec -it stepup-azuremfa-1 composer check ``` +To run a single Behat feature, pass its path to the behat script, e.g. +`docker exec -it stepup-azuremfa-1 ./ci/qa/behat tests/Functional/Features/authentication.feature`. + Every part can be run separately. Check "scripts" section of the composer.json file for the different options. Release instructions From 075928167df5b921e078ad903228606f95dbb5ed Mon Sep 17 00:00:00 2001 From: Pieter van der Meulen Date: Sat, 14 Nov 2026 13:12:03 +0100 Subject: [PATCH 3/3] Use institution-a.example.com instead of dev.openconext.local in behat tests dev.openconext.local is now used by the OpenConext-devconf environment and is configured to use EntraID mock IdP provided by OpenConext-devssp. For the behat tests the Mock that is part of the AzureMFA component itself is used, and institution-a.example.com already points to that. --- tests/Functional/Features/authentication.feature | 10 +++++----- tests/Functional/Features/sp_authentication.feature | 6 +++--- .../Features/sp_authentication_auth_only.feature | 6 +++--- tests/Functional/Features/sp_registration.feature | 6 +++--- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/tests/Functional/Features/authentication.feature b/tests/Functional/Features/authentication.feature index 4bcfe9b..ad92fc5 100644 --- a/tests/Functional/Features/authentication.feature +++ b/tests/Functional/Features/authentication.feature @@ -3,24 +3,24 @@ Feature: When an user needs to authenticate I need to send an AuthnRequest with a nameID to the Azure MFA GSSP IdP Scenario: The user authenticates successfully - Given I send an authentication request to "https://azuremfa.dev.openconext.local/saml/sso" with NameID "q2b27d-0000|user@dev.openconext.local" + Given I send an authentication request to "https://azuremfa.dev.openconext.local/saml/sso" with NameID "q2b27d-0000|user@institution-a.example.com" # And the received AuthNRequest should have the ForceAuthn attribute Given the login with Azure MFA succeeds and the following attributes are released: | name | value | - | urn:mace:dir:attribute-def:mail | user@dev.openconext.local | + | urn:mace:dir:attribute-def:mail | user@institution-a.example.com | | http://schemas.microsoft.com/claims/authnmethodsreferences | http://schemas.microsoft.com/claims/multipleauthn | Then I should be on "https://azuremfa.dev.openconext.local/saml/sso_return" And the SAML Response should contain element "StatusCode" with attribute "Value" with attribute value "urn:oasis:names:tc:SAML:2.0:status:Success" - And the SAML Response should contain element "NameID" with value "q2b27d-0000|user@dev.openconext.local" + And the SAML Response should contain element "NameID" with value "q2b27d-0000|user@institution-a.example.com" Scenario: Authentication fails on the Azure MFA side - Given I send an authentication request to "https://azuremfa.dev.openconext.local/saml/sso" with NameID "q2b27d-0000|user@dev.openconext.local" + Given I send an authentication request to "https://azuremfa.dev.openconext.local/saml/sso" with NameID "q2b27d-0000|user@institution-a.example.com" And the login with Azure MFA gets cancelled Then I should be on "https://azuremfa.dev.openconext.local/saml/sso_return" And the SAML Response should contain element "StatusCode" with attribute "Value" with attribute value "urn:oasis:names:tc:SAML:2.0:status:AuthnFailed" Scenario: Authentication fails because of unknown user on the Azure MFA side - Given I send an authentication request to "https://azuremfa.dev.openconext.local/saml/sso" with NameID "q2b27d-0000|user@dev.openconext.local" + Given I send an authentication request to "https://azuremfa.dev.openconext.local/saml/sso" with NameID "q2b27d-0000|user@institution-a.example.com" And the login with Azure MFA fails Then I should be on "https://azuremfa.dev.openconext.local/saml/sso_return" And the SAML Response should contain element "StatusCode" with attribute "Value" with attribute value "urn:oasis:names:tc:SAML:2.0:status:AuthnFailed" diff --git a/tests/Functional/Features/sp_authentication.feature b/tests/Functional/Features/sp_authentication.feature index 30d7111..456c9e5 100644 --- a/tests/Functional/Features/sp_authentication.feature +++ b/tests/Functional/Features/sp_authentication.feature @@ -8,14 +8,14 @@ Feature: When an user needs to authenticate # The user clicks on authenticate button from the SP And I am on "https://azuremfa.dev.openconext.local/demo/sp" Then I should see "Demo service provider" - And I fill in "Subject NameID" with "q2b27d-0000|user@dev.openconext.local" + And I fill in "Subject NameID" with "q2b27d-0000|user@institution-a.example.com" Given I press "Authenticate user" # The mock MFA client Then I should be on "https://azuremfa.dev.openconext.local/mock/sso" Given the login with Azure MFA succeeds and the following attributes are released: | name | value | - | urn:mace:dir:attribute-def:mail | user@dev.openconext.local | + | urn:mace:dir:attribute-def:mail | user@institution-a.example.com | | http://schemas.microsoft.com/claims/authnmethodsreferences | http://schemas.microsoft.com/claims/multipleauthn | # The MFA acs page. @@ -25,4 +25,4 @@ Feature: When an user needs to authenticate # Back at the SP. Then I should be on "https://azuremfa.dev.openconext.local/demo/sp/acs" And I should see "Demo Service provider ConsumerAssertionService endpoint" - And I should see "q2b27d-0000|user@dev.openconext.local" + And I should see "q2b27d-0000|user@institution-a.example.com" diff --git a/tests/Functional/Features/sp_authentication_auth_only.feature b/tests/Functional/Features/sp_authentication_auth_only.feature index 5be6cbf..3916c47 100644 --- a/tests/Functional/Features/sp_authentication_auth_only.feature +++ b/tests/Functional/Features/sp_authentication_auth_only.feature @@ -8,14 +8,14 @@ Feature: When an user needs to authenticate # The user clicks on authenticate button from the SP And I am on "https://azuremfa.dev.openconext.local/demo/sp" Then I should see "Demo service provider" - And I fill in "Subject NameID" with "user@dev.openconext.local" + And I fill in "Subject NameID" with "user@institution-a.example.com" Given I press "Authenticate user" # The mock MFA client Then I should be on "https://azuremfa.dev.openconext.local/mock/sso" Given the login with Azure MFA succeeds and the following attributes are released: | name | value | - | urn:mace:dir:attribute-def:mail | user@dev.openconext.local | + | urn:mace:dir:attribute-def:mail | user@institution-a.example.com | | http://schemas.microsoft.com/claims/authnmethodsreferences | http://schemas.microsoft.com/claims/multipleauthn | # The MFA acs page. @@ -25,4 +25,4 @@ Feature: When an user needs to authenticate # Back at the SP. Then I should be on "https://azuremfa.dev.openconext.local/demo/sp/acs" And I should see "Demo Service provider ConsumerAssertionService endpoint" - And I should see "user@dev.openconext.local" + And I should see "user@institution-a.example.com" diff --git a/tests/Functional/Features/sp_registration.feature b/tests/Functional/Features/sp_registration.feature index bcf3bc9..70c81df 100644 --- a/tests/Functional/Features/sp_registration.feature +++ b/tests/Functional/Features/sp_registration.feature @@ -15,14 +15,14 @@ Feature: When an user needs to register for a new token And I should see "Registration" # GSSP assigns a subject name id to the user - Given I fill in "email_address_emailAddress" with "user@dev.openconext.local" + Given I fill in "email_address_emailAddress" with "user@institution-a.example.com" When I press "email_address_submit" # The MFA SSO page Then I should be on "https://azuremfa.dev.openconext.local/mock/sso" Given the login with Azure MFA succeeds and the following attributes are released: | name | value | - | urn:mace:dir:attribute-def:mail | user@dev.openconext.local | + | urn:mace:dir:attribute-def:mail | user@institution-a.example.com | | http://schemas.microsoft.com/claims/authnmethodsreferences | http://schemas.microsoft.com/claims/multipleauthn | # The GSSP acs page. @@ -33,4 +33,4 @@ Feature: When an user needs to register for a new token Then I should be on "https://azuremfa.dev.openconext.local/demo/sp/acs" And I should see "Demo Service provider ConsumerAssertionService endpoint" And I should see "urn:oasis:names:tc:SAML:2.0:status:Succes" - And I should see a NameID with email address "user@dev.openconext.local" + And I should see a NameID with email address "user@institution-a.example.com"