Examples of AuthnRequest


Examples of org.opensaml.saml2.core.AuthnRequest

    public void testDisallowProxy() throws Exception {
        options.setProxyCount(null);
        storage.storeMessage((String) notNull(), (XMLObject) notNull());
        replyMock();
        profile.sendAuthenticationRequest(samlContext, options);
        AuthnRequest authnRequest = (AuthnRequest) samlContext.getOutboundSAMLMessage();
        verifyMock();
        assertEquals(false, authnRequest.isForceAuthn());
        assertEquals(false, authnRequest.isPassive());
        assertNull(authnRequest.getScoping().getProxyCount());
    }
View Full Code Here

Examples of org.opensaml.saml2.core.AuthnRequest

        super(namespaceURI, elementLocalName);
    }

    /** {@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

        super(namespaceURI, elementLocalName);
    }

    /** {@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

            return null;
        }

        Endpoint endpoint = null;
        if (getSamlRequest() != null) {
            AuthnRequest request = (AuthnRequest) getSamlRequest();

            endpoints = filterEndpointsByProtocolBinding(endpoints);
            if (endpoints == null || endpoints.isEmpty()) {
                return null;
            }

            if (request.getAssertionConsumerServiceIndex() != null) {
                log.debug("Selecting endpoint by ACS index for request {} from entity {}", request.getID(),
                        getEntityMetadata().getEntityID());
                endpoint = selectEndpointByACSIndex(request, (List<IndexedEndpoint>) endpoints);
            } else if (request.getAssertionConsumerServiceURL() != null) {
                log.debug("Selecting endpoint by ACS URL for request {} from entity {}", request.getID(),
                        getEntityMetadata().getEntityID());
                endpoint = selectEndpointByACSURL(request, (List<IndexedEndpoint>) endpoints);
            }
        }
View Full Code Here

Examples of org.opensaml.saml2.core.AuthnRequest

     *
     * @return filtered endpoints
     */
    protected List<? extends Endpoint> filterEndpointsByProtocolBinding(List<? extends Endpoint> endpoints) {
        log.debug("Filtering peer endpoints.  Supported peer endpoint bindings: {}", getSupportedIssuerBindings());
        AuthnRequest request = (AuthnRequest) getSamlRequest();

        boolean filterByRequestBinding = false;
        String acsBinding = DatatypeHelper.safeTrimOrNullString(request.getProtocolBinding());
        if (acsBinding != null && request.getAssertionConsumerServiceIndex() != null) {
            filterByRequestBinding = true;
        }

        List<Endpoint> filteredEndpoints = new ArrayList<Endpoint>(endpoints);
        Iterator<Endpoint> endpointItr = filteredEndpoints.iterator();
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

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.