Hi Ravi!
I find the solution in the past months for this problem.
My simple configuration files has been added to this email.

Best Regards,
Balazs

2010/5/13 Ravish Bhagdev <[email protected]>

> Hi,
>
> I have setup CAS with spring security for my application.  It seems to work
> fine except, I can't for the life of me figure out how I can logout.  When I
> close my browser this happens automatically and I am asked for password
> again.  But how do I create a hyperlink that will log me out completely?  I
> have tried invalidating the session in usual JSP way.  I have also added
> SingleSignOut filter as described here in my web.xml:
> http://www.ja-sig.org/wiki/display/CASC/Configuring+Single+Sign+Out
>
> I have tried calling URLs like:
> https://localhost:8080/myapp/j_spring_security_logout
> https://localhost:8080/cas/j_spring_security_logout
>
> but nothing really happens.  When I call https://localhost:8080/cas/logoutI 
> get a message saying you have been locked out and should close browser
> window for security reasons, but when I go back into myapp its still logged
> in.
>
> The only way to logout currently seems to be to close browser window.  Can
> anyone please give me some hits?
>
> I have attached my configuration files, I really need help on this.
>
> Thanks,
> Ravi
>
> --
> You are currently subscribed to [email protected] as: 
> [email protected]
> To unsubscribe, change settings or access archives, see 
> http://www.ja-sig.org/wiki/display/JSG/cas-user
>
>

-- 
You are currently subscribed to [email protected] as: 
[email protected]
To unsubscribe, change settings or access archives, see 
http://www.ja-sig.org/wiki/display/JSG/cas-user
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd";>

    <context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>/WEB-INF/applicationContext.xml</param-value>
    </context-param>
    <listener>
        <listener-class>
            org.springframework.web.context.ContextLoaderListener
        </listener-class>
    </listener>


    <filter>
        <filter-name>springSecurityFilterChain</filter-name>
        <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
    </filter>
    <filter-mapping>
        <filter-name>springSecurityFilterChain</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>
    <filter>
       <filter-name>CAS Single Sign Out Filter</filter-name>
       <filter-class>org.jasig.cas.client.session.SingleSignOutFilter</filter-class>
    </filter>
    <filter-mapping>
       <filter-name>CAS Single Sign Out Filter</filter-name>
       <url-pattern>/*</url-pattern>
    </filter-mapping>


    <context-param>
        <param-name>javax.faces.PROJECT_STAGE</param-name>
        <param-value>Development</param-value>
    </context-param>
    <servlet>
        <servlet-name>Faces Servlet</servlet-name>
        <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
        <servlet-name>Faces Servlet</servlet-name>
        <url-pattern>/faces/*</url-pattern>
    </servlet-mapping>

    <welcome-file-list>
        <welcome-file>index.xhtml</welcome-file>
    </welcome-file-list>
</web-app>
<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns="http://www.springframework.org/schema/security";
    xmlns:beans="http://www.springframework.org/schema/beans";
    xmlns:p="http://www.springframework.org/schema/p";
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
                        http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-2.0.xsd";>

<!--<annotation-driven/> -->
<global-method-security secured-annotations="enabled" />


<!-- auto-config="true" casProces../CasProces.. -->
<http entry-point-ref="casProcessingFilterEntryPoint">
    <!--<form-login login-page="/login.jsp"
    authentication-failure-url="/login.jsp?error=true" />
    <logout logout-success-url="/login.jsp" />
    <intercept-url pattern="/login.jsp" access="IS_AUTHENTICATED_ANONYMOUSLY" />  -->
    <intercept-url pattern="/**" access="ROLE_DB3" requires-channel="https"/>
    <logout logout-success-url="https://localhost:8181/cas/logout"; invalidate-session="false"/>
    <port-mappings>
        <port-mapping http="8080" https="8181"/>
    </port-mappings>
</http>

<beans:bean id="serviceProperties" class="org.springframework.security.ui.cas.ServiceProperties">
    <beans:property name="service" value="https://localhost:8181/CAS-JOSSO/j_spring_cas_security_check"/>
    <beans:property name="sendRenew" value="false"/>
</beans:bean>

<authentication-manager alias="authenticationManager"/>
<beans:bean id="casSingleSignOutFilter" class="org.jasig.cas.client.session.SingleSignOutFilter">
    <custom-filter before="CAS_PROCESSING_FILTER"/>
</beans:bean>
<beans:bean id="casProcessingFilter" class="org.springframework.security.ui.cas.CasProcessingFilter">
    <custom-filter after="CAS_PROCESSING_FILTER"/>
    <beans:property name="authenticationManager" ref="authenticationManager"/>
    <beans:property name="authenticationFailureUrl" value="/casfailed.jsp"/>
    <beans:property name="defaultTargetUrl" value="/"/>
</beans:bean>

<beans:bean id="casProcessingFilterEntryPoint"
    class="org.springframework.security.ui.cas.CasProcessingFilterEntryPoint">
    <beans:property name="loginUrl" value="https://localhost:8181/cas/login"/>
    <beans:property name="serviceProperties" ref="serviceProperties"/>
</beans:bean>

<!--<password-encoder hash="sha"/>-->
<beans:bean id="casAuthenticationProvider" class="org.springframework.security.providers.cas.CasAuthenticationProvider">
    <custom-authentication-provider />
    <beans:property name="userDetailsService" ref="userService"> <!--   -->
    </beans:property>
    <beans:property name="serviceProperties" ref="serviceProperties" />
    <beans:property name="ticketValidator">
        <beans:bean class="org.jasig.cas.client.validation.Cas20ServiceTicketValidator">
            <beans:constructor-arg index="0" value="https://localhost:8181/cas"; />
        </beans:bean>
    </beans:property>
    <beans:property name="key" value="b"/>
</beans:bean>


<jdbc-user-service id="userService" data-source-ref="administer"
                           users-by-username-query="SELECT email, password, 1 as enabled FROM userx WHERE email=?"
                           authorities-by-username-query="(SELECT email, 'ROLE_DB3' as authorities FROM userx where email=?)"
                           />

<!-- (SELECT users.u_login, auth.auth as authorities FROM users, auth WHERE users.u_login=? AND users.u_id=auth.u_id) UNION  -->
<beans:bean id="administer" class="org.springframework.jndi.JndiObjectFactoryBean">
    <beans:property name="jndiName" value="jdbc/administer" />
</beans:bean>

</beans:beans>

Reply via email to