public AuthnRequest buildIdpInitiatedAuthnRequest(String nameIDFormat, String spEntityID, String assertionUrl) { @SuppressWarnings("unchecked") SAMLObjectBuilder<AuthnRequest> builder = (SAMLObjectBuilder<AuthnRequest>) builderFactory .getBuilder(AuthnRequest.DEFAULT_ELEMENT_NAME); AuthnRequest request = builder.buildObject(); request.setVersion(SAMLVersion.VERSION_20); request.setID(generateID()); request.setIssuer(getIssuer(spEntityID)); request.setVersion(SAMLVersion.VERSION_20); request.setIssueInstant(new DateTime()); request.setID(null); request.setAssertionConsumerServiceURL(assertionUrl); if (null != nameIDFormat) { NameID nameID = ((SAMLObjectBuilder<NameID>) builderFactory.getBuilder(NameID.DEFAULT_ELEMENT_NAME)).buildObject(); nameID.setFormat(nameIDFormat); Subject subject = ((SAMLObjectBuilder<Subject>) builderFactory.getBuilder(Subject.DEFAULT_ELEMENT_NAME)).buildObject(); subject.setNameID(nameID); request.setSubject(subject); } return request; }
public AuthnRequest mockAuthnRequest(String nameIDFormat) { @SuppressWarnings("unchecked") SAMLObjectBuilder<AuthnRequest> builder = (SAMLObjectBuilder<AuthnRequest>) builderFactory .getBuilder(AuthnRequest.DEFAULT_ELEMENT_NAME); AuthnRequest request = builder.buildObject(); request.setVersion(SAMLVersion.VERSION_20); request.setID(generateID()); request.setIssuer(getIssuer(SP_ENTITY_ID)); request.setVersion(SAMLVersion.VERSION_20); request.setIssueInstant(new DateTime()); if (null != nameIDFormat) { NameID nameID = ((SAMLObjectBuilder<NameID>) builderFactory.getBuilder(NameID.DEFAULT_ELEMENT_NAME)) .buildObject(); nameID.setFormat(nameIDFormat); Subject subject = ((SAMLObjectBuilder<Subject>) builderFactory.getBuilder(Subject.DEFAULT_ELEMENT_NAME)) .buildObject(); subject.setNameID(nameID); request.setSubject(subject); } return request; }
authnRequest.setID(authnId); authnRequest.setDestination(idpUrl); authnRequest.setVersion(SAMLVersion.VERSION_20); authnRequest.setForceAuthn(false); authnRequest.setIsPassive(false);
/** * Generate an authentication request. * * @return AuthnRequest Object * @throws Exception error when bootstrapping */ public AuthnRequest buildAuthenticationRequest(String issuerId) throws Exception { Util.doBootstrap(); AuthnRequest authnRequest = (AuthnRequest) Util.buildXMLObject(AuthnRequest.DEFAULT_ELEMENT_NAME); authnRequest.setID(Util.createID()); authnRequest.setVersion(SAMLVersion.VERSION_20); authnRequest.setIssueInstant(new DateTime()); authnRequest.setIssuer(buildIssuer( issuerId)); authnRequest.setNameIDPolicy(buildNameIDPolicy()); return authnRequest; }
request.setID("z" + UUID.randomUUID().toString()); // ADFS needs IDs to start with a letter request.setVersion(SAMLVersion.VERSION_20); request.setIssueInstant(DateTime.now()); request.setProtocolBinding(
.buildXMLObject(AuthnRequest.DEFAULT_ELEMENT_NAME); authnRequest.setID(Util.createID()); authnRequest.setVersion(SAMLVersion.VERSION_20); authnRequest.setIssueInstant(new DateTime()); authnRequest.setIssuer(buildIssuer());
AuthnRequest authnRequest = requestBuilder.buildObject(); authnRequest.setID("authn-request-" + UUID.randomUUID().toString()); authnRequest.setVersion(SAMLVersion.VERSION_20); authnRequest.setIssueInstant(new DateTime()); authnRequest.setDestination(idpDestination);
.buildXMLObject(AuthnRequest.DEFAULT_ELEMENT_NAME); authnRequest.setID(Util.createID()); authnRequest.setVersion(SAMLVersion.VERSION_20); authnRequest.setIssueInstant(new DateTime()); authnRequest.setIssuer(buildIssuer());
authRequest.setID(authReqRandomId); authRequest.setDestination(GatewayUtils.getIDPUrl()); authRequest.setVersion(SAMLVersion.VERSION_20);
authRequest.setIssuer(issuer); authRequest.setID(SAML2AuthUtils.createID()); authRequest.setVersion(SAMLVersion.VERSION_20); authRequest.setDestination(idpUrl);
/** * Returns AuthnRequest SAML message to be used to demand authentication from an IDP described using * idpEntityDescriptor, with an expected response to the assertionConsumer address. * * @param context message context * @param options preferences of message creation * @param assertionConsumer assertion consumer where the IDP should respond * @param bindingService service used to deliver the request * @return authnRequest ready to be sent to IDP * @throws SAMLException error creating the message * @throws MetadataProviderException error retreiving metadata */ protected AuthnRequest getAuthnRequest(SAMLMessageContext context, WebSSOProfileOptions options, AssertionConsumerService assertionConsumer, SingleSignOnService bindingService) throws SAMLException, MetadataProviderException { SAMLObjectBuilder<AuthnRequest> builder = (SAMLObjectBuilder<AuthnRequest>) builderFactory.getBuilder(AuthnRequest.DEFAULT_ELEMENT_NAME); AuthnRequest request = builder.buildObject(); request.setIsPassive(options.getPassive()); request.setForceAuthn(options.getForceAuthN()); request.setProviderName(options.getProviderName()); request.setVersion(SAMLVersion.VERSION_20); buildCommonAttributes(context.getLocalEntityId(), request, bindingService); buildScoping(request, bindingService, options); builNameIDPolicy(request, options); buildAuthnContext(request, options); buildReturnAddress(request, assertionConsumer); return request; }
authRequest.setRequestedAuthnContext(requestedAuthnContext); authRequest.setID(SSOAgentUtils.createID()); authRequest.setVersion(SAMLVersion.VERSION_20); authRequest.setDestination(ssoAgentConfig.getSAML2().getIdPURL()); if (request.getAttribute(Extensions.LOCAL_NAME) != null) {
authRequest.setRequestedAuthnContext(requestedAuthnContext); authRequest.setID(SSOAgentUtils.createID()); authRequest.setVersion(SAMLVersion.VERSION_20); authRequest.setDestination(ssoAgentConfig.getSAML2().getIdPURL()); if (request.getAttribute(Extensions.LOCAL_NAME) != null) {