shiro学习25-shiro提供的filter-PassThruAuthenticationFilter

PassThruAuthenticationFilter这个类是一个最终的实现类,他实现了onAccessDenied方法,实现很简单

protected boolean onAccessDenied(ServletRequest request, ServletResponse response) throws Exception {
    if (isLoginRequest(request, response)) {
        return true;
    } else {
        saveRequestAndRedirectToLogin(request, response);
        return false;
    }
}

 

在之前需要调用AuthenticationFilterisAccessAllowed方法,里面判断的就是是否登录,所以这个类(PassThruAuthenticationFilter)适合于那些需要登录并且登录之后就能实现的操作。

 

猜你喜欢

转载自suichangkele.iteye.com/blog/2277093