shiro spring struts-shiro自定义authc过滤器的问题

问题描述

shiro自定义authc过滤器的问题
配置了

过滤器代码如下
public class FormAuthenticationCaptchaFilter extends FormAuthenticationFilter {
public static final String DEFAULT_CAPTCHA_PARAM = ""captcha"";

private String captchaParam = DEFAULT_CAPTCHA_PARAM;public String getCaptchaParam() {    return captchaParam;}protected String getCaptcha(ServletRequest request) {    return WebUtils.getCleanParam(request getCaptchaParam());}protected AuthenticationToken createToken(ServletRequest request ServletResponse response) {    String username = getUsername(request);    String password = getPassword(request);    String captcha = getCaptcha(request);    boolean rememberMe = isRememberMe(request);    return new UsernamePasswordCaptchaToken(username            password rememberMe captcha);} // 验证码校验   protected void doCaptchaValidate( HttpServletRequest request       UsernamePasswordCaptchaToken token ){        String captcha = (String) SecurityUtils.getSubject().getSession()        .getAttribute(CaptchaServlet.KEY_CAPTCHA);      if( captcha!=null &&          !captcha.equalsIgnoreCase(token.getCaptcha()) ){          throw new CaptchaException (""验证码错误!"");       }    } // 认证   protected boolean executeLogin(ServletRequest request       ServletResponse response) throws Exception {        UsernamePasswordCaptchaToken token = (UsernamePasswordCaptchaToken)createToken(request response);       try {          doCaptchaValidate( (HttpServletRequest)requesttoken );          Subject subject = getSubject(request response);          subject.login(token);          return onLoginSuccess(token subject request response);       } catch (AuthenticationException e) {          return onLoginFailure(token e request response);       }    } 

}
但是在访问相应 url的时候再过滤器中debug进不去

时间: 2024-08-20 07:01:16

shiro spring struts-shiro自定义authc过滤器的问题的相关文章

shiro 集成 spring struts mybatis 权限查看不同的页面

问题描述 shiro 集成 spring struts mybatis 权限查看不同的页面 我搭了个框架,然后也判断了跳转,,现在我想要就是,分前台和后台,,前台 user和admin 权限能看,后台 admin 才能进去数据库改如何设计?简单点的吧,我在学习shiro ,最好能给我个demo ,谢谢了

shiro 集成 spring struts mybatis 如何根据权限跳转前后台

问题描述 shiro 集成 spring struts mybatis 如何根据权限跳转前后台 shiro 集成 spring struts mybatis 如何根据权限跳转前后台

spring mvc+shiro+cas 实现cas client功能 跳转回来404

问题描述 spring mvc+shiro+cas 实现cas client功能 跳转回来404 http://securitycenter.com:8080/gtsys/cas?ticket=ST-14-HEDhc1GVQt0UYdiZpi7R-cas 返回这个地址 404 <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.or

Shiro系列之Shiro+Spring MVC整合

第一步,Shiro Filter 在web.xml文件中增加以下代码,确保Web项目中需要权限管理的URL都可以被Shiro拦截过滤. <!-- Shiro Filter --> <filter> <filter-name>shiroFilter</filter-name> <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>

【shiro】spring整合shiro,注解控制shiro用户/角色/权限And/OR,没有权限跳转到固定页面

这几天粗浅的把shiro整合到spring中,并且注解控制shiro用户/角色/权限And/OR 步骤: 1.首先maven搭建web项目 2.创建数据库 user/role/authority 其中,role->user是一对多,role->authority是多对多 shiros.sql内容: 1 /* 2 SQLyog Ultimate v11.24 (32 bit) 3 MySQL - 5.5.41 : Database - shiros 4 *********************

shiro被拦截访问-spring mvc+shiro 被拦截访问

问题描述 spring mvc+shiro 被拦截访问 目前除了登录页面不受拦截,新加的注册页面也被拦截了(不登录就无法访问),求教,该怎么办 /view/static/** = anon /jcaptcha* = anon /eidpws/** = eidpSession,syncOnlineSession /upload/** = anon /apk/** = anon /images/** = anon /importModel/** = anon / = anon /login = jC

配置文件-spring和shiro集成配置

问题描述 spring和shiro集成配置 在meven项目结构里的spring和shiro集成配置怎么做,我用的mybatis映射数据库的, 我始终没有配置好securityManager,还有缓存的配置文件也不知道怎么写

使用AngularJS创建自定义的过滤器的方法

  这篇文章主要介绍了使用AngularJS创建自定义的过滤器的方法,AngularJS是非常热门的JavaScript库,需要的朋友可以参考下 Angularjs过滤器是 angularjs非常棒的特性之一.有朝一日,你可能需要使用自定义过滤器,幸运的是,你找到了这篇博文. 下面显示的是自定义过滤器长什么样子(请注意myfilter): 我们的自定义过滤器叫做 "myfilter", 它有由 ':'隔开的4个参数. 这是一个将会用到的样本输入: ? 1 2 3 4 5 6 $scop

[开发]resin+spring+struts配搭在线上常见的三个问题

郑昀 201102 1.文件句柄数问题 现象1:访问页面出现500错误,错误描述为:java.lang.NoClassDefFoundError,后面跟的类名各式各样不一一列举了. 现象2:Resin被Wathcdog自动重启,日志中表明这是因为:Resin shutdown from out of file descriptors. 分析:由于Linux默认文件句柄限制为1024(通过命令ulimit –n来查看),所以当Web Server应对高负载起了大量线程,incoming socke