GuestLoginModule implements LoginModule { @Override public boolean logout() { if (authenticationSucceeded()) { if (!subject.isReadOnly()) { subject.getPublicCredentials().remove(guestCredentials); subject.getPrincipals().remove(EveryonePrincipal.getInstance()); } else { log.debug("Cannot destroy GuestCredentials"); } return true; } else { return false; } }  @Override void initialize(Subject subject, CallbackHandler callbackHandler, Map<String, ?> sharedState, Map<String, ?> options); @Override boolean login(); @Override boolean commit(); @Override boolean abort(); @Override boolean logout();  }
@Test public void testLogout() throws LoginException { assertFalse(guestLoginModule.logout()); }