Package org.apache.shiro.subject

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


      catch (final UserNotFoundException e) {
        // expected...
      }
    }
    finally {
      subject.logout();
    }
  }

  private UserPrincipalsHelper helper() {
    try {
View Full Code Here


    @Override
    protected boolean onAccessDenied(ServletRequest request, ServletResponse response) throws Exception {
        Subject subject = getSubject(request, response);
        if (subject != null) {
            subject.logout();
        }
        saveRequestAndRedirectToLogin(request, response);
        return true;
    }
View Full Code Here

        //如果用户直接到登录页面 先退出一下
        //原因:isAccessAllowed实现是subject.isAuthenticated()---->即如果用户验证通过 就允许访问
        // 这样会导致登录一直死循环
        Subject subject = SecurityUtils.getSubject();
        if (subject != null && subject.isAuthenticated()) {
            subject.logout();
        }


        //如果同时存在错误消息 和 普通消息  只保留错误消息
        if (model.containsAttribute(Constants.ERROR)) {
View Full Code Here

    protected boolean preHandle(ServletRequest request, ServletResponse response) throws Exception {
        Subject subject = getSubject(request, response);
        String redirectUrl = getRedirectUrl(request, response, subject);
        //try/catch added for SHIRO-298:
        try {
            subject.logout();
        } catch (SessionException ise) {
            log.debug("Encountered session exception during logout.  This can generally safely be ignored.", ise);
        }
        issueRedirect(request, response, redirectUrl);
        return false;
View Full Code Here

        //Now you are ready to access the Subject, as shown in the Quickstart:
        Subject currentUser = SecurityUtils.getSubject();

        //anything else you want to do with the Subject (see the Quickstart for examples).

        currentUser.logout();

        System.exit(0);
    }
}
View Full Code Here

           
            // TODO: perhaps we should cache Isis' AuthenticationSession inside the Shiro Session, and
            // just retrieve it?
           
            // for now, just log them out.
            currentSubject.logout();
        }
        try {
            currentSubject.login(token);
        } catch ( UnknownAccountException uae ) {
            LOG.debug("Unable to authenticate", uae);
View Full Code Here

    @After
    public void tearDown() throws Exception {
        Subject subject = SecurityUtils.getSubject();
        if(subject != null) {
            subject.logout();
        }
        SecurityUtils.setSecurityManager(null);
    }

    @Test
View Full Code Here

    @After
    public void tearDown() throws Exception {
        Subject subject = SecurityUtils.getSubject();
        if(subject != null) {
            subject.logout();
        }
        SecurityUtils.setSecurityManager(null);
    }

    @Test
View Full Code Here

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

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

        System.exit(0);
    }
}
View Full Code Here

        Session session = subject.getSession();
        session.setAttribute("key", "value");
        assertEquals(session.getAttribute("key"), "value");

        subject.logout();

        assertNull(subject.getSession(false));
        assertNull(subject.getPrincipal());
        assertNull(subject.getPrincipals());
    }
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.