private AuthnStatement buildAuthnStatement ( final Object casAssertion , final RequestAbstractType authnRequest , final SamlRegisteredServiceServiceProviderMetadataFacade adaptor , final SamlRegisteredService service , final String binding , final MessageContext messageContext , final HttpServletRequest request ) throws SamlException { val assertion = Assertion . class . cast ( casAssertion ) ; val authenticationMethod = this . authnContextClassRefBuilder . build ( assertion , authnRequest , adaptor , service ) ; var id = request != null ? CommonUtils . safeGetParameter ( request , CasProtocolConstants . PARAMETER_TICKET ) : StringUtils . EMPTY ; if ( StringUtils . isBlank ( id ) ) { LOGGER . warn ( "Unable to locate service ticket as the session index; Generating random identifier instead..." ) ; id = ' ' + String . valueOf ( RandomUtils . nextLong ( ) ) ; } val statement = newAuthnStatement ( authenticationMethod , DateTimeUtils . zonedDateTimeOf ( assertion . getAuthenticationDate ( ) ) , id ) ; if ( assertion . getValidUntilDate ( ) != null ) { val dt = DateTimeUtils . zonedDateTimeOf ( assertion . getValidUntilDate ( ) ) ; statement . setSessionNotOnOrAfter ( DateTimeUtils . dateTimeOf ( dt . plusSeconds ( casProperties . getAuthn ( ) . getSamlIdp ( ) . getResponse ( ) . getSkewAllowance ( ) ) ) ) ; } val subjectLocality = buildSubjectLocality ( assertion , authnRequest , adaptor , binding ) ; statement . setSubjectLocality ( subjectLocality ) ; return statement ; }
Creates an authentication statement for the current request .