Package javax.security.auth.login

Examples of javax.security.auth.login.LoginContext.logout()


        NamedUsernamePasswordCredential namedupc = (NamedUsernamePasswordCredential) subject.getPrivateCredentials().toArray()[0];
        assertEquals("Credential name", credname, namedupc.getName());
        assertEquals("Username", username, namedupc.getUsername());
        assertEquals("Password", password, new String(namedupc.getPassword()));

        context.logout();

        assertEquals("Private credentials upon logout", 0, subject.getPrivateCredentials().size());
        assertTrue("id of server subject should be null", ContextManager.getSubjectId(subject) == null);
    }
View Full Code Here


        assertTrue("expected non-null subject", subject != null);
        assertEquals("Principals", 0, subject.getPrincipals().size());
        assertEquals("Private credentials", 0, subject.getPrivateCredentials().size());
        assertEquals("Public credentials", 0, subject.getPublicCredentials().size());

        context.logout();
    }

    public void testBadUserLogin() throws Exception {
        //not relevant
    }
View Full Code Here

        assertTrue("expected non-null subject", subject != null);
        assertEquals("Principals", 0, subject.getPrincipals().size());
        assertEquals("Private credentials", 0, subject.getPrivateCredentials().size());
        assertEquals("Public credentials", 0, subject.getPublicCredentials().size());

        context.logout();
    }

    public void testBadPasswordLogin() throws Exception {
        //not relevant
    }
View Full Code Here

        assertTrue("expected non-null subject", subject != null);

        subject.setReadOnly();

        try {
            context.logout();
        } catch(Exception e) {
            fail("logout failed");
        }
        NamedUsernamePasswordCredential namedupc = (NamedUsernamePasswordCredential) subject.getPrivateCredentials().toArray()[0];
        assertTrue("credential should have been destroyed", namedupc.isDestroyed());
View Full Code Here

        assertEquals("Public credentials", 0, subject.getPublicCredentials().size());
        GeronimoPasswordCredential pwdCred = (GeronimoPasswordCredential) subject.getPrivateCredentials().toArray()[0];
        assertEquals("Username", username, pwdCred.getUserName());
        assertEquals("Password", password, new String(pwdCred.getPassword()));

        context.logout();

        assertEquals("Private credentials upon logout", 0, subject.getPrivateCredentials().size());
        assertTrue("id of server subject should be null", ContextManager.getSubjectId(subject) == null);
    }
View Full Code Here

        assertTrue("expected non-null subject", subject != null);
        assertEquals("Principals", 0, subject.getPrincipals().size());
        assertEquals("Private credentials", 0, subject.getPrivateCredentials().size());
        assertEquals("Public credentials", 0, subject.getPublicCredentials().size());

        context.logout();
    }

    public void testBadUserLogin() throws Exception {
        //not relevant
    }
View Full Code Here

        assertTrue("expected non-null subject", subject != null);
        assertEquals("Principals", 0, subject.getPrincipals().size());
        assertEquals("Private credentials", 0, subject.getPrivateCredentials().size());
        assertEquals("Public credentials", 0, subject.getPublicCredentials().size());

        context.logout();
    }

    public void testBadPasswordLogin() throws Exception {
        //not relevant
    }
View Full Code Here

        assertTrue("expected non-null subject", subject != null);

        subject.setReadOnly();

        try {
            context.logout();
        } catch(Exception e) {
            fail("logout failed");
        }
        GeronimoPasswordCredential pwdCred = (GeronimoPasswordCredential) subject.getPrivateCredentials().toArray()[0];
        assertTrue("credential should have been destroyed", pwdCred.isDestroyed());
View Full Code Here

    public void logout(UUID securityIdentity) throws LoginException {
        LoginContext context = contexts.get(securityIdentity);
        if (null == context) {
            throw new IllegalStateException("Unable to logout. Can not recover LoginContext.");
        }
        context.logout();
        super.logout(securityIdentity);
    }

}
View Full Code Here

            assertEquals("server-side subject should have one realm principal", 1, subject.getPrincipals(RealmPrincipal.class).size());
            assertEquals("server-side subject should have one identification principal", 1, subject.getPrincipals(IdentificationPrincipal.class).size());
            assertEquals("server-side subject should have one kerberos principal", 1, subject.getPrincipals(KerberosPrincipal.class).size());
            RealmPrincipal principal = (RealmPrincipal) subject.getPrincipals(RealmPrincipal.class).iterator().next();

            context.logout();

            assertTrue("id of subject should be null", ContextManager.getSubjectId(subject) == null);
        } catch (LoginException e) {
            e.printStackTrace();
            // May not have kerberos
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.