首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >TAM Webseal + spring预认证

TAM Webseal + spring预认证
EN

Stack Overflow用户
提问于 2015-12-08 20:01:54
回答 1查看 1.7K关注 0票数 4

有没有人用TAM Web-seal做过spring预认证?您能分享一下配置详细信息吗?

EN

回答 1

Stack Overflow用户

发布于 2015-12-08 20:18:12

如果webseal在iv-user头中使用用户名转发请求,那么配置spring-security相对简单:

代码语言:javascript
复制
<security:http auto-config="false" use-expressions="true" entry-point-ref="authenticationEntryPoint" access-decision-manager-ref="httpAccessDecisionManager">

    <security:custom-filter ref="webSealPreAuthFilter" position="PRE_AUTH_FILTER"/>
     ...
</security:http>


<bean id="webSealPreAuthFilter" class="org.springframework.security.web.authentication.preauth.RequestHeaderAuthenticationFilter">
    <property name="authenticationManager" ref="authenticationManager"/>
    <property name="principalRequestHeader" value="iv-user"/>

    <!-- exceptionIfHeaderMissing AND checkForPrincipalChanges needs to be enable to check that each request needs a "iv-user" header -->
    <property name="checkForPrincipalChanges" value="true"/>
    <property name="exceptionIfHeaderMissing" value="true"/>
</bean>


<alias name="authenticationManager" alias="org.springframework.security.authenticationManager"/>
<bean id="authenticationManager" class="org.springframework.security.authentication.ProviderManager">
    <property name="authenticationEventPublisher">
        <bean class="org.springframework.security.authentication.DefaultAuthenticationEventPublisher"/>
    </property>
    <constructor-arg name="providers">
        <list>
            <ref local="preAuthenticatedAuthenticationProvider"/>
        </list>
    </constructor-arg>
</bean>

<bean id="preAuthenticatedAuthenticationProvider"
        class="org.springframework.security.web.authentication.preauth.PreAuthenticatedAuthenticationProvider">
    <property name="preAuthenticatedUserDetailsService">
        <bean class="org.springframework.security.core.userdetails.UserDetailsByNameServiceWrapper">
            <constructor-arg name="userDetailsService" ref="userDetailsService"/>
        </bean>
    </property>
</bean>

<bean id="authenticationEntryPoint" class="org.springframework.security.web.authentication.Http403ForbiddenEntryPoint"/>

您需要一个userDetailsService,但这在很大程度上取决于您的应用程序的工作方式。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/34155393

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档