-
Notifications
You must be signed in to change notification settings - Fork 2
Add full-flow behat + playwright coverage for GSSP service name #95
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
kayjoosten
wants to merge
7
commits into
main
Choose a base branch
from
feature/gssp-service-name-fullflow-behat
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+187
−6
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
a0c1c0b
Add full-flow behat coverage for GSSP service name from AuthnRequest …
kayjoosten b8904f0
Add playwright coverage and GSSP registration-page step for service name
kayjoosten fa374f0
Drop local sp.php override now that the fix moved upstream to devssp
kayjoosten 983e49c
Add SSO-flow coverage and fix service_name shape, per review feedback
kayjoosten bb1f635
fix(behat): update stale Yubikey OTP field/button ids
kayjoosten b5f3269
docs: fix stale references in gssp_service_name docs
kayjoosten d86182b
Remove Playwright suite from this PR
kayjoosten File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,70 @@ | ||
| #!/usr/bin/env bash | ||
| set -euo pipefail | ||
|
|
||
| # Seeds a fully vetted Demo GSSP identity directly via Middleware's command API, | ||
| # bypassing registration UI, RA app, e-mail, and any physical/virtual second factor | ||
| # hardware entirely. Mirrors the "has a vetted demo-gssp" step in | ||
| # tests/behat/features/bootstrap/FeatureContext.php (theUserHasAVettedWithIdentifier), | ||
| # adapted from the smoketest DB to this environment's real dev DB/credentials. | ||
| # | ||
| # Usage: ./seed-test-identity.sh <slug> [institution] [gssf-id] | ||
| # | ||
| # After running, log in via the ssp test SP (https://ssp.dev.openconext.local/simplesaml/sp.php) | ||
| # as <slug>/<slug>, request an LoA that Demo GSSP satisfies, and pick "Demo GSSP" as the | ||
| # second factor -- no registration/vetting/hardware step needed. | ||
|
|
||
| SLUG="${1:?Usage: $0 <slug> [institution] [gssf-id]}" | ||
| INSTITUTION="${2:-dev.openconext.local}" | ||
| GSSF_ID="${3:-seed-$SLUG}" | ||
| NAME_ID="urn:collab:person:${INSTITUTION}:${SLUG}" | ||
| IDENTITY_ID=$(uuidgen | tr 'A-Z' 'a-z') | ||
| SECOND_FACTOR_ID=$(uuidgen | tr 'A-Z' 'a-z') | ||
|
|
||
| # Real SRAA identity in this environment's dev DB (has RA authority everywhere). | ||
| # Look it up fresh rather than hardcoding, in case the admin identity_id ever changes. | ||
| ACTOR_ID=$(docker exec stepup-mariadb-1 mysql -uroot -psecret middleware -N -B \ | ||
| -e "SELECT id FROM identity WHERE name_id='urn:collab:person:dev.openconext.local:admin';") | ||
|
|
||
| if [ -z "$ACTOR_ID" ]; then | ||
| echo "Could not find the admin/SRAA identity in the middleware DB -- is the environment bootstrapped?" >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| MW=https://middleware.dev.openconext.local | ||
| DB="docker exec stepup-mariadb-1 mysql -uroot -psecret -N -B middleware" | ||
|
|
||
| post() { | ||
| local user=$1 pass=$2 body=$3 | ||
| curl -sk -u "$user:$pass" -H 'Content-Type: application/json' -H 'Accept: application/json' -X POST "$MW/command" -d "$body" | ||
| echo | ||
| } | ||
|
|
||
| echo "== Creating identity $NAME_ID ($IDENTITY_ID) ==" | ||
| post ss sa_secret "$(printf '{"meta":{"actor_id":null,"actor_institution":null},"command":{"name":"Identity:CreateIdentity","uuid":"%s","payload":{"id":"%s","name_id":"%s","institution":"%s","email":"%s@dev.openconext.local","common_name":"%s","preferred_locale":"en_GB"}}}' \ | ||
| "$(uuidgen)" "$IDENTITY_ID" "$NAME_ID" "$INSTITUTION" "$SLUG" "$SLUG")" | ||
|
|
||
| echo "== Proving possession of Demo GSSP token (gssf_id=$GSSF_ID) ==" | ||
| post ss sa_secret "$(printf '{"meta":{"actor_id":"%s","actor_institution":"%s"},"command":{"name":"Identity:ProveGssfPossession","uuid":"%s","payload":{"identity_id":"%s","second_factor_id":"%s","stepup_provider":"demo_gssp","gssf_id":"%s"}}}' \ | ||
| "$IDENTITY_ID" "$INSTITUTION" "$(uuidgen)" "$IDENTITY_ID" "$SECOND_FACTOR_ID" "$GSSF_ID")" | ||
|
|
||
| # Unlike yubikey/sms, GSSF possession (Identity:ProveGssfPossession) is proven-and-verified | ||
| # in a single event (GssfPossessionProvenAndVerifiedEvent) -- no separate e-mail/nonce step. | ||
| REG_CODE=$($DB -e "SELECT registration_code FROM verified_second_factor WHERE identity_id='$IDENTITY_ID' ORDER BY registration_requested_at DESC LIMIT 1;") | ||
| if [ -z "$REG_CODE" ]; then | ||
| echo "No verified_second_factor row found for $IDENTITY_ID -- VerifyEmail likely failed, see output above." >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| echo "== Vetting (registration code $REG_CODE, authority $ACTOR_ID) ==" | ||
| post ra ra_secret "$(printf '{"meta":{"actor_id":"%s","actor_institution":"%s"},"command":{"name":"Identity:VetSecondFactor","uuid":"%s","payload":{"authority_id":"%s","identity_id":"%s","second_factor_id":"%s","registration_code":"%s","second_factor_type":"demo_gssp","second_factor_identifier":"%s","document_number":"123456","identity_verified":true}}}' \ | ||
| "$ACTOR_ID" "$INSTITUTION" "$(uuidgen)" "$ACTOR_ID" "$IDENTITY_ID" "$SECOND_FACTOR_ID" "$REG_CODE" "$GSSF_ID")" | ||
|
|
||
| VETTED=$($DB -e "SELECT id FROM vetted_second_factor WHERE identity_id='$IDENTITY_ID';") | ||
| echo | ||
| if [ -n "$VETTED" ]; then | ||
| echo "Done. $SLUG now has a vetted Demo GSSP token (second_factor_id=$VETTED)." | ||
| echo "Log in at https://ssp.dev.openconext.local/simplesaml/sp.php as ${SLUG}/${SLUG}, pick a Request LOA Demo GSSP satisfies, and select Demo GSSP as the second factor." | ||
| else | ||
| echo "Vetting did not produce a vetted_second_factor row -- check the command output above for an error." >&2 | ||
| exit 1 | ||
| fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| # Tagged SKIP until Stepup-Gateway PR #624 (append_service_name_to_authnrequest) is merged | ||
| # and released in the test image. (OpenConext-devssp's mdui_displayname field already merged | ||
| # and is in the stock devssp image, so no local sp.php override is needed anymore.) | ||
| # Until then, run locally with: | ||
| # ./start-dev-env.sh gateway:<Stepup-Gateway checkout> demogssp:<Stepup-gssp-example checkout> | ||
| # docker compose exec behat ./vendor/bin/behat --config config/behat.yml --tags='~@wip' features/gssp_service_name.feature | ||
| @SKIP | ||
| Feature: The GSSP shows the name of the service the user is authenticating for | ||
| In order to know which service I am authenticating for | ||
| As a user | ||
| I want the GSSP authentication page to show the service name from the AuthnRequest | ||
|
|
||
| # Covers the cross-repo flow of the mdui:UIInfo service name: | ||
| # the SP sends an AuthnRequest with an mdui:UIInfo/mdui:DisplayName extension, | ||
| # the Stepup-Gateway (feature flag append_service_name_to_authnrequest) | ||
| # reads it and forwards it in the proxy AuthnRequest to the GSSP, where the | ||
| # GSSP (Stepup-gssp-example via Stepup-gssp-bundle and Stepup-saml-bundle) | ||
| # displays it on the authentication page. | ||
| Scenario: Service name from the AuthnRequest mdui:UIInfo is shown on the GSSP authentication page | ||
| Given a service provider configured for second-factor-only | ||
| And a user "jane-a-ra" identified by "urn:collab:person:institution-a.example.com:jane-a-ra" from institution "institution-a.example.com" with UUID "00000000-0000-4000-8000-000000000001" | ||
| And the user "urn:collab:person:institution-a.example.com:jane-a-ra" has a vetted "demo-gssp" with identifier "gssp-identifier123" | ||
| When I start an SFO authentication for "urn:collab:person:institution-a.example.com:jane-a-ra" with service name "Behat Test Service" | ||
| Then I see service name "Behat Test Service" on the GSSP authentication page | ||
| When I verify the "demo-gssp" second factor | ||
| Then I am logged on the service provider | ||
|
|
||
| # Reuses the identity vetted in the previous scenario, like sfo.feature does. | ||
| Scenario: No service name is shown when the AuthnRequest carries no mdui:UIInfo | ||
| Given a service provider configured for second-factor-only | ||
| When I start an SFO authentication for "urn:collab:person:institution-a.example.com:jane-a-ra" | ||
| Then I should not see "Behat Test Service" | ||
| When I verify the "demo-gssp" second factor | ||
| Then I am logged on the service provider | ||
|
|
||
| # Gateway has three independent LoginService::singleSignOn implementations that each | ||
| # read the mdui:UIInfo extension behind the same feature flag: GatewayBundle (plain | ||
| # SSO, exercised here), SecondFactorOnlyBundle, and SamlStepupProviderBundle (both | ||
| # exercised by the SFO scenarios above). Without this scenario, a regression in the | ||
| # SSO copy specifically would go undetected even with the SFO scenarios passing. | ||
| Scenario: Service name from the AuthnRequest mdui:UIInfo is shown on the GSSP authentication page via the plain SSO flow | ||
| Given a service provider configured for single-signon | ||
| And a user "Jane Toppan" identified by "urn:collab:person:institution-a.example.com:jane-a2" from institution "institution-a.example.com" | ||
| And the user "urn:collab:person:institution-a.example.com:jane-a2" has a vetted "demo-gssp" with identifier "gssp-identifier-sso1" | ||
| When I visit the service provider with service name "SSO Flow Service Name" | ||
| And I authenticate as "jane-a2" with the identity provider | ||
| Then I see service name "SSO Flow Service Name" on the GSSP authentication page | ||
| When I verify the "demo-gssp" second factor | ||
| Then I am logged on the service provider | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What i expect to see here: All 3 of the LoginService::singleSignOn methods should be triggered from here to see if the gateway applies (or discards????) the mdui information.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
stepup/tests/behat/features/sfo.featurestepup/tests/behat/features/sfo_gssp_fallback.feature