authnRequest.setID(requestIdManager.newId());
@SuppressWarnings("unchecked") //CHECKSTYLE:OFF public static AuthnRequest createAuthnRequest( String serviceURL, boolean forceAuthn, boolean isPassive, String protocolBinding, SAMLVersion version, Issuer issuer, NameIDPolicy nameIDPolicy, RequestedAuthnContext requestedAuthnCtx ) { //CHECKSTYLE:ON if (authnRequestBuilder == null) { authnRequestBuilder = (SAMLObjectBuilder<AuthnRequest>) builderFactory.getBuilder(AuthnRequest.DEFAULT_ELEMENT_NAME); } AuthnRequest authnRequest = authnRequestBuilder.buildObject(); authnRequest.setAssertionConsumerServiceURL(serviceURL); authnRequest.setForceAuthn(forceAuthn); authnRequest.setID("_" + UUID.randomUUID()); authnRequest.setIsPassive(isPassive); authnRequest.setIssueInstant(new DateTime()); authnRequest.setProtocolBinding(protocolBinding); authnRequest.setVersion(version); authnRequest.setIssuer(issuer); authnRequest.setNameIDPolicy(nameIDPolicy); authnRequest.setRequestedAuthnContext(requestedAuthnCtx); return authnRequest; }
/** * Build a synthetic AuthnRequest instance from the IdP-initiated SSO request structure. * * @return the synthetic AuthnRequest message instance * * @throws MessageDecodingException if the inbound request does not contain an entityID value */ @Nonnull protected AuthnRequest buildAuthnRequest() throws MessageDecodingException { final AuthnRequest authnRequest = requestBuilder.buildObject(); final Issuer requestIssuer = issuerBuilder.buildObject(); requestIssuer.setValue(ssoRequest.getEntityId()); authnRequest.setIssuer(requestIssuer); final NameIDPolicy nip = nipBuilder.buildObject(); nip.setAllowCreate(true); authnRequest.setNameIDPolicy(nip); authnRequest.setAssertionConsumerServiceURL(ssoRequest.getAssertionConsumerServiceURL()); authnRequest.setIssueInstant(new DateTime(ssoRequest.getTime(), ISOChronology.getInstanceUTC())); authnRequest.setVersion(SAMLVersion.VERSION_20); authnRequest.setID(getMessageID()); return authnRequest; }
authnRequest.setID("_" + SecureRandomUtils.generateRandomUUID().toString()); authnRequest.setForceAuthn(false); authnRequest.setIsPassive(false);
authnRequest.setID(SSOUtils.createID()); authnRequest.setVersion(SAMLVersion.VERSION_20); authnRequest.setIssueInstant(new DateTime());
authnRequest.setID(requestIdManager.newId());
request.setID(SAML2Utils.generateID()); request.setIssuer(getIssuer(selfContext.getEntityId())); request.setIssueInstant(DateTime.now(DateTimeZone.UTC).plusSeconds(this.issueInstantSkewSeconds));
protected AuthnRequest internalToXml(AuthenticationRequest request) { AuthnRequest auth = buildSAMLObject(AuthnRequest.class); auth.setID(request.getId()); auth.setVersion(SAMLVersion.VERSION_20); auth.setIssueInstant(request.getIssueInstant()); auth.setForceAuthn(request.isForceAuth()); auth.setIsPassive(request.isPassive()); auth.setProtocolBinding(request.getBinding().toString()); // Azure AD as IdP will not accept index if protocol binding or AssertationCustomerServiceURL is set. // auth.setAssertionConsumerServiceIndex(request.getAssertionConsumerService().getIndex()); auth.setAssertionConsumerServiceURL(request.getAssertionConsumerService().getLocation()); auth.setDestination(request.getDestination().getLocation()); auth.setNameIDPolicy(getNameIDPolicy(request.getNameIdPolicy())); auth.setRequestedAuthnContext(getRequestedAuthenticationContext(request)); auth.setIssuer(toIssuer(request.getIssuer())); if (request.getSigningKey() != null) { this.signObject(auth, request.getSigningKey(), request.getAlgorithm(), request.getDigest()); } return auth; }