/** {@inheritDoc} */ protected void processAttribute(XMLObject samlObject, Attr attribute) throws UnmarshallingException { AuthenticationStatement authenticationStatement = (AuthenticationStatement) samlObject; if (AuthenticationStatement.AUTHENTICATIONINSTANT_ATTRIB_NAME.equals(attribute.getLocalName()) && !Strings.isNullOrEmpty(attribute.getValue())) { DateTime value = new DateTime(attribute.getValue(), ISOChronology.getInstanceUTC()); authenticationStatement.setAuthenticationInstant(value); } else if (AuthenticationStatement.AUTHENTICATIONMETHOD_ATTRIB_NAME.equals(attribute.getLocalName())) { authenticationStatement.setAuthenticationMethod(attribute.getValue()); } else { super.processAttribute(samlObject, attribute); } } }
/** * New authentication statement. * * @param authenticationDate the authentication date * @param authenticationMethod the authentication method * @param subjectId the subject id * @return the authentication statement */ public AuthenticationStatement newAuthenticationStatement(final Date authenticationDate, final String authenticationMethod, final String subjectId) { final AuthenticationStatement authnStatement = newSamlObject(AuthenticationStatement.class); authnStatement.setAuthenticationInstant(new DateTime(authenticationDate)); authnStatement.setAuthenticationMethod( authenticationMethod != null ? authenticationMethod : SamlAuthenticationMetaDataPopulator.AUTHN_METHOD_UNSPECIFIED); authnStatement.setSubject(newSubject(subjectId)); return authnStatement; }
/** * Build new authentication statement. * * @param authnInstant authentication instant * @param authnMethod authentication method * @param principal authenticated principal * @return new authentication statement */ private AuthenticationStatement newAuthenticationStatement( final DateTime authnInstant, final String authnMethod, final String principal) { final AuthenticationStatement authnStatement = newSAMLObject( AuthenticationStatement.class, AuthenticationStatement.DEFAULT_ELEMENT_NAME); authnStatement.setAuthenticationInstant(authnInstant); authnStatement.setAuthenticationMethod(authnMethod); authnStatement.setSubject(newSubject(principal)); return authnStatement; }
statement.setAuthenticationInstant(new DateTime(getAuthenticationResult().getAuthenticationInstant()));
authenticationStatement.setAuthenticationInstant( statementBean.getAuthenticationInstant() ); } else { authenticationStatement.setAuthenticationInstant(new DateTime());