protected String buildRedirectUrlByRequestedAuthnContext ( final String initialUrl , final AuthnRequest authnRequest , final HttpServletRequest request ) { val authenticationContextClassMappings = samlProfileHandlerConfigurationContext . getCasProperties ( ) . getAuthn ( ) . getSamlIdp ( ) . getAuthenticationContextClassMappings ( ) ; if ( authnRequest . getRequestedAuthnContext ( ) == null || authenticationContextClassMappings == null || authenticationContextClassMappings . isEmpty ( ) ) { return initialUrl ; } val mappings = getAuthenticationContextMappings ( ) ; val p = authnRequest . getRequestedAuthnContext ( ) . getAuthnContextClassRefs ( ) . stream ( ) . filter ( ref -> { val clazz = ref . getAuthnContextClassRef ( ) ; return mappings . containsKey ( clazz ) ; } ) . findFirst ( ) ; if ( p . isPresent ( ) ) { val mappedClazz = mappings . get ( p . get ( ) . getAuthnContextClassRef ( ) ) ; return initialUrl + ' ' + samlProfileHandlerConfigurationContext . getCasProperties ( ) . getAuthn ( ) . getMfa ( ) . getRequestParameter ( ) + ' ' + mappedClazz ; } return initialUrl ; }
Build redirect url by requested authn context .