1
votes

Currently we are using jasig CAS server for SSO solution. We have two web application that is using same CAS server. We are using spring security for configuring CAS client. Sample code is like :

<bean id="springSecurityFilterChain" class="org.springframework.security.web.FilterChainProxy">
    <sec:filter-chain-map path-type="ant" >
        <sec:filter-chain pattern="/j_spring_security_logout(.jsp)*" filters="appLogoutFilter,exceptionTranslationFilter,filterSecurityInterceptor"/>
        <sec:filter-chain pattern="/**"
                          filters="securityContextPersistenceFilter,requestSingleLogoutFilter,appLogoutFilter,casAuthenticationFilter,requestCacheFilter,contextAwareFilter,exceptionTranslationFilter,filterSecurityInterceptor" />
    </sec:filter-chain-map>
</bean>

<sec:authentication-manager alias="authenticationManager">
    <sec:authentication-provider ref="casAuthenticationProvider" />
</sec:authentication-manager>


<bean id="casAuthenticationProvider" class="org.springframework.security.cas.authentication.CasAuthenticationProvider">
    <property name="authenticationUserDetailsService" ref="userDetailsServiceWrapper"/>
    <property name="serviceProperties" ref="serviceProperties" />
    <property name="ticketValidator" ref="ticketValidator"/>
    <property name="key" value="an_id_for_this_auth_provider_only"/>
</bean>


<bean id="userDetailsServiceWrapper" class="org.springframework.security.core.userdetails.UserDetailsByNameServiceWrapper">
    <property name="userDetailsService" ref="lormsSecurityUserDetailsService"/>
</bean>

<bean id="exceptionTranslationFilter" class="org.springframework.security.web.access.ExceptionTranslationFilter">
    <constructor-arg ref="casEntryPoint"/>
    <property name="accessDeniedHandler" ref="accessDeniedHandler"/>
</bean>

<bean id="appLogoutFilter" class="org.springframework.security.web.authentication.logout.LogoutFilter">
    <constructor-arg value="/j_spring_cas_security_logout"/>
    <constructor-arg>
        <list>
            <ref bean="lormsLogOutHandler"/>
        </list>
    </constructor-arg>
    <property name="logoutRequestMatcher">
        <bean class="org.springframework.security.web.util.matcher.RegexRequestMatcher">
            <constructor-arg name="pattern" value="/j_spring_security_logout(.jsp)*" />
            <constructor-arg name="httpMethod">
                <null/>
            </constructor-arg>
        </bean>
    </property>
</bean>

<!-- This filter redirects to the CAS Server to signal Single Logout should be performed ?service=${singleSignOn.cas.app.url}/LORMS -->
<bean id="requestSingleLogoutFilter"  class="org.springframework.security.web.authentication.logout.LogoutFilter">
    <constructor-arg value="${singleSignOn.cas.server.url}/logout?service=${singleSignOn.cas.app.url}/LORMS"/>
    <constructor-arg>
        <bean class= "org.springframework.security.web.authentication.logout.SecurityContextLogoutHandler"/>
    </constructor-arg>
    <property name="logoutRequestMatcher">
        <bean class="org.springframework.security.web.util.matcher.RegexRequestMatcher">
            <constructor-arg name="pattern" value="/j_spring_cas_security_logout(.jsp)*" />
            <constructor-arg name="httpMethod">
                <null/>
            </constructor-arg>
        </bean>
    </property>
</bean>

<bean class="org.jasig.cas.client.validation.Cas20ServiceTicketValidator" id="ticketValidator">
    <constructor-arg index="0" value="${singleSignOn.cas.server.url}" />
</bean>

<bean id="proxyGrantingTicketStorage" class="org.jasig.cas.client.proxy.ProxyGrantingTicketStorageImpl" />

<bean id="casAuthenticationFilter" class="org.springframework.security.cas.web.CasAuthenticationFilter">
    <property name="authenticationManager" ref="authenticationManager"/>
    <property name="authenticationSuccessHandler" ref="authenticationSuccessHandler"/>
</bean>

<bean id="casEntryPoint" class="org.springframework.security.cas.web.CasAuthenticationEntryPoint">
    <property name="loginUrl" value="${singleSignOn.cas.server.url}/login"/>
    <property name="serviceProperties" ref="serviceProperties"/>
</bean>

<bean id="serviceProperties" class="org.springframework.security.cas.ServiceProperties">
    <property name="service"  value="${singleSignOn.cas.app.url}/LORMS/j_spring_cas_security_check"/>
    <property name="sendRenew" value="false"/>
</bean>

Now I have existing form based login UI. I want to use same instead of using jasig web login screen. I found this link "Using CAS from external link or custom external form" using which I can use my login UI. Can anybody help me to integrate same with spring security in my application ?

1

1 Answers

0
votes

After you integrate your application.you can change and edit casviewpage.jsp.You can change all UI.You use default casview.jsp and edit it.Why dont want to edit casview.jsp?