Java Code Examples for org.opensaml.saml.saml2.core.AuthnRequest#setProtocolBinding()
The following examples show how to use
org.opensaml.saml.saml2.core.AuthnRequest#setProtocolBinding() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SamlClient.java From saml-client with MIT License | 6 votes |
/** * Builds an encoded SAML request. * * @return The base-64 encoded SAML request. * @throws SamlException thrown if an unexpected error occurs. */ public String getSamlRequest() throws SamlException { AuthnRequest request = (AuthnRequest) getBasicSamlRequest(AuthnRequest.DEFAULT_ELEMENT_NAME); request.setProtocolBinding( "urn:oasis:names:tc:SAML:2.0:bindings:HTTP-" + this.samlBinding.toString()); request.setDestination(identityProviderUrl); request.setAssertionConsumerServiceURL(assertionConsumerServiceUrl); NameIDPolicy nameIDPolicy = (NameIDPolicy) buildSamlObject(NameIDPolicy.DEFAULT_ELEMENT_NAME); nameIDPolicy.setFormat("urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified"); request.setNameIDPolicy(nameIDPolicy); signSAMLObject(request); return marshallAndEncodeSamlObject(request); }
Example 2
Source File: SamlpRequestComponentBuilder.java From cxf with Apache License 2.0 | 5 votes |
@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; }
Example 3
Source File: SamlpRequestComponentBuilder.java From cxf-fediz with Apache License 2.0 | 5 votes |
@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().toString()); authnRequest.setIsPassive(isPassive); authnRequest.setIssueInstant(new DateTime()); authnRequest.setProtocolBinding(protocolBinding); authnRequest.setVersion(version); authnRequest.setIssuer(issuer); authnRequest.setNameIDPolicy(nameIDPolicy); authnRequest.setRequestedAuthnContext(requestedAuthnCtx); return authnRequest; }