Package org.springframework.security.saml.context

Examples of org.springframework.security.saml.context.SAMLMessageContext


        expectedRelayState = "df558a";
       
        httpRequest = new MockHttpServletRequest();
        httpRequest.setMethod("POST");
       
        messageContext = new SAMLMessageContext();
        messageContext.setInboundMessageTransport(new HttpServletRequestAdapter(httpRequest));
       
        decoder = new HTTPPAOS11Decoder();
    }
View Full Code Here


    SAMLMessageContext context;
    SAMLMessageStorage storage;

    @Before
    public void initialize() {
        context = new SAMLMessageContext();
        storage = createMock(SAMLMessageStorage.class);
        token = new SAMLAuthenticationToken(context);
    }
View Full Code Here

     *
     * @throws Exception error
     */
    @Test
    public void testAuthenticate() throws Exception {
        SAMLMessageContext context = new SAMLMessageContext();
        context.setCommunicationProfileId(SAMLConstants.SAML2_WEBSSO_PROFILE_URI);

        SAMLAuthenticationToken token = new SAMLAuthenticationToken(context);
        SAMLCredential result = new SAMLCredential(nameID, assertion, "IDP", "testSP");

        expect(consumer.processAuthenticationResponse(context)).andReturn(result);
View Full Code Here

     *
     * @throws Exception error
     */
    @Test
    public void testAuthenticateUserDetails() throws Exception {
        SAMLMessageContext context = new SAMLMessageContext();
        context.setCommunicationProfileId(SAMLConstants.SAML2_WEBSSO_PROFILE_URI);

        SAMLUserDetailsService details = createMock(SAMLUserDetailsService.class);
        provider.setUserDetails(details);

        SAMLAuthenticationToken token = new SAMLAuthenticationToken(context);
View Full Code Here

     *
     * @throws Exception error
     */
    @Test(expected = AuthenticationServiceException.class)
    public void testAuthenticateException() throws Exception {
        SAMLMessageContext context = new SAMLMessageContext();

        SAMLAuthenticationToken token = new SAMLAuthenticationToken(context);
        SAMLCredential result = new SAMLCredential(nameID, assertion, "IDP", "localSP");

        expect(consumer.processAuthenticationResponse(context)).andThrow(new SAMLException("Error"));
View Full Code Here

    @Test
    public void testPOSTResponseParsing() throws Exception {

        prepareHttpRequest("message/SAMLResponse.xml", "POST", "http://localhost:8080/spring-security-saml2-webapp/saml/SSO", "text/html");
        replayMock();
        SAMLMessageContext context = processor.retrieveMessage(samlContext);
        verifyMock();

        assertNotNull(context.getInboundSAMLMessage());
        assertTrue(context.getInboundSAMLMessage() instanceof Response);
        assertEquals("s22520705f2c89536ee66a2c4c92f2832ce9cdc019", context.getInboundSAMLMessageId());
        assertEquals("http://localhost:8080/opensso", context.getPeerEntityId());
    }
View Full Code Here

     * @throws Exception error
     */
    @Test
    public void testIDPSelection_metadataURL() throws Exception {

        SAMLMessageContext context = new SAMLMessageContext();
        ExtendedMetadata metadata = new ExtendedMetadata();
        metadata.setIdpDiscoveryEnabled(true);
        metadata.setIdpDiscoveryURL("http://test.fi/idpDisco/");
        context.setLocalExtendedMetadata(metadata);
        context.setLocalEntityId("localId");

        context.setInboundMessageTransport(new HttpServletRequestAdapter(request));
        context.setOutboundMessageTransport(new HttpServletResponseAdapter(response, false));

        response.sendRedirect("http://test.fi/idpDisco/?entityID=localId&returnIDParam=idp");

        replayMock();
        entryPoint.initializeDiscovery(context);
View Full Code Here

     * @throws Exception error
     */
    @Test(expected = IllegalArgumentException.class)
    public void testIDPSelection_invalidDiscoURL() throws Exception {

        SAMLMessageContext context = new SAMLMessageContext();
        ExtendedMetadata metadata = new ExtendedMetadata();
        metadata.setIdpDiscoveryEnabled(true);
        metadata.setIdpDiscoveryURL("test.fi/idpDisco/");
        context.setLocalExtendedMetadata(metadata);
        context.setLocalEntityId("localId");

        context.setInboundMessageTransport(new HttpServletRequestAdapter(request));
        context.setOutboundMessageTransport(new HttpServletResponseAdapter(response, false));

        replayMock();
        entryPoint.initializeDiscovery(context);
        verifyMock();

View Full Code Here

     * @throws Exception error
     */
    @Test
    public void testInitialProfileOptions() throws Exception {

        WebSSOProfileOptions ssoProfileOptions = entryPoint.getProfileOptions(new SAMLMessageContext(), null);
        assertEquals(new Integer(2), ssoProfileOptions.getProxyCount());
        assertTrue(ssoProfileOptions.isIncludeScoping());
        assertFalse(ssoProfileOptions.getForceAuthN());
        assertFalse(ssoProfileOptions.getPassive());
        assertNull(ssoProfileOptions.getBinding());
View Full Code Here

        // Set default values
        entryPoint.setDefaultProfileOptions(defaultOptions);

        // Check that default values are used
        WebSSOProfileOptions ssoProfileOptions = entryPoint.getProfileOptions(new SAMLMessageContext(), null);
        assertEquals(new Integer(0), ssoProfileOptions.getProxyCount());
        assertFalse(ssoProfileOptions.isIncludeScoping());
        assertFalse(ssoProfileOptions.getForceAuthN());
        assertFalse(ssoProfileOptions.getPassive());
        assertEquals(SAMLConstants.SAML2_REDIRECT_BINDING_URI, ssoProfileOptions.getBinding());

        // Check that value can't be altered after being set
        defaultOptions.setIncludeScoping(true);
        ssoProfileOptions = entryPoint.getProfileOptions(new SAMLMessageContext(), null);
        assertFalse(ssoProfileOptions.isIncludeScoping());

        // Check that default values can be cleared
        entryPoint.setDefaultProfileOptions(null);
        ssoProfileOptions = entryPoint.getProfileOptions(new SAMLMessageContext(), null);
        assertTrue(ssoProfileOptions.isIncludeScoping());       

        verifyMock();

    }
View Full Code Here

TOP

Related Classes of org.springframework.security.saml.context.SAMLMessageContext

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.