private String getAuthenticatingAuthority(final Assertion assertion) { final List<AuthnStatement> authnStatements = assertion.getAuthnStatements(); for (AuthnStatement as : authnStatements) { final List<AuthenticatingAuthority> authorities = as.getAuthnContext().getAuthenticatingAuthorities(); for (AuthenticatingAuthority aa : authorities) { if (StringUtils.isNotBlank(aa.getURI())) { return aa.getURI(); } } } return null; }
/** {@inheritDoc} */ protected void processChildElement(XMLObject parentObject, XMLObject childObject) throws UnmarshallingException { AuthnContext authnContext = (AuthnContext) parentObject; if (childObject instanceof AuthnContextClassRef) { authnContext.setAuthnContextClassRef((AuthnContextClassRef) childObject); } else if (childObject instanceof AuthnContextDecl) { authnContext.setAuthnContextDecl((AuthnContextDecl) childObject); } else if (childObject instanceof AuthnContextDeclRef) { authnContext.setAuthnContextDeclRef((AuthnContextDeclRef) childObject); } else if (childObject instanceof AuthenticatingAuthority) { authnContext.getAuthenticatingAuthorities().add((AuthenticatingAuthority) childObject); } else { super.processChildElement(parentObject, childObject); } } }
private static AuthnStatement buildAuthnStatement(DateTime authnInstant, String entityID) { AuthnContextClassRef authnContextClassRef = buildSAMLObject(AuthnContextClassRef.class, AuthnContextClassRef.DEFAULT_ELEMENT_NAME); authnContextClassRef.setAuthnContextClassRef(AuthnContext.PASSWORD_AUTHN_CTX); AuthenticatingAuthority authenticatingAuthority = buildSAMLObject(AuthenticatingAuthority.class, AuthenticatingAuthority.DEFAULT_ELEMENT_NAME); authenticatingAuthority.setURI(entityID); AuthnContext authnContext = buildSAMLObject(AuthnContext.class, AuthnContext.DEFAULT_ELEMENT_NAME); authnContext.setAuthnContextClassRef(authnContextClassRef); authnContext.getAuthenticatingAuthorities().add(authenticatingAuthority); AuthnStatement authnStatement = buildSAMLObject(AuthnStatement.class, AuthnStatement.DEFAULT_ELEMENT_NAME); authnStatement.setAuthnContext(authnContext); authnStatement.setAuthnInstant(authnInstant); return authnStatement; }
log.debug("authnContext has " + authnStatement.getAuthnContext().getAuthenticatingAuthorities().size() + " content entries. "); List<AuthenticatingAuthority> contents = authnStatement.getAuthnContext().getAuthenticatingAuthorities(); if ((contents != null) && (contents.size() > 0)) {