Package org.pac4j.core.context

Examples of org.pac4j.core.context.WebContext


   
    @SuppressWarnings("unchecked")
    @Override
    protected ModelAndView handleRequestInternal(final HttpServletRequest request, final HttpServletResponse response) {
       
        final WebContext context = new J2EContext(request, response);
       
        final Client<CasCredentials, CasProfile> client = this.clients.findClient(context);
       
        CasCredentials credentials = null;
        try {
View Full Code Here


    @Test
    public void testCustomSpEntityIdForPostBinding() throws Exception {
        Saml2Client client = getClient();
        client.setSpEntityId("http://localhost:8080/callback");
        WebContext context = MockWebContext.create();
        RedirectAction action = client.getRedirectAction(context, true, false);
        assertTrue(getDecodedAuthnRequest(action.getContent())
                .contains(
                        "<saml2:Issuer xmlns:saml2=\"urn:oasis:names:tc:SAML:2.0:assertion\">http://localhost:8080/callback</saml2:Issuer>"));
    }
View Full Code Here

    @Test
    public void testForceAuthIsSetForPostBinding() throws Exception {
        Saml2Client client = (Saml2Client) getClient();
        client.setForceAuth(true);
        WebContext context = MockWebContext.create();
        RedirectAction action = client.getRedirectAction(context, true, false);
        assertTrue(getDecodedAuthnRequest(action.getContent()).contains("ForceAuthn=\"true\""));
    }
View Full Code Here

    @Test
    public void testSetComparisonTypeWithPostBinding() throws Exception {
        Saml2Client client = (Saml2Client) getClient();
        client.setComparisonType(AuthnContextComparisonTypeEnumeration.EXACT.toString());
        WebContext context = MockWebContext.create();
        RedirectAction action = client.getRedirectAction(context, true, false);
        assertTrue(getDecodedAuthnRequest(action.getContent()).contains("Comparison=\"exact\""));
    }
View Full Code Here

    }

    @Test
    public void testRelayState() throws RequiresHttpAction {
        Saml2Client client = (Saml2Client) getClient();
        WebContext context = MockWebContext.create();
        context.setSessionAttribute(Saml2Client.SAML_RELAY_STATE_ATTRIBUTE, "relayState");
        RedirectAction action = client.getRedirectAction(context, true, false);
        assertTrue(action.getContent().contains("<input type=\"hidden\" name=\"RelayState\" value=\"relayState\"/>"));
    }
View Full Code Here

            throws MessageDecodingException {
        InTransport inTransport = messageContext.getInboundMessageTransport();
        if (!(inTransport instanceof SimpleRequestAdapter)) {
            throw new MessageDecodingException("Message context InTransport instance was an unsupported type");
        }
        WebContext webContext = ((SimpleRequestAdapter) inTransport).getWebContext();

        return webContext.getFullRequestURL();
    }
View Full Code Here

    @Test
    public void testCustomSpEntityIdForRedirectBinding() throws Exception {
        Saml2Client client = getClient();
        client.setSpEntityId("http://localhost:8080/callback");
        WebContext context = MockWebContext.create();
        RedirectAction action = client.getRedirectAction(context, true, false);
        assertTrue(getInflatedAuthnRequest(action.getLocation())
                .contains(
                        "<saml2:Issuer xmlns:saml2=\"urn:oasis:names:tc:SAML:2.0:assertion\">http://localhost:8080/callback</saml2:Issuer>"));
    }
View Full Code Here

    @Test
    public void testForceAuthIsSetForRedirectBinding() throws Exception {
        Saml2Client client = getClient();
        client.setForceAuth(true);
        WebContext context = MockWebContext.create();
        RedirectAction action = client.getRedirectAction(context, true, false);
        assertTrue(getInflatedAuthnRequest(action.getLocation()).contains("ForceAuthn=\"true\""));
    }
View Full Code Here

    @Test
    public void testSetComparisonTypeWithRedirectBinding() throws Exception {
        Saml2Client client = getClient();
        client.setComparisonType(AuthnContextComparisonTypeEnumeration.EXACT.toString());
        WebContext context = MockWebContext.create();
        RedirectAction action = client.getRedirectAction(context, true, false);
        assertTrue(getInflatedAuthnRequest(action.getLocation()).contains("Comparison=\"exact\""));
    }
View Full Code Here

    @Test
    public void testNameIdPolicyFormat() throws Exception{
        Saml2Client client = getClient();
        client.setNameIdPolicyFormat("urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress");
        WebContext context = MockWebContext.create();
        RedirectAction action = client.getRedirectAction(context, true, false);
        assertTrue(getInflatedAuthnRequest(action.getLocation()).contains("<saml2p:NameIDPolicy AllowCreate=\"true\" Format=\"urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress\"/></saml2p:AuthnRequest>"));
    }
View Full Code Here

TOP

Related Classes of org.pac4j.core.context.WebContext

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.