/** {@inheritDoc} */ protected void processAttribute(XMLObject samlObject, Attr attribute) throws UnmarshallingException { AuthnStatement authnStatement = (AuthnStatement) samlObject; if (attribute.getLocalName().equals(AuthnStatement.AUTHN_INSTANT_ATTRIB_NAME) && !Strings.isNullOrEmpty(attribute.getValue())) { authnStatement.setAuthnInstant(new DateTime(attribute.getValue(), ISOChronology.getInstanceUTC())); } else if (attribute.getLocalName().equals(AuthnStatement.SESSION_INDEX_ATTRIB_NAME)) { authnStatement.setSessionIndex(attribute.getValue()); } else if (attribute.getLocalName().equals(AuthnStatement.SESSION_NOT_ON_OR_AFTER_ATTRIB_NAME) && !Strings.isNullOrEmpty(attribute.getValue())) { authnStatement.setSessionNotOnOrAfter(new DateTime(attribute.getValue(), ISOChronology.getInstanceUTC())); } else { super.processAttribute(samlObject, attribute); } } }
/** * New authn statement. * * @param contextClassRef the context class ref such as {@link AuthnContext#PASSWORD_AUTHN_CTX} * @param authnInstant the authn instant * @return the authn statement */ public AuthnStatement newAuthnStatement(final String contextClassRef, final DateTime authnInstant) { final AuthnStatement stmt = newSamlObject(AuthnStatement.class); final AuthnContext ctx = newSamlObject(AuthnContext.class); final AuthnContextClassRef classRef = newSamlObject(AuthnContextClassRef.class); classRef.setAuthnContextClassRef(contextClassRef); ctx.setAuthnContextClassRef(classRef); stmt.setAuthnContext(ctx); stmt.setAuthnInstant(authnInstant); return stmt; }
statement.setAuthnInstant(new DateTime(getAuthenticationResult().getAuthenticationInstant()));
authInstant = new DateTime(); authnStatement.setAuthnInstant(authInstant);
authStmt.setAuthnInstant(new DateTime());
authStmt.setAuthnInstant(new DateTime());
authnStatement.setSessionIndex(stmt.getSessionIndex()); authnStatement.setSessionNotOnOrAfter(stmt.getSessionNotOnOrAfter()); authnStatement.setAuthnInstant(stmt.getAuthInstant());