我在学习Spring和Grails安全性方面遇到了困难。
我有一个想要通过testlogin.ua.edu/cas/login进行身份验证的应用程序。我曾想过我正在使用Spring Security插件,但是git说“ Java Apereo CAS Client”。最终,我希望使用EASY解决方案来访问它返回的用户名(gjbowen),并将其用于控制器中的其他验证等。过去几周我在Google上搜索过的与此相关的所有其他问题已经过时,或者没有给我带来任何好运。如果有人能提供见解并为我提供万无一失,将不胜感激!
它基于包含以下内容的登录信息从Cas20ServiceTicketValidator返回凭据:
o.j.c.c.v.Cas20ServiceTicketValidator : Server response: <cas:serviceResponse xmlns:cas='http://www.yale.edu/tp/cas'>
<cas:authenticationSuccess>
<cas:user>gjbowen</cas:user>
</cas:authenticationSuccess>
</cas:serviceResponse>
在我的build.gradle中
compile "org.grails.plugins:spring-security-cas:3.1.0"
compile "org.grails.plugins:spring-security-core:3.2.3"
application.yml:
environments:
development:
grails:
plugin:
springsecurity:
userLookup.userDomainClassName : fzbidcm.User
userLookup.authorityJoinClassName : fzbidcm.UserRole
userLookup.authority.className: fzbidcm.Role
cas:
serverUrlPrefix: https://testlogin.ua.edu/cas
loginUri: /login
key: myApp
serviceUrl: http://localhost:8080/login/cas
useSingleSignout: false
其他登录
DEBUG --- tContextHolderExceptionTranslationFilter : Calling Authentication entry point.
DEBUG --- w.c.HttpSessionSecurityContextRepository : SecurityContext is empty or contents are anonymous - context will not be stored in HttpSession.
DEBUG --- s.s.w.c.SecurityContextPersistenceFilter : SecurityContextHolder now cleared, as request processing completed
DEBUG --- o.g.w.s.mvc.GrailsWebRequestFilter : Bound Grails request context to thread: org.apache.catalina.connector.RequestFacade@2d0a86ce
DEBUG --- o.s.s.w.u.matcher.AntPathRequestMatcher : Request '/user/login' matched by universal pattern '/**'
DEBUG --- o.s.security.web.FilterChainProxy : /user/login?ticket=ST-2426-3GDsZ2cVi1udFYgloDMfCgsei7U-bnrbeis-test at position 1 of 11 in additional filter chain; firing Filter: 'SecurityRequestHolderFilter'
DEBUG --- o.s.security.web.FilterChainProxy : /user/login?ticket=ST-2426-3GDsZ2cVi1udFYgloDMfCgsei7U-bnrbeis-test at position 2 of 11 in additional filter chain; firing Filter: 'SecurityContextPersistenceFilter'
DEBUG --- w.c.HttpSessionSecurityContextRepository : HttpSession returned null object for SPRING_SECURITY_CONTEXT
DEBUG --- w.c.HttpSessionSecurityContextRepository : No SecurityContext was available from the HttpSession: org.apache.catalina.session.StandardSessionFacade@5def7c2c. A new one will be created.
DEBUG --- o.s.security.web.FilterChainProxy : /user/login?ticket=ST-2426-3GDsZ2cVi1udFYgloDMfCgsei7U-bnrbeis-test at position 3 of 11 in additional filter chain; firing Filter: 'MutableLogoutFilter'
DEBUG --- o.s.s.w.u.matcher.AntPathRequestMatcher : Checking match of request : '/user/login'; against '/logoff'
DEBUG --- o.s.security.web.FilterChainProxy : /user/login?ticket=ST-2426-3GDsZ2cVi1udFYgloDMfCgsei7U-bnrbeis-test at position 4 of 11 in additional filter chain; firing Filter: 'CasAuthenticationFilter'
DEBUG --- o.s.s.w.u.matcher.AntPathRequestMatcher : Checking match of request : '/user/login'; against '/user/login'
DEBUG --- o.s.s.cas.web.CasAuthenticationFilter : serviceTicketRequest = true
DEBUG --- o.s.s.cas.web.CasAuthenticationFilter : requiresAuthentication = true
DEBUG --- o.s.s.cas.web.CasAuthenticationFilter : Request is to process authentication
DEBUG --- o.s.s.cas.web.CasAuthenticationFilter : proxyReceptorConfigured = true
DEBUG --- o.s.s.w.u.matcher.AntPathRequestMatcher : Checking match of request : '/user/login'; against '/**null'
DEBUG --- o.s.s.cas.web.CasAuthenticationFilter : proxyReceptorRequest = false
DEBUG --- o.s.s.w.u.matcher.AntPathRequestMatcher : Checking match of request : '/user/login'; against '/user/login'
DEBUG --- o.s.s.cas.web.CasAuthenticationFilter : serviceTicketRequest = true
DEBUG --- o.s.s.authentication.ProviderManager : Authentication attempt using org.springframework.security.cas.authentication.CasAuthenticationProvider
DEBUG --- o.s.s.c.a.CasAuthenticationProvider : serviceUrl = http://localhost:8080/user/login
DEBUG --- o.j.c.c.v.Cas20ServiceTicketValidator : Placing URL parameters in map.
DEBUG --- o.j.c.c.v.Cas20ServiceTicketValidator : Calling template URL attribute map.
DEBUG --- o.j.c.c.v.Cas20ServiceTicketValidator : Loading custom parameters from configuration.
DEBUG --- o.j.c.c.v.Cas20ServiceTicketValidator : Constructing validation url: https://testlogin.ua.edu/cas/serviceValidate?ticket=ST-2426-3GDsZ2cVi1udFYgloDMfCgsei7U-bnrbeis-test&service=http%3A%2F%2Flocalhost%3A8080%2Fuser%2Flogin
DEBUG --- o.j.c.c.v.Cas20ServiceTicketValidator : Retrieving response from server.
DEBUG --- o.j.c.c.v.Cas20ServiceTicketValidator : Server response: <cas:serviceResponse xmlns:cas='http://www.yale.edu/tp/cas'>
<cas:authenticationSuccess>
<cas:user>gjbowen</cas:user>
</cas:authenticationSuccess>
</cas:serviceResponse>