shiro learns the filter-logoutFilter provided by 19-shiro

This class is very simple. It is used to log out the previously logged in user when logging out, and redirect to the configured page. The default is "/" . You can change the redirectUrl attribute to jump to the page we specify.

 

Take a look at his preHandle method

@Override
    protectedboolean preHandle(ServletRequest request, ServletResponse response) throws Exception {
        Subject subject = getSubject(request, response);
        String redirectUrl = getRedirectUrl(request, response, subject);
        try {
            subject.logout();//Call the logout method. Deletes the content previously put into the session from the session. You will have to log in again the next time you visit.
        } catch (SessionException ise) {
            log.debug("Encountered session exception during logout.  This can generally safely be ignored.", ise);
        }
        issueRedirect(request, response, redirectUrl);
        returnfalse;
    }

 

 

In this method, false is returned , that is, no other operations are performed, and the browser is redirected directly. So if we have other operations, we can inherit this class and operate in the afterCompletion method.

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=327086706&siteId=291194637