2011-05-27 67 views
2

在我部署的一只耳朵。我有一个安全上下文,像这样:如何重定向到登录进入点在不同的EAR

<security:http auto-config="false" use-expressions="true" entry-point-ref="loginUrlAuthenticationEntryPoint"> 
    <security:intercept-url pattern="/login" filters="none" /> 
    <security:intercept-url pattern="/**" access="isAuthenticated() and permitAll" /> 

    <security:custom-filter position="FORM_LOGIN_FILTER" ref="ssoFilter" /> 
</security:http> 
<bean id="loginUrlAuthenticationEntryPoint" class="org.springframework.security.web.authentication.LoginUrlAuthenticationEntryPoint"> 

    <property name="loginFormUrl" value="/login"/> 
</bean> 

现在,在第二EAR我想重定向到登录第一个页面。这可以以某种方式完成,而不需要扩展LoginUrlAuthenticationEntryPoint

因为目前如果我尝试在第二EAR安全上下文绝对URL:

<property name="loginFormUrl" value="http://host/ear1ContextPath/login"/> 

我重定向到:http://host/ear2contextPath/login

这是不正确的。

感谢

+0

你能描述一下你的情况吗? – abalogh 2011-05-27 09:54:54

+0

@abalogh单点登录,第一个EAR登录URL将成为所有其他系统的入口点。 – Simeon 2011-05-27 11:01:19

+1

http://forum.springsource.org/showthread.php?105771-Integrate-Single-Sign-On-using-Spring-Security->检查此 – abalogh 2011-05-27 11:35:44

回答

1

我设法通过实现我自己的UrlAuthenticationFaliureHandler和编程处理绝对URL来做到这一点(只是做一个servlet重定向再破过滤器链)。

然后,我可以注入新的FailureHandler在我的自定义过滤器是这样的:

<bean id="absoluteUrlLoginFailureHandler" class="tld.company.AbsoluteUrlAuthenticationFaliureHandler"> 

    <property name="defaultFailureUrl" value="http://company.domain.tld/Login.html"/> 
</bean> 
<bean id="absoluteUrlFilter" class="tld.company.MyUserPassFilter"> 

    <property name="authenticationFailureHandler" ref="absoluteUrlLoginFailureHandler"/>    
</bean> 

然后我设置的命名空间配置该过滤器:

<http auto-config="false" use-expressions="true" entry-point-ref="loginUrlAuthenticationEntryPoint"> 
    <security:intercept-url pattern="/**" access="isAuthenticated() and permitAll" /> 

    <custom-filter position="FORM_LOGIN_FILTER" ref="absoluteUrlFilter" /> 
</http> 

<entry-point-ref>元素似乎处理绝对网址默认情况下。

相关问题