Package javax.security.auth.login

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


            response = entryBean.doubleDoIHaveRole("Role2");
            assertTrue(response[0]);
            assertTrue(response[1]);
        } finally {
            lc.logout();
        }
    }

    @Test
    public void testOnlyRole1() {
View Full Code Here


           test.startTimer(150);
           Assert.assertTrue(TimerTesterBean.awaitTimerCall());

           Assert.assertEquals("user2", TimerTesterBean.calleeCallerPrincipal.iterator().next().getName());
       } finally {
           lc.logout();
       }
    }
}
View Full Code Here

            final String invalidRole = "UselessRole";
            final boolean callerInUselessRole = callerRoleCheckerBean.isCallerInRole(invalidRole);
            Assert.assertFalse("Caller wasn't expected to be in " + invalidRole + " but was", callerInUselessRole);

        } finally {
            loginContext.logout();
        }
    }
}
View Full Code Here

      LOG.info("Initiating logout for " + getUserName());
      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

    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 =
        newLoginContext(HadoopConfiguration.USER_KERBEROS_CONFIG_NAME,
            getSubject(), new HadoopConfiguration());
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

                contextMap.put(connectionId, context);
            } else {
                LoginContext context = contextMap.remove(connectionId);
                if (context != null) {
                    try {
                        context.logout();
                    } catch (LoginException e) {
                        //nothing we can do here...
                    }
                }
            }
View Full Code Here

            assertTrue("expected non-null subject", subject != null);
            assertTrue("id of subject should be null", ContextManager.getSubjectId(subject) == null);
            assertEquals("subject should have one principal", 1, subject.getPrincipals().size());
            assertEquals("subject should have no realm principal", 0, subject.getPrincipals(RealmPrincipal.class).size());

            context.logout();
        } catch (LoginException e) {
            e.printStackTrace();
            // May not have kerberos
        }
    }
View Full Code Here

                        }
                    }
                }
            });
            loginContext.login();
            loginContext.logout();
            return true;
        } catch (Exception e) {
            LOGGER.error("Authentication failed with error", e);
            return false;
        }
View Full Code Here

                    // Ignore
                }
            }
            if (lc != null) {
                try {
                    lc.logout();
                } catch (LoginException e) {
                    // Ignore
                }
            }
        }
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.