Package org.picketlink.identity.federation.core.wstrust.auth

Examples of org.picketlink.identity.federation.core.wstrust.auth.AbstractSTSLoginModule


    public void setUp() {
        stsClient = mock(STSClient.class);
    }

    public void testOptionsConfig() {
        final AbstractSTSLoginModule loginModule = new FakeSTSLoginModule(null, stsClient);
        final Map<String, String> sharedState = new HashMap<String, String>();
        final Map<String, String> options = Util.allOptions();
        options.put(AbstractSTSLoginModule.OPTIONS_CREDENTIALS, "true");

        loginModule.initialize(new Subject(), null, sharedState, options);

        assertTrue(loginModule.isUseOptionsConfig());
        assertFalse(loginModule.isUsePasswordStacking());
        assertFalse(loginModule.isUseFirstPass());
    }
View Full Code Here


        assertFalse(loginModule.isUsePasswordStacking());
        assertFalse(loginModule.isUseFirstPass());
    }

    public void testOptionsConfigWithPasswordStacking() throws Exception {
        final AbstractSTSLoginModule loginModule = new FakeSTSLoginModule(Util.createSamlToken(), stsClient);
        final Map<String, String> sharedState = new HashMap<String, String>();
        final Map<String, String> options = Util.allOptions();
        options.put(AbstractSTSLoginModule.OPTIONS_CREDENTIALS, "true");
        options.put(AbstractSTSLoginModule.OPTIONS_PW_STACKING, "true");

        loginModule.initialize(new Subject(), null, sharedState, options);

        assertTrue(loginModule.isUseOptionsConfig());
        assertTrue(loginModule.isUsePasswordStacking());
        assertFalse(loginModule.isUseFirstPass());

        loginModule.login();

        assertEquals("user1", loginModule.getSharedUsername());
        assertEquals("pass1", new String(loginModule.getSharedPassword()));
    }
View Full Code Here

        assertEquals("user1", loginModule.getSharedUsername());
        assertEquals("pass1", new String(loginModule.getSharedPassword()));
    }

    public void testCallback() {
        final AbstractSTSLoginModule loginModule = new FakeSTSLoginModule(null, stsClient);
        final Map<String, String> sharedState = new HashMap<String, String>();
        final Map<String, String> options = Util.allOptions();
        TestCallbackHandler callbackHandler = new TestCallbackHandler("Mr.Poon", "rosen");

        loginModule.initialize(new Subject(), callbackHandler, sharedState, options);

        assertFalse(loginModule.isUseOptionsConfig());
        assertFalse(loginModule.isUsePasswordStacking());
        assertFalse(loginModule.isUseFirstPass());
    }
View Full Code Here

        assertFalse(loginModule.isUsePasswordStacking());
        assertFalse(loginModule.isUseFirstPass());
    }

    public void testCallbackWithPasswordStacking() throws Exception {
        final AbstractSTSLoginModule loginModule = new FakeSTSLoginModule(Util.createSamlToken(), stsClient);
        final Map<String, String> sharedState = new HashMap<String, String>();
        final Map<String, String> options = Util.allOptions();
        options.put(AbstractSTSLoginModule.OPTIONS_PW_STACKING, "true");
        final String username = "Mr.Poon";
        final String password = "rosen";

        TestCallbackHandler callbackHandler = new TestCallbackHandler(username, password);

        loginModule.initialize(new Subject(), callbackHandler, sharedState, options);

        assertFalse(loginModule.isUseOptionsConfig());
        assertTrue(loginModule.isUsePasswordStacking());
        assertFalse(loginModule.isUseFirstPass());

        loginModule.login();

        assertEquals(username, loginModule.getSharedUsername());
        assertEquals(password, new String(loginModule.getSharedPassword()));
    }
View Full Code Here

TOP

Related Classes of org.picketlink.identity.federation.core.wstrust.auth.AbstractSTSLoginModule

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.