免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 881 | 回复: 0
打印 上一主题 下一主题

appfuse开读7 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2006-07-27 15:28 |只看该作者 |倒序浏览
Appfuse Version 1.9.3

org.acegisecurity.ui.webapp.AuthenticationProcessingFilter

这个验证过滤器做了比较多的事情,看security.xml

authenticationManager中注入的多个property就看的出来

authenticationManager代理了认证过程,如果通过验证那么返回一个通过验证的Authentication,它包含了此用户可以操作的所有权限信息,如果未通过验证,将抛出一个
AuthenticationException,doFilter方法中捕获了这个异常,并将用户引导到authenticationFailureUrl路径所指的位置
如果验证成功了,那么先将Authentication填充到SecurityContextHolder中

SecurityContextHolder.getContext().setAuthentication(authResult);
在response里面写入cookies
rememberMeServices.loginSuccess(request, response, authResult);

在这里是TokenBasedRememberMeServices中的loginSuccess方法,其中对cookie进行了加密操作
// construct token to put in cookie; format is:
//     username + ":" + expiryTime + ":" + Md5Hex(username + ":" + expiryTime + ":" + password + ":" + key)

这个计算完成后做了Base64.encodeBase64,然后将这段字符串存入cookie
name=ACEGI_SECURITY_HASHED_REMEMBER_ME_COOKIE
最后重定向到
response.sendRedirect(response.encodeRedirectURL(targetUrl));

其中 targetUrl = obtainFullRequestUrl(request);即转向原来请求的路径
如果alwaysUseDefaultTargetUrl==false等情况会转向这个位置


本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/19271/showart_146532.html
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP