Examples of AuthnRequest


Examples of org.opensaml.saml2.core.AuthnRequest

*/
public class AuthnRequestUnmarshaller extends RequestAbstractTypeUnmarshaller {

    /** {@inheritDoc} */
    protected void processAttribute(XMLObject samlObject, Attr attribute) throws UnmarshallingException {
        AuthnRequest req = (AuthnRequest) samlObject;

        if (attribute.getLocalName().equals(AuthnRequest.FORCE_AUTHN_ATTRIB_NAME)) {
            req.setForceAuthn(XSBooleanValue.valueOf(attribute.getValue()));
        } else if (attribute.getLocalName().equals(AuthnRequest.IS_PASSIVE_ATTRIB_NAME)) {
            req.setIsPassive(XSBooleanValue.valueOf(attribute.getValue()));
        } else if (attribute.getLocalName().equals(AuthnRequest.PROTOCOL_BINDING_ATTRIB_NAME)) {
            req.setProtocolBinding(attribute.getValue());
        } else if (attribute.getLocalName().equals(AuthnRequest.ASSERTION_CONSUMER_SERVICE_INDEX_ATTRIB_NAME)) {
            req.setAssertionConsumerServiceIndex(Integer.valueOf(attribute.getValue()));
        } else if (attribute.getLocalName().equals(AuthnRequest.ASSERTION_CONSUMER_SERVICE_URL_ATTRIB_NAME)) {
            req.setAssertionConsumerServiceURL(attribute.getValue());
        } else if (attribute.getLocalName().equals(AuthnRequest.ATTRIBUTE_CONSUMING_SERVICE_INDEX_ATTRIB_NAME)) {
            req.setAttributeConsumingServiceIndex(Integer.valueOf(attribute.getValue()));
        } else if (attribute.getLocalName().equals(AuthnRequest.PROVIDER_NAME_ATTRIB_NAME)) {
            req.setProviderName(attribute.getValue());
        } else {
            super.processAttribute(samlObject, attribute);
        }
    }
View Full Code Here

Examples of org.opensaml.saml2.core.AuthnRequest

    }

    /** {@inheritDoc} */
    protected void processChildElement(XMLObject parentSAMLObject, XMLObject childSAMLObject)
            throws UnmarshallingException {
        AuthnRequest req = (AuthnRequest) parentSAMLObject;

        if (childSAMLObject instanceof Subject) {
            req.setSubject((Subject) childSAMLObject);
        } else if (childSAMLObject instanceof NameIDPolicy) {
            req.setNameIDPolicy((NameIDPolicy) childSAMLObject);
        } else if (childSAMLObject instanceof Conditions) {
            req.setConditions((Conditions) childSAMLObject);
        } else if (childSAMLObject instanceof RequestedAuthnContext) {
            req.setRequestedAuthnContext((RequestedAuthnContext) childSAMLObject);
        } else if (childSAMLObject instanceof Scoping) {
            req.setScoping((Scoping) childSAMLObject);
        } else {
            super.processChildElement(parentSAMLObject, childSAMLObject);
        }
    }
View Full Code Here

Examples of org.opensaml.saml2.core.AuthnRequest

*/
public class AuthnRequestMarshaller extends RequestAbstractTypeMarshaller {

    /** {@inheritDoc} */
    protected void marshallAttributes(XMLObject samlObject, Element domElement) throws MarshallingException {
        AuthnRequest req = (AuthnRequest) samlObject;

        if (req.isForceAuthnXSBoolean() != null) {
            domElement.setAttributeNS(null, AuthnRequest.FORCE_AUTHN_ATTRIB_NAME, req.isForceAuthnXSBoolean()
                    .toString());
        }

        if (req.isPassiveXSBoolean() != null) {
            domElement.setAttributeNS(null, AuthnRequest.IS_PASSIVE_ATTRIB_NAME, req.isPassiveXSBoolean().toString());
        }

        if (req.getProtocolBinding() != null) {
            domElement.setAttributeNS(null, AuthnRequest.PROTOCOL_BINDING_ATTRIB_NAME, req.getProtocolBinding());
        }

        if (req.getAssertionConsumerServiceIndex() != null) {
            domElement.setAttributeNS(null, AuthnRequest.ASSERTION_CONSUMER_SERVICE_INDEX_ATTRIB_NAME, req
                    .getAssertionConsumerServiceIndex().toString());
        }

        if (req.getAssertionConsumerServiceURL() != null) {
            domElement.setAttributeNS(null, AuthnRequest.ASSERTION_CONSUMER_SERVICE_URL_ATTRIB_NAME, req
                    .getAssertionConsumerServiceURL());
        }

        if (req.getAttributeConsumingServiceIndex() != null) {
            domElement.setAttributeNS(null, AuthnRequest.ATTRIBUTE_CONSUMING_SERVICE_INDEX_ATTRIB_NAME, req
                    .getAttributeConsumingServiceIndex().toString());
        }

        if (req.getProviderName() != null) {
            domElement.setAttributeNS(null, AuthnRequest.PROVIDER_NAME_ATTRIB_NAME, req.getProviderName());
        }

        super.marshallAttributes(samlObject, domElement);
    }
View Full Code Here

Examples of org.opensaml.saml2.core.AuthnRequest

    protected SamlRequestInfo createSamlRequestInfo(Message m) throws Exception {
        Document doc = DOMUtils.createDocument();
        doc.appendChild(doc.createElement("root"));
        // Create the AuthnRequest
        AuthnRequest authnRequest =
            authnRequestBuilder.createAuthnRequest(
                m, getIssuerId(m), getAbsoluteAssertionServiceAddress(m)
            );
        if (isSignRequest()) {
            signAuthnRequest(authnRequest);
        }
        Element authnRequestElement = OpenSAMLUtil.toDom(authnRequest, doc);
        String authnRequestEncoded = encodeAuthnRequest(authnRequestElement);
       
        SamlRequestInfo info = new SamlRequestInfo();
        info.setSamlRequest(authnRequestEncoded);
       
        String webAppContext = getWebAppContext(m);
        String originalRequestURI = new UriInfoImpl(m).getRequestUri().toString();
       
        RequestState requestState = new RequestState(originalRequestURI,
                                                     getIdpServiceAddress(),
                                                     authnRequest.getID(),
                                                     getIssuerId(m),
                                                     webAppContext,
                                                     getWebAppDomain(),
                                                     System.currentTimeMillis());
       
View Full Code Here

Examples of org.opensaml.saml2.core.AuthnRequest

    protected AuthnRequest buildAuthnRequest(final SAMLMessageContext context,
            final AssertionConsumerService assertionConsumerService, final SingleSignOnService ssoService) {

        SAMLObjectBuilder<AuthnRequest> builder = (SAMLObjectBuilder<AuthnRequest>) this.builderFactory
                .getBuilder(AuthnRequest.DEFAULT_ELEMENT_NAME);
        AuthnRequest request = builder.buildObject();
        if (comparisonType != null) {
            RequestedAuthnContext authnContext = new RequestedAuthnContextBuilder().buildObject();
            authnContext.setComparison(comparisonType);

            if (authnContextClassRef != null) {
                AuthnContextClassRef classRef = new AuthnContextClassRefBuilder().buildObject();
                classRef.setAuthnContextClassRef(authnContextClassRef);
                authnContext.getAuthnContextClassRefs().add(classRef);
            }
            request.setRequestedAuthnContext(authnContext);
        }

        request.setID(generateID());
        request.setIssuer(getIssuer(context.getLocalEntityId()));
        request.setIssueInstant(new DateTime());
        request.setVersion(SAMLVersion.VERSION_20);
        request.setIsPassive(false);
        request.setForceAuthn(this.forceAuth);
        request.setProviderName("pac4j-saml");

        if (nameIdPolicyFormat != null) {
            NameIDPolicy nameIdPolicy = new NameIDPolicyBuilder().buildObject();
            nameIdPolicy.setAllowCreate(true);
            nameIdPolicy.setFormat(nameIdPolicyFormat);
            request.setNameIDPolicy(nameIdPolicy);
        }

        request.setDestination(ssoService.getLocation());
        request.setAssertionConsumerServiceURL(assertionConsumerService.getLocation());
        request.setProtocolBinding(assertionConsumerService.getBinding());

        return request;

    }
View Full Code Here

Examples of org.opensaml.saml2.core.AuthnRequest

    protected RedirectAction retrieveRedirectAction(final WebContext wc) {

        ExtendedSAMLMessageContext context = this.contextProvider.buildSpAndIdpContext(wc);
        final String relayState = getStateParameter(wc);

        AuthnRequest authnRequest = this.authnRequestBuilder.build(context);

        this.handler.sendMessage(context, authnRequest, relayState);

        if (destinationBindingType.equalsIgnoreCase(SAMLConstants.SAML2_POST_BINDING_URI)) {
            String content = ((SimpleResponseAdapter) context.getOutboundMessageTransport()).getOutgoingContent();
View Full Code Here

Examples of org.opensaml.saml2.core.AuthnRequest

            SamlpRequestComponentBuilder.createRequestedAuthnCtxPolicy(
                AuthnContextComparisonTypeEnumeration.EXACT,
                Collections.singletonList(authnCtxClassRef), null
            );
       
        AuthnRequest authnRequest =
            SamlpRequestComponentBuilder.createAuthnRequest(
                "http://localhost:9001/sso", false, false,
                "urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST", SAMLVersion.VERSION_20,
                issuer, nameIDPolicy, authnCtx
            );
View Full Code Here

Examples of org.opensaml.saml2.core.AuthnRequest

        Document doc = docBuilder.newDocument();
       
        AuthnRequestBuilder authnRequestBuilder = new DefaultAuthnRequestBuilder();
        Message message = new MessageImpl();
       
        AuthnRequest authnRequest =
            authnRequestBuilder.createAuthnRequest(
                message, "http://localhost:9001/app", "http://localhost:9001/sso"
            );
        Element policyElement = OpenSAMLUtil.toDom(authnRequest, doc);
        doc.appendChild(policyElement);
View Full Code Here

Examples of org.opensaml.saml2.core.AuthnRequest

    protected SamlRequestInfo createSamlRequestInfo(Message m) throws Exception {
        Document doc = DOMUtils.createDocument();
        doc.appendChild(doc.createElement("root"));
        // Create the AuthnRequest
        AuthnRequest authnRequest =
            authnRequestBuilder.createAuthnRequest(
                m, getIssuerId(m), getAbsoluteAssertionServiceAddress(m)
            );
        if (isSignRequest()) {
            authnRequest.setDestination(idpServiceAddress);
            signAuthnRequest(authnRequest);
        }
        Element authnRequestElement = OpenSAMLUtil.toDom(authnRequest, doc);
        String authnRequestEncoded = encodeAuthnRequest(authnRequestElement);
       
        SamlRequestInfo info = new SamlRequestInfo();
        info.setSamlRequest(authnRequestEncoded);
       
        String webAppContext = getWebAppContext(m);
        String originalRequestURI = new UriInfoImpl(m).getRequestUri().toString();
       
        RequestState requestState = new RequestState(originalRequestURI,
                                                     getIdpServiceAddress(),
                                                     authnRequest.getID(),
                                                     getIssuerId(m),
                                                     webAppContext,
                                                     getWebAppDomain(),
                                                     System.currentTimeMillis());
       
View Full Code Here

Examples of org.opensaml.saml2.core.AuthnRequest

    protected SamlRequestInfo createSamlRequestInfo(Message m) throws Exception {
        Document doc = DOMUtils.createDocument();
        doc.appendChild(doc.createElement("root"));
        // Create the AuthnRequest
        AuthnRequest authnRequest =
            authnRequestBuilder.createAuthnRequest(
                m, getIssuerId(m), getAbsoluteAssertionServiceAddress(m)
            );
        if (isSignRequest()) {
            authnRequest.setDestination(idpServiceAddress);
            signAuthnRequest(authnRequest);
        }
        Element authnRequestElement = OpenSAMLUtil.toDom(authnRequest, doc);
        String authnRequestEncoded = encodeAuthnRequest(authnRequestElement);
       
        SamlRequestInfo info = new SamlRequestInfo();
        info.setSamlRequest(authnRequestEncoded);
       
        String webAppContext = getWebAppContext(m);
        String originalRequestURI = new UriInfoImpl(m).getRequestUri().toString();
       
        RequestState requestState = new RequestState(originalRequestURI,
                                                     getIdpServiceAddress(),
                                                     authnRequest.getID(),
                                                     getIssuerId(m),
                                                     webAppContext,
                                                     getWebAppDomain(),
                                                     System.currentTimeMillis());
       
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.