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

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


    public void testLoginWithValidToken() throws Exception {
        // Make the issueToken() method return a token.
        when(stsClient.issueToken(any(String.class), any(String.class))).thenReturn(Util.createSamlToken());

        final STSIssuingLoginModule loginModule = new FakeSTSIssuingLoginModule(stsClient);
        final CallbackHandler callbackHandler = new TestCallbackHandler("admin", "admin");
        final Subject subject = new Subject();
        final HashMap<String, Object> sharedState = new HashMap<String, Object>();

        loginModule.initialize(subject, callbackHandler, sharedState, allOptions());

        // Simulate Phase 1
        assertTrue(loginModule.login());

        final Object token = loginModule.getSharedToken();
        assertNotNull(token);
        assertTrue(token instanceof Element);

        // Simulate Phase 2
        assertTrue(loginModule.commit());

        final Set<SamlCredential> samlCredentials = subject.<SamlCredential> getPublicCredentials(SamlCredential.class);
        assertEquals(1, samlCredentials.size());
    }
View Full Code Here


    }

    public void testUseFirstPass() {
        final String username = "Fletch";
        final String password = "letMeIn";
        final STSIssuingLoginModule loginModule = new STSIssuingLoginModule();
        final Subject subject = new Subject();

        final HashMap<String, Object> sharedState = new HashMap<String, Object>();
        sharedState.put("javax.security.auth.login.name", username);
        sharedState.put("javax.security.auth.login.password", password.toCharArray());

        final Map<String, String> options = allOptions();
        options.put(AbstractSTSLoginModule.OPTIONS_PW_STACKING, "useFirstPass");

        loginModule.initialize(subject, null, sharedState, options);

        assertTrue(loginModule.isUseFirstPass());
        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.STSIssuingLoginModule

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.