Package org.apache.shiro.subject

Examples of org.apache.shiro.subject.Subject.logout()


            // Test whether user's role is authorized to perform functions in the permissions list
            authorizeUser(currentUser, exchange);
        } finally {
            if (policy.isAlwaysReauthenticate()) {
                currentUser.logout();
            }
        }
    }

    private void authenticateUser(Subject currentUser, ShiroSecurityToken securityToken) {
View Full Code Here


               
                    // Test whether user's role is authorized to perform functions in the permissions list 
                    authorizeUser(currentUser, exchange);
                } finally {
                    if (alwaysReauthenticate) {
                        currentUser.logout();
                        currentUser = null;
                    }
                }

            }
View Full Code Here

    @Override
    public void logoutCurrentUser(String token) {
        Subject s = SecurityUtils.getSubject();
        if (s != null) {
            logger.debug("Logout user: kill the Shiro Session");
            s.logout();
        } else {
            logger.debug("Logout user, subject not found in SecurityUtils");
        }
    }
View Full Code Here

        } else {
            fail( "Sorry, you aren't allowed to drive the 'eagle5' winnebago!" );
        }

        //all done - log out!
        currentUser.logout();
    }

}
View Full Code Here

  @DirectMethod
  public void signOut() {
    Subject subject = securitySystem.getSubject();

    if (subject != null) {
      subject.logout();
    }

    if (WebContextManager.isWebContextAttachedToCurrentThread()) {
      HttpSession session = WebContextManager.get().getRequest().getSession(false);
      if (session != null) {
View Full Code Here

      if (anonSession != null) {
        // clear the session
        this.getLogger().debug("Logging out the current anonymous user, to clear the session.");
        try {
          subject.logout();
        }
        catch (UnknownSessionException expectedException) {
          this.logger.trace(
              "Forced a logout with an Unknown Session so the current subject would get cleaned up.", e);
        }
View Full Code Here

      throws Exception
  {
    Subject subject = getSubject(request, response);

    if (subject != null) {
      subject.logout();
    }

    if (HttpServletRequest.class.isAssignableFrom(request.getClass())) {
      HttpSession session = ((HttpServletRequest) request).getSession(false);
View Full Code Here

      assertThat(principals.getPrimaryPrincipal().toString(), isIn(userManager.listUserIds()));
      assertThat(userManager.getAuthenticationRealmName(), isIn(principals.getRealmNames()));
    }
    finally {
      subject.logout();
    }
  }

  @Test
  public void testFindUserManagerNonDefaultRealm()
View Full Code Here

      assertThat(principals.getPrimaryPrincipal().toString(), isIn(userManager.listUserIds()));
      assertThat(userManager.getAuthenticationRealmName(), isIn(principals.getRealmNames()));
    }
    finally {
      subject.logout();
    }
  }

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

      final PrincipalCollection principals = subject.getPrincipals();

      assertThat(helper().getUserStatus(principals), is(UserStatus.active));
    }
    finally {
      subject.logout();
    }
  }

  @Test
  public void testGetUserStatusNonDefaultRealm()
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.