Code example for Subject

Methods: getPrivateCredentials, getPublicCredentials

0
        context.login();
        context.login();
 
        Subject subject = context.getSubject();
 
        assertEquals(2, subject.getPrivateCredentials().size());
        assertEquals(2, subject.getPublicCredentials().size());
    } 
 
    public static class MyModule implements LoginModule { 
 
        Subject sub;
 
        public boolean abort() throws LoginException { 
            return false; 
        } 
 
        public boolean commit() throws LoginException { 
            sub.getPrivateCredentials().add(new Object());
            return true; 
        }