Package javax.security.auth.login

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


    try {
      LOG.info("Initiating logout for " + getUserName());
      //clear up the kerberos state. But the tokens are not cleared! As per
      //the Java kerberos login module code, only the kerberos credentials
      //are cleared
      login.logout();
      //login and also update the subject field of this instance to
      //have the new credentials (pass it to the LoginContext constructor)
      login =
        new LoginContext(HadoopConfiguration.KEYTAB_KERBEROS_CONFIG_NAME,
            getSubject());
View Full Code Here


                    try {
                        RunAction action = new RunAction(result);
                        logger.config("run test in jaas subject");
                        Subject.doAs(lc.getSubject(), action);
                    } finally {
                        lc.logout();
                    }
                } else {
                    super.run(result);
                }
            }
View Full Code Here

      }
      synchronized (UserGroupInformation.class) {
        // clear up the kerberos state. But the tokens are not cleared! As per
        // the Java kerberos login module code, only the kerberos credentials
        // are cleared
        login.logout();
        // login and also update the subject field of this instance to
        // have the new credentials (pass it to the LoginContext constructor)
        login = newLoginContext(
            HadoopConfiguration.KEYTAB_KERBEROS_CONFIG_NAME, getSubject(),
            new HadoopConfiguration());
View Full Code Here

        LOG.debug("Initiating logout for " + getUserName());
      }
      //clear up the kerberos state. But the tokens are not cleared! As per
      //the Java kerberos login module code, only the kerberos credentials
      //are cleared
      login.logout();
      //login and also update the subject field of this instance to
      //have the new credentials (pass it to the LoginContext constructor)
      login =
        newLoginContext(HadoopConfiguration.USER_KERBEROS_CONFIG_NAME,
            getSubject(), new HadoopConfiguration());
View Full Code Here

                        return null;
                    }
                });
            } finally {
                // And finally, logout
                loginContext.logout();
            }
        }
    }

    private static void invoke(Method mainMethod, Object[] mainArgs) throws Exception {
View Full Code Here

        assertEquals("Should have three principals", 3, subject.getPrincipals().size());
        assertEquals("Should have one user principal", 1, subject.getPrincipals(UserPrincipal.class).size());
        assertEquals("Should have two group principals", 2, subject.getPrincipals(GroupPrincipal.class).size());

        context.logout();

        assertEquals("Should have zero principals", 0, subject.getPrincipals().size());
    }

    public void testBadUseridLogin() throws Exception {
View Full Code Here

            assertTrue("expected non-null subject", subject != null);
            assertEquals("server-side subject should have two principals", 1, subject.getPrincipals().size());
            assertEquals("server-side subject should have one kerberos principal", 1, subject.getPrincipals(KerberosPrincipal.class).size());

            context.logout();

        } catch (LoginException e) {
            //See GERONIMO-3388.  This seems to be the normal code path.
            e.printStackTrace();
            // May not have kerberos
View Full Code Here

        Subject subject = context.getSubject();
        assertTrue("expected non-null subject", subject != null);
        assertEquals("Remote principals", 0, subject.getPrincipals(IdentificationPrincipal.class).size());
        assertEquals("Principals", 2, subject.getPrincipals().size());

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

        context.login();
        Subject subject = context.getSubject();
        assertTrue("expected non-null subject", subject != null);
        assertEquals("Principals added upon failed login", 0, subject.getPrincipals().size());
        context.logout();
    }

    public void testLogoutWithReadOnlySubject() throws Exception {
        LoginContext context = new LoginContext(SIMPLE_REALM, new UsernamePasswordCallback("alan", "starcraft"));
View Full Code Here

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

        subject.setReadOnly();

        try {
            context.logout();
        } catch(Exception e) {
            fail("logout failed");
        }
    }
}
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.