spring security集成cas客户端时候配置了一个
<authentication-manager alias="authenticationManager">
<authentication-provider ref="casAuthenticationProvider"/>
</authentication-manager>
但是这个只能验证用户是否登录的,
现在我需要自定义一个
<custom-filter ref="myAclFilter" before="FILTER_SECURITY_INTERCEPTOR"/>
拦截权限的
<authentication-provider user-service-ref="userDetailsService"/>
配置完成后问题出现了。
跟进代码发现使用了这个默认的
org.springframework.security.authentication.dao.DaoAuthenticationProvider
并且
String username = (authentication.getPrincipal() == null) ? "NONE_PROVIDED" : authentication.getName();
应为经过cas登录后用户的ID 是cas 哪里是_cas_stateful_
这样就使得无法通过了。
请问 是否 这几个是否有先后顺序的?
如果只是有cas的那么就不是org.springframework.security.authentication.dao.DaoAuthenticationProvider
而是CasAuthenticationProvider
请问怎么设置这个顺序
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。
所以最后我的自定义filter:
<beans:bean id="myAclFilter" class="com.manage.sso.interceptor.AclFilterSecurityInterceptor">
<beans:property name="authenticationManager" ref="authenticationManager" />
<beans:property name="accessDecisionManager" ref="myAclAccessDecisionManager" />
<beans:property name="securityMetadataSource" ref="myAclFilterInvocationSecurityMetadataSource" />
</beans:bean>
<beans:property name="authenticationManager" ref="authenticationManager" />
引用cas的同一个manager简单测试过是没有问题的