2

別のログイン サイトを使用して、実行中の他の spring-security へのアクセスを認証し、シングル サインオンを作成しようとしています。

ただし、アプリケーションに接続するときに、最初はこの代替サイトにリダイレクトできません。

次のように applicationContext.xml を指定しています。

<http entry-point-ref="testProcessingFilterEntryPoint">
    <intercept-url pattern="/css/**" filters="none" />
    <intercept-url pattern="/login" filters="none" />
    <intercept-url pattern="/images/**" filters="none" />
    <intercept-url pattern="/favicon.ico" filters="none" />
    <intercept-url pattern="/**" access="ROLE_USER" />
    <form-login login-page="/login"
                authentication-failure-url="/login?login_error=1"
                default-target-url="/home"
                always-use-default-target="true" />
    <logout/>
</http>

<beans:bean id="testProcessingFilterEntryPoint" class="com.test.TESTAuthFilterEntryPoint">
    <beans:property name="loginUrl" value="https://example/login.cgi"/>
    <beans:property name="startUrl" value="/login.jsp"/>
    <beans:property name="otherParams" ref="otherParams"/>
</beans:bean>

<beans:bean id="otherParams" class="com.test.OtherParams">
    <beans:property name="pemFile" value="/data/test.pem"/>
    <beans:property name="cookieName" value="testCookie"/>
</beans:bean>

<beans:bean id="authenticationProcessingFilter" class="com.test.TESTAuthenticationProcessingFilter">
    <beans:constructor-arg index="0" type="java.lang.String" value="" /> 
    <beans:property name="authenticationManager" ref="authenticationManager"/>
    <beans:property name="authenticationFailureUrl" value="/login.jsp?login_error=1"/>
    <beans:property name="defaultTargetUrl" value="/"/>
    <beans:property name="filterProcessesUrl" value="/j_spring_security_check"/>
    <beans:property name="otherParams" ref="otherParams"/>
</beans:bean>

<authentication-manager alias="authenticationManager">
    <authentication-provider user-service-ref="userDetailsService"/>
</authentication-manager>   

基本的に、私の authenticationProcessingFilter は、次のように定義されたクラスを利用します。

public class TESTAuthenticationProcessingFilter extends AbstractAuthenticationProcessingFilter  {

そして、私の testProcessingFilterEntryPoint は次のように定義されたクラスを利用します:

public class TESTAuthFilterEntryPoint implements AuthenticationEntryPoint, InitializingBean {

発生すると想定されるのは、外部サイトにリダイレクトされ、認証され、生成された Cookie を確認して、このログインから生成された情報を処理する必要があるということです。最後に、この情報の一部がデータベースに保持されている他の情報と相関していることを確認してください。

ただし、これを開始すると、エラーは発生しません。それはちょうど開始し、Spring-Security の標準のログイン画面が表示されます。最初のリダイレクトを開始することはできません。TESTAuthFilterEntryPoint 内のメソッドに入ることさえありません。

@Override
commence(HttpServletRequest servletRequest, HttpServletResponse....)

サイドコメントとして、最小限のケースのように実行しても違いはありません。

<http>
    <http-basic/>
    <intercept-url pattern="/**" access="ROLE_ADMIN" />
</http>
<authentication-manager>
    <authentication-provider>
        <user-service>
            <user name="admin" password="kass" authorities="ROLE_ADMIN" />
        </user-service>
    </authentication-provider>
</authentication-manager>

標準のコア ログイン画面に進みます。

4

0 に答える 0