Hi All,

I have configured two Jasig Cas 3.4.12 servers with jdbc support (mysql)
and JPA ticket registration.
I have other apache server that redirects users access urls to a tomcat
server on the same machine based on the relative url.
Apache server is configured with mod_auth_cas to 'protect' web applications
on my tomcat server.
Seems like the logout feature of the Cas server does not fully works on the
following scenario:

   - I am accessing to one of my 'protected' tomcat web application,
   http://mywebserver/app1
   - The request is redirected to the cas login page:
   https://casserver01:8443/cas/login?service=http%3a%2f%2fmywebserver%2fapp1
   - Login screen appears, authentication works perfectly and I am being
   redirected back to my desired app1.
   - I am trying to access other 'protected' web apps (app2, app3) on the
   very same server and the single sign on work well.
   - Now, I want to log out, so that on the next time I will access app1 it
   will ask me to login again (without closing and reopening the web browser).
   - I am logging out,  https://casserver01:8443/cas/logout
   - Cas prompts that I have successfully logged out.
   - I am trying to access the Cas server login page directly, '
   https://casserver01:8443/cas/login'    and it actually shows the login
   screen (as If i was really logged out).
   - When I am accessing my app1 again, 'http://mywebserver/app1' , I would
   expect it to be redirected to the Cas login page again, but it just lets me
   go in to my web application without prompting a thing.
   - Again, I manually access the Cas server login page directly , '
   https://casserver01:8443/cas/login' , and it does shows the login page

Does anyone knows whats going on??

Maybe I am not using the 'logout' feature right? maybe I need to pass some
arguments along with the url I mentioned? some session parameters maybe?

I am attaching my 'cas.properties', 'deployerConfigContext.xml'  and
'ticketRegistry.xml' files.


Any help will be deeply appreciated!

Thanks!
-- 
*
Ronen Itkin*
Taykey | www.taykey.com

-- 
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

Attachment: cas.properties
Description: Binary data

<?xml version="1.0" encoding="UTF-8"?>
<!--
	| deployerConfigContext.xml centralizes into one file some of the declarative configuration that
	| all CAS deployers will need to modify.
	|
	| This file declares some of the Spring-managed JavaBeans that make up a CAS deployment.  
	| The beans declared in this file are instantiated at context initialization time by the Spring 
	| ContextLoaderListener declared in web.xml.  It finds this file because this
	| file is among those declared in the context parameter "contextConfigLocation".
	|
	| By far the most common change you will need to make in this file is to change the last bean
	| declaration to replace the default SimpleTestUsernamePasswordAuthenticationHandler with
	| one implementing your approach for authenticating usernames and passwords.
	+-->
<beans xmlns="http://www.springframework.org/schema/beans";
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
       xmlns:p="http://www.springframework.org/schema/p";
       xmlns:sec="http://www.springframework.org/schema/security";
       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
       http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.0.xsd";>
	<!--
		| This bean declares our AuthenticationManager.  The CentralAuthenticationService service bean
		| declared in applicationContext.xml picks up this AuthenticationManager by reference to its id, 
		| "authenticationManager".  Most deployers will be able to use the default AuthenticationManager
		| implementation and so do not need to change the class of this bean.  We include the whole
		| AuthenticationManager here in the userConfigContext.xml so that you can see the things you will
		| need to change in context.
		+-->
	<bean id="authenticationManager"
		class="org.jasig.cas.authentication.AuthenticationManagerImpl">
		<!--
			| This is the List of CredentialToPrincipalResolvers that identify what Principal is trying to authenticate.
			| The AuthenticationManagerImpl considers them in order, finding a CredentialToPrincipalResolver which 
			| supports the presented credentials.
			|
			| AuthenticationManagerImpl uses these resolvers for two purposes.  First, it uses them to identify the Principal
			| attempting to authenticate to CAS /login .  In the default configuration, it is the DefaultCredentialsToPrincipalResolver
			| that fills this role.  If you are using some other kind of credentials than UsernamePasswordCredentials, you will need to replace
			| DefaultCredentialsToPrincipalResolver with a CredentialsToPrincipalResolver that supports the credentials you are
			| using.
			|
			| Second, AuthenticationManagerImpl uses these resolvers to identify a service requesting a proxy granting ticket. 
			| In the default configuration, it is the HttpBasedServiceCredentialsToPrincipalResolver that serves this purpose. 
			| You will need to change this list if you are identifying services by something more or other than their callback URL.
			+-->
		<property name="credentialsToPrincipalResolvers">
			<list>
				<!--
					| UsernamePasswordCredentialsToPrincipalResolver supports the UsernamePasswordCredentials that we use for /login 
					| by default and produces SimplePrincipal instances conveying the username from the credentials.
					| 
					| If you've changed your LoginFormAction to use credentials other than UsernamePasswordCredentials then you will also
					| need to change this bean declaration (or add additional declarations) to declare a CredentialsToPrincipalResolver that supports the
					| Credentials you are using.
					+-->
				<bean
					class="org.jasig.cas.authentication.principal.UsernamePasswordCredentialsToPrincipalResolver" />
				<!--
					| HttpBasedServiceCredentialsToPrincipalResolver supports HttpBasedCredentials.  It supports the CAS 2.0 approach of
					| authenticating services by SSL callback, extracting the callback URL from the Credentials and representing it as a
					| SimpleService identified by that callback URL.
					|
					| If you are representing services by something more or other than an HTTPS URL whereat they are able to
					| receive a proxy callback, you will need to change this bean declaration (or add additional declarations).
					+-->
				<bean
					class="org.jasig.cas.authentication.principal.HttpBasedServiceCredentialsToPrincipalResolver" />
			</list>
		</property>

		<!--
			| Whereas CredentialsToPrincipalResolvers identify who it is some Credentials might authenticate, 
			| AuthenticationHandlers actually authenticate credentials.  Here we declare the AuthenticationHandlers that
			| authenticate the Principals that the CredentialsToPrincipalResolvers identified.  CAS will try these handlers in turn
			| until it finds one that both supports the Credentials presented and succeeds in authenticating.
			+-->
                <property name="authenticationHandlers">
                        <list>
                                <!--
                                        | This is the authentication handler that authenticates services by means of callback via SSL, thereby validating
                                        | a server side SSL certificate.
                                        +-->
                                <bean class="org.jasig.cas.authentication.handler.support.HttpBasedServiceCredentialsAuthenticationHandler"
                                        p:httpClient-ref="httpClient" />
                                <!--
                                        | This is the authentication handler declaration that every CAS deployer will need to change before deploying CAS
                                        | using jdbc 
                                        +-->
                                <bean class="org.jasig.cas.adaptors.jdbc.SearchModeSearchDatabaseAuthenticationHandler">
                                        <property name="tableUsers">
                                                <value>${database.users.table}</value>
                                        </property>
                                        <property name="fieldUser">
                                                <value>${database.users.field.user}</value>
                                        </property>
                                        <property name="fieldPassword">
                                                <value>${database.users.field.password}</value>
                                        </property>
                                        <property name="dataSource" ref="dataSource"/>
                                        <property name="passwordEncoder" ref="md5PasswordEncoder"/>
                                </bean>
                        </list>
                </property>
	</bean>


	<!--
	This bean defines the security roles for the Services Management application.  Simple deployments can use the in-memory version.
	More robust deployments will want to use another option, such as the Jdbc version.
	
	The name of this should remain "userDetailsService" in order for Spring Security to find it.
	 -->
    <!-- <sec:user name="@@THIS SHOULD BE REPLACED@@" password="notused" authorities="ROLE_ADMIN" />-->

    <sec:user-service id="userDetailsService">
        <sec:user name="@@THIS SHOULD BE REPLACED@@" password="notused" authorities="ROLE_ADMIN" />
    </sec:user-service>
	
	<!-- 
	Bean that defines the attributes that a service may return.  This example uses the Stub/Mock version.  A real implementation
	may go against a database or LDAP server.  The id should remain "attributeRepository" though.
	 -->
	<bean id="attributeRepository"
		class="org.jasig.services.persondir.support.StubPersonAttributeDao">
		<property name="backingMap">
			<map>
				<entry key="uid" value="uid" />
				<entry key="eduPersonAffiliation" value="eduPersonAffiliation" /> 
				<entry key="groupMembership" value="groupMembership" />
			</map>
		</property>
	</bean>
	
	<!-- 
	Sample, in-memory data store for the ServiceRegistry. A real implementation
	would probably want to replace this with the JPA-backed ServiceRegistry DAO
	The name of this bean should remain "serviceRegistryDao".
	 -->
	<bean
		id="serviceRegistryDao"
        class="org.jasig.cas.services.InMemoryServiceRegistryDaoImpl">
            <property name="registeredServices">
                <list>
                    <bean class="org.jasig.cas.services.RegexRegisteredService">
                        <property name="id" value="0" />
                        <property name="name" value="HTTP and IMAP" />
                        <property name="description" value="Allows HTTP(S) and IMAP(S) protocols" />
                        <property name="serviceId" value="^(https?|imaps?)://.*" />
                        <property name="evaluationOrder" value="10000001" />
                    </bean>
                    <!--
                    Use the following definition instead of the above to further restrict access
                    to services within your domain (including subdomains).
                    Note that example.com must be replaced with the domain you wish to permit.
                    -->
                    <!--
                    <bean class="org.jasig.cas.services.RegexRegisteredService">
                        <property name="id" value="1" />
                        <property name="name" value="HTTP and IMAP on example.com" />
                        <property name="description" value="Allows HTTP(S) and IMAP(S) protocols on example.com" />
                        <property name="serviceId" value="^(https?|imaps?)://([A-Za-z0-9_-]+\.)*example\.com/.*" />
                        <property name="evaluationOrder" value="0" />
                    </bean>
                    -->
                </list>
            </property>
        </bean>

    <bean id="auditTrailManager" class="com.github.inspektr.audit.support.Slf4jLoggingAuditTrailManager" />
        <!-- Data source definition -->
    <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
    	<property name="driverClassName">
		<value>${database.driver}</value>
    	</property>
    	<property name="url">
    		<value>${database.url}</value>
    	</property>
    	<property name="username">
    		<value>${database.username}</value>
    	</property>
    	<property name="password">
    		<value>${database.password}</value>
    	</property>
        <!-- Following lines solves the 8 hours idle connection close problem -->
        <!-- The chosen time is every 2 hours (7200 seconds)-->
        <property name="testWhileIdle" value="true"/>
        <property name="timeBetweenEvictionRunsMillis" value="7200000"/>
        <property name="minEvictableIdleTimeMillis" value="7200000"/>
        <property name="validationQuery" value="SELECT 1"/>
    </bean>
    <bean id="md5PasswordEncoder" class="org.jasig.cas.authentication.handler.DefaultPasswordEncoder">
    	<constructor-arg index="0">
    		<value>MD5</value>
    	</constructor-arg>
    </bean>
</beans>
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans";
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
       xmlns:p="http://www.springframework.org/schema/p";
       xmlns:tx="http://www.springframework.org/schema/tx";
       xsi:schemaLocation="
         http://www.springframework.org/schema/beans
         http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
         http://www.springframework.org/schema/tx
         http://www.springframework.org/schema/tx/spring-tx-3.0.xsd"; >
 
  <description>
    Configuration for the Jpa TicketRegistry which stores the tickets in a
database and cleans them out at specified intervals.
  </description>
 
  <!-- Ticket Registry -->
  <bean id="ticketRegistry" class="org.jasig.cas.ticket.registry.JpaTicketRegistry" />
 
  <!--
    Injects EntityManager/Factory instances into beans with
    @PersistenceUnit and @PersistenceContext
  -->
  <bean class="org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor"/>
 
  <!-- Use the following for versions prior to 3.4.11 -->
  <!--
  <bean id="ticketRegistry"
    class="org.jasig.cas.ticket.registry.JpaTicketRegistry">
    <constructor-arg index="0" ref="entityManagerFactory" />
  </bean>
  -->
 
  <bean id="entityManagerFactory"
    class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
    <property name="dataSource" ref="dataSource"/>
    <property name="jpaVendorAdapter">
      <bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
        <property name="generateDdl" value="true"/>
        <property name="showSql" value="true" />
      </bean>
    </property>
    <property name="jpaProperties">
      <props>
        <!-- Use MySQLDialect at your own risk.  See MySQL section below for details. -->
        <prop key="hibernate.dialect">org.hibernate.dialect.MySQLInnoDBDialect</prop>
        <prop key="hibernate.hbm2ddl.auto">update</prop>
      </props>
    </property>
  </bean>
 
  <bean id="transactionManager"
    class="org.springframework.orm.jpa.JpaTransactionManager"
    p:entityManagerFactory-ref="entityManagerFactory" />
 
  <tx:annotation-driven transaction-manager="transactionManager" />

  <!-- Data source definition -->
  <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
        <property name="driverClassName">
                <value>${database.driver}</value>
        </property>
        <property name="url">
                <value>${database.url}</value>
        </property>
        <property name="username">
                <value>${database.username}</value>
        </property>
        <property name="password">
                <value>${database.password}</value>
        </property>
	<!-- Following lines solves the 8 hours idle connection close problem -->
	<!-- The chosen time is every 2 hours (7200 seconds)-->
	<property name="testWhileIdle" value="true"/>
	<property name="timeBetweenEvictionRunsMillis" value="7200000"/>
	<property name="minEvictableIdleTimeMillis" value="7200000"/>
	<property name="validationQuery" value="SELECT 1"/>
  </bean>

  <!-- TICKET REGISTRY CLEANER -->
  <bean id="ticketRegistryCleaner"
    class="org.jasig.cas.ticket.registry.support.DefaultTicketRegistryCleaner"
    p:ticketRegistry-ref="ticketRegistry"
    p:lock-ref="cleanerLock" />
 
  <!--
   Use JpaLockingStrategy for 3.4.11 and later.
   This bean is only needed for HA setups where multiple nodes are attempting
   cleanup on a shared database, but it doesn't substantially impact performance
   and is easy to setup and is therefore recommended for all JpaTicketRegistry deployments.
   This component automatically creates the LOCKS table so no further configuration
   is required.
  -->
  <bean id="cleanerLock"
    class="org.jasig.cas.ticket.registry.support.JpaLockingStrategy"
    p:uniqueId="${host.name}"
    p:applicationId="cas-ticket-registry-cleaner" />
 
  <!--
    Use JdbcLockingStrategy on 3.4.10 and before for HA setups where multiple nodes are attempting
    cleanup on a shared database.  This bean requires additional configuration:
     1. Creation of LOCKS table (see below)
     2. Setting ticket.cleaner.database.platform property
    Note that the ticket.cleaner.database.platform property should be set in cas.properties
    or some other properties file that is loaded by a PropertyPlaceholderConfigurer bean in
    the Spring context.
    Allowed values for ticket.cleaner.database.platform:
      * SqlServer for Microsoft SQL Server
      * HSQL for HSQLDB
      * SQL92 for any platform that supports the SQL-92 FOR UPDATE clause. (e.g. PostgreSQL, Oracle)
  -->
  <!--
  <bean id="cleanerLock"
    class="org.jasig.cas.ticket.registry.support.JdbcLockingStrategy"
    p:uniqueId="${host.name}"
    p:platform="${ticket.cleaner.database.platform}"
    p:applicationId="cas-ticket-registry-cleaner"
    p:dataSource-ref="dataSource" />
  -->
 
  <bean id="ticketRegistryCleanerJobDetail"
    class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean"
    p:targetObject-ref="ticketRegistryCleaner"
    p:targetMethod="clean" />
 
  <bean id="periodicTicketRegistryCleanerTrigger"
    class="org.springframework.scheduling.quartz.SimpleTriggerBean"
    p:jobDetail-ref="ticketRegistryCleanerJobDetail"
    p:startDelay="20000"
    p:repeatInterval="1800000" />
</beans>

Reply via email to