@ ReadOperation public Map < String , Object > handle ( final String username , final String password , final String service ) { val selectedService = this . serviceFactory . createService ( service ) ; val registeredService = this . servicesManager . findServiceBy ( selectedService ) ; val credential = new UsernamePasswordCredential ( username , password ) ; val result = this . authenticationSystemSupport . handleAndFinalizeSingleAuthenticationTransaction ( selectedService , credential ) ; val authentication = result . getAuthentication ( ) ; val principal = authentication . getPrincipal ( ) ; val attributesToRelease = registeredService . getAttributeReleasePolicy ( ) . getAttributes ( principal , selectedService , registeredService ) ; val principalId = registeredService . getUsernameAttributeProvider ( ) . resolveUsername ( principal , selectedService , registeredService ) ; val modifiedPrincipal = this . principalFactory . createPrincipal ( principalId , attributesToRelease ) ; val builder = DefaultAuthenticationBuilder . newInstance ( authentication ) ; builder . setPrincipal ( modifiedPrincipal ) ; val finalAuthentication = builder . build ( ) ; val samlResponse = this . samlResponseBuilder . createResponse ( selectedService . getId ( ) , selectedService ) ; samlResponseBuilder . prepareSuccessfulResponse ( samlResponse , selectedService , finalAuthentication , principal , finalAuthentication . getAttributes ( ) , principal . getAttributes ( ) ) ; val resValidation = new LinkedHashMap < String , Object > ( ) ; val encoded = SamlUtils . transformSamlObject ( this . openSamlConfigBean , samlResponse ) . toString ( ) ; resValidation . put ( CasViewConstants . MODEL_ATTRIBUTE_NAME_ASSERTION , encoded ) ; resValidation . put ( CasViewConstants . MODEL_ATTRIBUTE_NAME_SERVICE , selectedService ) ; resValidation . put ( "registeredService" , registeredService ) ; return resValidation ; }
Handle validation request and produce saml1 payload .