From 26bb8332f0a57f5933f88e71b1ec504796fb6cf9 Mon Sep 17 00:00:00 2001 From: haburger Date: Fri, 7 Feb 2025 09:44:47 +0000 Subject: [PATCH] BUNDBITBK-4339 --- .../recovery_ongoing.groovy | 2 +- .../recovery-preprocessing.xml | 14 +++++++++--- .../recovery-prepareRedirect.groovy | 22 +++++++++++++++++++ .../recovery-processing.groovy | 2 +- .../mobile_nless_auth.groovy | 5 +++-- 5 files changed, 38 insertions(+), 7 deletions(-) create mode 100644 patterns/584964c837512845d7940809_resources/recovery-prepareRedirect.groovy diff --git a/patterns/1d38203c48e017b5b3812385_resources/recovery_ongoing.groovy b/patterns/1d38203c48e017b5b3812385_resources/recovery_ongoing.groovy index fe86291..9cd8c3f 100644 --- a/patterns/1d38203c48e017b5b3812385_resources/recovery_ongoing.groovy +++ b/patterns/1d38203c48e017b5b3812385_resources/recovery_ongoing.groovy @@ -9,7 +9,7 @@ if (inargs['recovery'] != null && inargs['recovery'] == 'recovery' ) { def sessionKeySet = new HashSet(session.keySet()) sessionKeySet.each { key -> if ( key ==~ /.*Recovery_redirectAgovMe-session-participants.*/ ) { - LOG.info("Deleted session attribute '${key}'") + LOG.debug("Deleted session attribute '${key}'") s.removeAttribute(key) } } diff --git a/patterns/584964c837512845d7940809_authStatesFile/recovery-preprocessing.xml b/patterns/584964c837512845d7940809_authStatesFile/recovery-preprocessing.xml index c0a42d8..857581d 100644 --- a/patterns/584964c837512845d7940809_authStatesFile/recovery-preprocessing.xml +++ b/patterns/584964c837512845d7940809_authStatesFile/recovery-preprocessing.xml @@ -185,7 +185,7 @@ - + @@ -230,14 +230,14 @@ - + - + @@ -247,3 +247,11 @@ + + + + + + + + \ No newline at end of file diff --git a/patterns/584964c837512845d7940809_resources/recovery-prepareRedirect.groovy b/patterns/584964c837512845d7940809_resources/recovery-prepareRedirect.groovy new file mode 100644 index 0000000..a7d2576 --- /dev/null +++ b/patterns/584964c837512845d7940809_resources/recovery-prepareRedirect.groovy @@ -0,0 +1,22 @@ +if (session['agov.recovery.redirectDone']) { + // user navigated back from AGOV.me, go again for the code + + // clean up SAML state first, + // IdentityProviderState sets session attributes as follows + // -session-participants. = + // State name contains the name of the pattern 'Recovery_redirectAgovMe' + def s = request.getAuthSession(true) + def sessionKeySet = new HashSet(session.keySet()) + sessionKeySet.each { key -> + if ( key ==~ /.*Recovery_redirectAgovMe-session-participants.*/ ) { + LOG.debug("Deleted session attribute '${key}'") + s.removeAttribute(key) + } + } + s.removeAttribute('agov.recovery.redirectDone') + response.setResult('back') +} else { + // redirect + response.setSessionAttribute('agov.recovery.redirectDone', 'true') + response.setResult('redirect') +} diff --git a/patterns/584964c837512845d7940809_resources/recovery-processing.groovy b/patterns/584964c837512845d7940809_resources/recovery-processing.groovy index b2cf851..e96be6e 100644 --- a/patterns/584964c837512845d7940809_resources/recovery-processing.groovy +++ b/patterns/584964c837512845d7940809_resources/recovery-processing.groovy @@ -16,7 +16,7 @@ def maxLoiRoleToCtxClssConvertorMap = [ ] // https://docs.nevis.net/nevisidm/Developer-Guide/SOAP-Interface/Interface-specification/Value-types#enum-value-types -def blockingCredentialStates = ['DISABLED', 'EXPIRED', 'LOCKED_TEMPORARY', 'LOCKED', 'ARCHIVED', 'RESET_CODE'] +def blockingCredentialStates = ['DISABLED', 'EXPIRED', 'LOCKED', 'ARCHIVED', 'RESET_CODE'] def getUserIdVerificationForRecovery(currentLoaRole) { // application is AGOV-AccountStatus diff --git a/patterns/f63c475c35b616b7c6c1901c_resources/mobile_nless_auth.groovy b/patterns/f63c475c35b616b7c6c1901c_resources/mobile_nless_auth.groovy index e64b940..9eabed0 100644 --- a/patterns/f63c475c35b616b7c6c1901c_resources/mobile_nless_auth.groovy +++ b/patterns/f63c475c35b616b7c6c1901c_resources/mobile_nless_auth.groovy @@ -82,8 +82,9 @@ if (inargs['fidoUafDone'] == 'true' || if (inargs['fallback'] == 'fallback') { response.setResult('fido2') } - // dispatch to recovery - if (inargs['fallback'] == 'recovery') { + +// dispatch to recovery +if (inargs['fallback'] == 'recovery') { response.addOutArg('nevis.transfer.destination', parameters.get('recoveryurl')) response.setStatus(ch.nevis.esauth.auth.engine.AuthResponse.AUTH_CONTINUE) response.setIsRedirectTransfer(true)