我为几个应用程序设置了一个Spring Jasig CAS SSO。这使用CasAuthenticationFilter
。所以我有这样的webapps设置 -为CasAuthenticationFilter设置预授权过滤器
Cas Server (Cas 3.5.2) - Cas.war
,App1 - App1.war
和App2 - App2.war
。应用程序使用Spring 3.2.3和Spring Security 3.1.4.RELEASE。
Spring Security Config
:http://pastie.org/private/qxcx1h8i9ys0w3lmwegiw
事情似乎与此设置正常工作。现在,当我在Cas服务器上启用OAuth(而不是通过Spring Cas)时,我无法将该身份验证与我设置的通常基于表单的身份验证集成在一起。 Facebook的OAuth集成似乎工作正常,因为我可以看到在日志中成功检索的Facebook配置文件属性。问题是,后facebook的登录,CasAuthenticationFilter尝试验证用户“FacebookProfile#XYZXYZ”与基于窗体的登录类似的机制,显然它没有在用户的数据库表中找到该用户。我的猜测是,我需要写一个扩展AbstractPreAuthenticatedProcessingFilter
与PRE_AUTH_FILTER
前位置(查看以上的pastie配置),并且应该以某种方式设置Authentication
权利,所以CasAuthenticationFilter
应该知道用户已经登录在自定义过滤器。
这是URL被CasAuthenticationFilter
认证为每日志 - /j_spring_cas_security_proxyreceptor?pgtIou=PGTIOU-1-pR9r9LVJvB5EkezbMJHN-talenteye.in&pgtId=TGT-2-QXvAHIRciBNR9HU5FOvpOaHcJaBj5OJTUPPz5ZwA7yK1xH54iL-myorg.in
实施CasAuthenticationFilter
requiresAuthentication
看起来是这样的:
protected boolean requiresAuthentication(final HttpServletRequest request, final HttpServletResponse response) {
final boolean serviceTicketRequest = serviceTicketRequest(request, response);
final boolean result = serviceTicketRequest || proxyReceptorRequest(request) || (proxyTicketRequest(serviceTicketRequest, request));
if(logger.isDebugEnabled()) {
logger.debug("requiresAuthentication = "+result);
}
return result;
}
和日志s说 -
19:23:42.835 [http-bio-8080-exec-8] DEBUG o.s.s.c.web.CasAuthenticationFilter - serviceTicketRequest = false
19:23:42.835 [http-bio-8080-exec-8] DEBUG o.s.s.c.web.CasAuthenticationFilter - proxyReceptorConfigured = true
19:23:42.835 [http-bio-8080-exec-8] DEBUG o.s.s.c.web.CasAuthenticationFilter - proxyReceptorRequest = true
19:23:42.835 [http-bio-8080-exec-8] DEBUG o.s.s.c.web.CasAuthenticationFilter - requiresAuthentication = true
19:23:42.835 [http-bio-8080-exec-8] DEBUG o.s.s.c.web.CasAuthenticationFilter - Request is to process authentication
19:23:42.835 [http-bio-8080-exec-8] DEBUG o.s.s.c.web.CasAuthenticationFilter - proxyReceptorConfigured = true
19:23:42.835 [http-bio-8080-exec-8] DEBUG o.s.s.c.web.CasAuthenticationFilter - proxyReceptorRequest = true
19:23:42.835 [http-bio-8080-exec-8] DEBUG o.s.s.c.web.CasAuthenticationFilter - Responding to proxy receptor request
我很困惑如何使这项工作在一起。我想知道我是否有点太复杂了。任何指针都会非常有用,因为我已经浪费了几天的时间。