开发者社区 问答 正文

spring security集成cas客户端后

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

请问怎么设置这个顺序

展开
收起
a123456678 2016-03-16 17:25:25 3250 分享 版权
1 条回答
写回答
取消 提交回答
  • 所以最后我的自定义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简单测试过是没有问题的
    2019-07-17 19:04:10
    赞同 展开评论