Package org.opensaml.saml2.core

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


        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

    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

    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

        SPSSODescriptor spDescriptor = (SPSSODescriptor) context.getLocalEntityRoleMetadata();
        AssertionConsumerService assertionConsumer = getAssertionConsumerService(options, null, spDescriptor);

        // The last parameter refers to the IdP that should receive the message. However,
        // in ECP, we don't know in advance which IdP will be contacted.
        AuthnRequest authRequest = getAuthnRequest(context, options, assertionConsumer, null);

        context.setCommunicationProfileId(getProfileIdentifier());
        context.setOutboundMessage(getEnvelope());
        context.setOutboundSAMLMessage(authRequest);

        SOAPHelper.addHeaderBlock(context, getPAOSRequest(assertionConsumer));
        SOAPHelper.addHeaderBlock(context, getECPRequest(context, options));

        sendMessage(context, spDescriptor.isAuthnRequestsSigned(), SAMLConstants.SAML2_PAOS_BINDING_URI);
       
        HTTPOutTransport outTransport = (HTTPOutTransport) context.getOutboundMessageTransport();
        outTransport.setHeader("Content-Type", "application/vnd.paos+xml");

        SAMLMessageStorage messageStorage = context.getMessageStorage();
        if (messageStorage != null) {
            messageStorage.storeMessage(authRequest.getID(), authRequest);
        }

    }
View Full Code Here

        storage.storeMessage((String) notNull(), (XMLObject) notNull());
        replyMock();

        profile.sendAuthenticationRequest(samlContext, options);

        AuthnRequest authnRequest = (AuthnRequest) samlContext.getOutboundSAMLMessage();
        assertNotNull(authnRequest.getID());
        assertNotNull(authnRequest.getIssueInstant());
        assertEquals(false, authnRequest.isForceAuthn());
        assertEquals(false, authnRequest.isPassive());
        assertEquals("http://localhost:8081/spring-security-saml2-webapp", authnRequest.getIssuer().getValue());
        assertEquals("http://localhost:8081/spring-security-saml2-webapp/saml/HoKSSO", authnRequest.getAssertionConsumerServiceURL());
        assertEquals("http://localhost:8080/opensso/SSOHoK/metaAlias/idp", authnRequest.getDestination());
        assertEquals(org.opensaml.common.xml.SAMLConstants.SAML2_POST_BINDING_URI, authnRequest.getProtocolBinding());
        assertEquals(org.opensaml.common.xml.SAMLConstants.SAML2_REDIRECT_BINDING_URI, SAMLUtil.getBindingForEndpoint(samlContext.getPeerEntityEndpoint()));
        verifyMock();

    }
View Full Code Here

    public void testPassive() throws Exception {
        options.setPassive(true);
        storage.storeMessage((String) notNull(), (XMLObject) notNull());
        replyMock();
        profile.sendAuthenticationRequest(samlContext, options);
        AuthnRequest authnRequest = (AuthnRequest) samlContext.getOutboundSAMLMessage();
        verifyMock();
        assertEquals(false, authnRequest.isForceAuthn());
        assertEquals(true, authnRequest.isPassive());
        assertTrue(authnRequest.getScoping().getProxyCount() > 0);
    }
View Full Code Here

    public void testForce() throws Exception {
        options.setForceAuthN(true);
        storage.storeMessage((String) notNull(), (XMLObject) notNull());
        replyMock();
        profile.sendAuthenticationRequest(samlContext, options);
        AuthnRequest authnRequest = (AuthnRequest) samlContext.getOutboundSAMLMessage();
        verifyMock();
        assertEquals(true, authnRequest.isForceAuthn());
        assertEquals(false, authnRequest.isPassive());
        assertTrue(authnRequest.getScoping().getProxyCount() > 0);
    }
View Full Code Here

    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

    public void testPOSTSigned() throws Exception {
        options.setBinding("urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST");
        storage.storeMessage((String) notNull(), (XMLObject) notNull());
        replyMock();
        profile.sendAuthenticationRequest(samlContext, options);
        AuthnRequest authnRequest = (AuthnRequest) samlContext.getOutboundSAMLMessage();
        verifyMock();
        assertTrue(authnRequest.isSigned());
        assertNotNull(authnRequest.getSignature());
    }
View Full Code Here

TOP

Related Classes of org.opensaml.saml2.core.AuthnRequest

Copyright © 2018 www.massapicom. 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.