Package org.apache.harmony.auth.module

Examples of org.apache.harmony.auth.module.LdapLoginModule.initialize()


        options.put("useFirstPass", "true");
        HashMap<String, Object> status = new HashMap<String,Object>();
        status.put("javax.security.auth.login.name", "leo");
        status.put("javax.security.auth.login.password", "faultPass".toCharArray());
        subject = new Subject();
        module.initialize(subject, new MockCallbackHandler(), status, options);
        try {
            module.login();
            fail("Should be failed for using password from shared state");
        }
        catch(LoginException e){
View Full Code Here


            //expected LoginException here
        }
       
        options.remove("useFirstPass");
        options.put("tryFirstPass", "true");
        module.initialize(subject, new MockCallbackHandler(), status, options);
        try {
            module.login();
            module.commit();
        }
        catch(LoginException e){
View Full Code Here

       
        options.remove("tryFirstPass");
        options.put("clearPass", "true");
        status.put("javax.security.auth.login.name", "leo");
        status.put("javax.security.auth.login.password", "passw0rd".toCharArray());
        module.initialize(subject, new MockCallbackHandler(), status, options);
        try {
            module.login();
            module.commit();
            assertNull("javax.security.auth.login.name in shared state should be null when clearPass switch on",status.get("javax.security.auth.login.name"));
            assertNull("javax.security.auth.login.password in shared state should be null when clearPass switch on",status.get("javax.security.auth.login.password"));
View Full Code Here

        }
       
        status = new HashMap<String,Object>();
        options.remove("clearPass");
        options.put("storePass", "true");
        module.initialize(subject, new FaultCallbackHandler(), status, options);
        try {
            module.login();
            module.commit();       
        } catch (LoginException e) {
            assertNull("javax.security.auth.login.name in shared state should be null when login failed",status.get("javax.security.auth.login.name"));
View Full Code Here

        }
        finally{
            module.logout();
        }
       
        module.initialize(subject, new MockCallbackHandler(), status, options);
        try {
            module.login();
            module.commit();       
        } catch (LoginException e) {
            fail("Login failed");
View Full Code Here

        assertNotNull("javax.security.auth.login.name should be stored in shared state when storePass switch on",status.get("javax.security.auth.login.name"));
        assertNotNull("javax.security.auth.login.password should be stored in shared state when storePass switch on",status.get("javax.security.auth.login.password"));
       
        status.put("javax.security.auth.login.name", "tester");
        status.put("javax.security.auth.login.password", "testerPass");
        module.initialize(subject, new MockCallbackHandler(), status, options);
        try {
            module.login();
            module.commit();       
        } catch (LoginException e) {
            fail("Login failed");
View Full Code Here

        } catch (LoginException e) {
            fail("Abort failed");
        }
        Subject subject = new Subject();
        subject.setReadOnly();
        jlm.initialize(subject, null, null, options);
        try {
            assertFalse("Should return false if login failed or no login", jlm
                    .abort());
        } catch (Exception e) {
            fail("Not any exception here");
View Full Code Here

                    .abort());
        } catch (Exception e) {
            fail("Not any exception here");
        }
        subject = new Subject();
        jlm.initialize(subject, new FaultCallbackHandler(), null, options);
        try {
            jlm.login();
            fail("login should fail");
        } catch (LoginException e) {
            assertFalse("Should return false because of login failure", jlm
View Full Code Here

            assertFalse("Should return false because of login failure", jlm
                    .abort());
        }
        subject = new Subject();
        options.put("authIdentity","cn=Manager,dc=my-domain,dc=com");
        jlm.initialize(subject, new MockCallbackHandler(), null, options);
        jlm.login();
        assertTrue("Should return true if login was successful", jlm
                .abort());
    }
View Full Code Here

     */
    public void test_commit() {
        LdapLoginModule module = new LdapLoginModule();
        Subject subject = new Subject();
        options.put("authIdentity","cn=Manager,dc=my-domain,dc=com");
        module.initialize(subject, new MockCallbackHandler(), null, options);
        try {
            assertTrue("Login should be successful", module.login());
            module.commit();
        } catch (LoginException e) {
            fail("Login shouldn't fail");
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.