/** {@inheritDoc} */ protected void processChildElement(XMLObject parentSAMLObject, XMLObject childSAMLObject) throws UnmarshallingException { RequestedAuthnContext rac = (RequestedAuthnContext) parentSAMLObject; if (childSAMLObject instanceof AuthnContextClassRef) { rac.getAuthnContextClassRefs().add((AuthnContextClassRef) childSAMLObject); } else if (childSAMLObject instanceof AuthnContextDeclRef) { rac.getAuthnContextDeclRefs().add((AuthnContextDeclRef) childSAMLObject); } else { super.processChildElement(parentSAMLObject, childSAMLObject); } } }
/** * Validates the presence and combination of child elements. * * @param rac * @throws ValidationException */ protected void validateChildren(RequestedAuthnContext rac) throws ValidationException { int classRefCount = rac.getAuthnContextClassRefs().size(); int declRefCount = rac.getAuthnContextDeclRefs().size(); if (classRefCount == 0 && declRefCount == 0){ throw new ValidationException("At least one of either AuthnContextClassRef or AuthnContextDeclRef is required"); } if (classRefCount > 0 && declRefCount > 0) { throw new ValidationException("AuthnContextClassRef and AuthnContextDeclRef are mutually exclusive"); } }
if (requestedAuthnContext.getAuthnContextDeclRefs() != null) { for (AuthnContextDeclRef declRefRequested : requestedAuthnContext.getAuthnContextDeclRefs()) { if (declRefRequested.getAuthnContextDeclRef().equals(declRef)) { log.debug("AuthContext matched with value {}", declRef);