Package org.apache.harmony.auth.module

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


        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){
            //expected LoginException here
        }
View Full Code Here


       
        options.remove("useFirstPass");
        options.put("tryFirstPass", "true");
        module.initialize(subject, new MockCallbackHandler(), status, options);
        try {
            module.login();
            module.commit();
        }
        catch(LoginException e){
            fail("Login should be failed");
        }
View Full Code Here

        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"));
        } catch (LoginException e) {
            fail("Login shouldn't fail");
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"));
            assertNull("javax.security.auth.login.password in shared state should be null when login failed",status.get("javax.security.auth.login.password"));
        }
View Full Code Here

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

       
        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");
        }
        finally{
View Full Code Here

            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
                    .abort());
        }
View Full Code Here

                    .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

        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");
        }
        Set<Principal> principals = subject.getPrincipals();
View Full Code Here

    public void test_login() {
        LdapLoginModule module = new LdapLoginModule();
        HashMap<String, String> emptyOptions = new HashMap<String, String>();
        module.initialize(null, new MockCallbackHandler(), null, emptyOptions);
        try {
            module.login();
            fail("Should throw LoginException here.");
        } catch (LoginException e) {
            // expected LoginException
        }
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.