use of org.opensaml.saml.saml2.core.NameIDPolicy in project cxf by apache.
the class SamlpRequestComponentBuilder method createNameIDPolicy.
@SuppressWarnings("unchecked")
public static NameIDPolicy createNameIDPolicy(boolean allowCreate, String format, String spNameQualifier) {
if (nameIDBuilder == null) {
nameIDBuilder = (SAMLObjectBuilder<NameIDPolicy>) builderFactory.getBuilder(NameIDPolicy.DEFAULT_ELEMENT_NAME);
}
NameIDPolicy nameId = nameIDBuilder.buildObject();
nameId.setAllowCreate(allowCreate);
nameId.setFormat(format);
nameId.setSPNameQualifier(spNameQualifier);
return nameId;
}
use of org.opensaml.saml.saml2.core.NameIDPolicy in project verify-hub by alphagov.
the class IdaAuthnRequestFromHubToAuthnRequestTransformer method supplementAuthnRequestWithDetails.
protected void supplementAuthnRequestWithDetails(IdaAuthnRequestFromHub originalRequestFromHub, AuthnRequest authnRequest) {
Conditions conditions = getSamlObjectFactory().createConditions();
conditions.setNotOnOrAfter(originalRequestFromHub.getSessionExpiryTimestamp());
authnRequest.setConditions(conditions);
Scoping scoping = getSamlObjectFactory().createScoping();
scoping.setProxyCount(0);
authnRequest.setScoping(scoping);
AuthnContextComparisonTypeEnumeration comparisonType = originalRequestFromHub.getComparisonType();
RequestedAuthnContext requestedAuthnContext = getSamlObjectFactory().createRequestedAuthnContext(comparisonType);
originalRequestFromHub.getLevelsOfAssurance().stream().map(AuthnContext::getUri).map(uri -> getSamlObjectFactory().createAuthnContextClassReference(uri)).forEach(ref -> requestedAuthnContext.getAuthnContextClassRefs().add(ref));
NameIDPolicy nameIdPolicy = getSamlObjectFactory().createNameIdPolicy();
nameIdPolicy.setFormat(NameIDType.PERSISTENT);
nameIdPolicy.setSPNameQualifier(HubConstants.SP_NAME_QUALIFIER);
nameIdPolicy.setAllowCreate(true);
authnRequest.setNameIDPolicy(nameIdPolicy);
authnRequest.setRequestedAuthnContext(requestedAuthnContext);
if (originalRequestFromHub.getForceAuthentication().isPresent()) {
authnRequest.setForceAuthn(originalRequestFromHub.getForceAuthentication().get());
}
}
Aggregations