Thanks to you and Matt. It does look like CAS will do the trick.

Samuel Alfonso Velázquez Díaz wrote:

After checking the URLs about Yale CAS and acegi I also did for Appfuse 1.9.3:

   1. Chage the security.xml file to use cas authentication
   2. Include CAS java client into the build of appfuse app.
   3. Setup tomcat with SSL
      (http://tomcat.apache.org/tomcat-5.5-doc/ssl-howto.html)
   4. Setup JVM client certificate
         1. You have to add your certificate to the JSSE trust store
            more about this in:
            
http://forum.java.sun.com/thread.jspa?threadID=656259&messageID=3858486
         2. Check that the certificate has the correct hostname while
            using keytool to generate it
            (http://tp.its.yale.edu/pipermail/cas/2005-June/001266.html)

For step 1 I’m attaching a revision that is working, notice that has some tokens that will be replaced during the ant build process, it is a basic configuration but it works fine.

Cheers,

Samuel.

------------------------------------------------------------------------

*From:* Matt Raible [mailto:[EMAIL PROTECTED]
*Sent:* Martes, 05 de Diciembre de 2006 05:50 p.m.
*To:* [email protected]
*Subject:* Re: [appfuse-user] Single Sign On with Tomcat

Have you looked at CAS and integrating Acegi with it?

http://www.ja-sig.org/products/cas/

http://www.acegisecurity.org/docbook/acegi.html#cas <http://www.acegisecurity.org/docbook/acegi.html#cas>

Matt

On 12/5/06, *Brett Knights* <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>> wrote:

Hello,

I have two Appfuse based webapps that I'd like integrated at the sign-on
level. Can anyone point me at a tutorial or link that would work for
doing this with Appfuse 1.9.4?

Thanks

Brett Knights

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>




--
http://raibledesigns.com

------------------------------------------------------------------------

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN"
    "http://www.springframework.org/dtd/spring-beans.dtd";>

<beans>

    <!-- ======================== FILTER CHAIN ======================= -->
    <bean id="filterChainProxy" class="org.acegisecurity.util.FilterChainProxy">
        <property name="filterInvocationDefinitionSource">
            <value>
                CONVERT_URL_TO_LOWERCASE_BEFORE_COMPARISON
                PATTERN_TYPE_APACHE_ANT
                
/**=httpSessionContextIntegrationFilter,logoutFilter,authenticationProcessingFilter,securityContextHolderAwareRequestFilter,rememberMeProcessingFilter,anonymousProcessingFilter,exceptionTranslationFilter,filterInvocationInterceptor
            </value>
            <!-- Put channelProcessingFilter before 
securityContextHolderAwareRequestFilter to turn on SSL switching -->
            <!-- It's off by default b/c Canoo WebTest doesn't support SSL 
out-of-the-box -->
        </property>
    </bean>
<bean id="httpSessionContextIntegrationFilter" class="org.acegisecurity.context.HttpSessionContextIntegrationFilter"/> <bean id="logoutFilter" class="org.acegisecurity.ui.logout.LogoutFilter">
        <constructor-arg value="/index.jsp"/> <!-- URL redirected to after logout 
-->
        <constructor-arg>
            <list>
                <ref bean="rememberMeServices"/>
                <bean 
class="org.acegisecurity.ui.logout.SecurityContextLogoutHandler"/>
            </list>
        </constructor-arg>
        <property name="filterProcessesUrl" value="/logout.jsp"/>
    </bean>
<!-- <bean id="authenticationProcessingFilter" class="org.acegisecurity.ui.webapp.AuthenticationProcessingFilter">
        <property name="authenticationManager" ref="authenticationManager"/>
        <property name="authenticationFailureUrl" 
value="/login.jsp?error=true"/>
        <property name="defaultTargetUrl" value="/"/>
        <property name="filterProcessesUrl" value="/j_security_check"/>
        <property name="rememberMeServices" ref="rememberMeServices"/>
    </bean> -->
<bean id="securityContextHolderAwareRequestFilter" class="org.acegisecurity.wrapper.SecurityContextHolderAwareRequestFilter"/> <bean id="rememberMeProcessingFilter" class="org.acegisecurity.ui.rememberme.RememberMeProcessingFilter">
        <property name="authenticationManager" ref="authenticationManager"/>
        <property name="rememberMeServices" ref="rememberMeServices"/>
    </bean>
<bean id="anonymousProcessingFilter" class="org.acegisecurity.providers.anonymous.AnonymousProcessingFilter">
        <property name="key" value="anonymous"/>
        <property name="userAttribute" value="anonymous,ROLE_ANONYMOUS"/>
    </bean>
<!-- CAS Configuration START -->
    <bean id="casAuthenticationProvider"
        class="org.acegisecurity.providers.cas.CasAuthenticationProvider">
        <property name="ticketValidator">
                <ref bean="ticketValidator" />
        </property>
        <property name="casProxyDecider">
                <ref bean="casProxyDecider" />
        </property>
        <property name="statelessTicketCache">
                <ref bean="statelessTicketCache" />
        </property>
        <property name="casAuthoritiesPopulator">
                <ref bean="casAuthoritiesPopulator" />
        </property>
        <property name="key">
                <value>some_unique_key</value>
        </property>
    </bean>
<bean id="ticketValidator"
        
class="org.acegisecurity.providers.cas.ticketvalidator.CasProxyTicketValidator">
        <property name="casValidate">
                <value>@CAS-URL@/cas/proxyValidate</value>
        </property>
        <property name="serviceProperties">
                <ref bean="serviceProperties" />
        </property>
    </bean>

    <bean id="serviceProperties"
        class="org.acegisecurity.ui.cas.ServiceProperties">
        <property name="service">
                <!-- The service property specifies a URL that CAS should send the 
user to after login -->
                <value>@CAS-URL@/@APPNAME@/j_security_check</value>
        </property>
    </bean>
<bean id="casProxyDecider" class="org.acegisecurity.providers.cas.proxy.RejectProxyTickets"/>
    <!-- <bean id="casProxyDecider" 
class="org.acegisecurity.providers.cas.proxy.AcceptAnyCasProxy"/> -->

    <bean id="statelessTicketCache"
        class="org.acegisecurity.providers.cas.cache.EhCacheBasedTicketCache" >
                <property name="cache">
                        <bean
                                
class="org.springframework.cache.ehcache.EhCacheFactoryBean">
                                <property name="cacheManager">
                                        <bean
                                                
class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean" />
                                </property>
                                <property name="cacheName" 
value="statelessTicketCache" />
                        </bean>
                </property>
<!-- <property name="cache">
                        <ref bean="userCache"/>
                </property>
                 -->
<!-- <property name="minutesToIdle">
                        <value>20</value>
                        </property>-->
    </bean>
<bean id="casAuthoritiesPopulator"
        
class="org.acegisecurity.providers.cas.populator.DaoCasAuthoritiesPopulator">
        <property name="userDetailsService" ref="userDao"/>
        <!--  <property name="authenticationDao">
                <ref bean="inMemoryDaoImpl" />
        </property> -->
    </bean>

    <bean id="exceptionTranslationFilter" 
class="org.acegisecurity.ui.ExceptionTranslationFilter">
        <property name="authenticationEntryPoint">
            <!-- <bean 
class="org.acegisecurity.ui.webapp.AuthenticationProcessingFilterEntryPoint">
                <property name="loginFormUrl" value="/login.jsp"/>
                <property name="forceHttps" value="false"/>
            </bean> -->
                <bean 
class="org.acegisecurity.ui.cas.CasProcessingFilterEntryPoint">
                        <property name="loginUrl">
                                <value>@CAS-URL@/cas/login</value>
                        </property>
                        <property name="serviceProperties">
                                <ref bean="serviceProperties" />
                        </property>
                </bean>
        </property>
    </bean>
<bean id="authenticationProcessingFilter" class="org.acegisecurity.ui.cas.CasProcessingFilter">
        <property name="authenticationManager" ref="authenticationManager"/>
        <property name="authenticationFailureUrl" 
value="/login.jsp?error=true"/>
        <property name="defaultTargetUrl" value="/"/>
        <property name="filterProcessesUrl" value="/j_security_check"/>
        <property name="rememberMeServices" ref="rememberMeServices"/>
    </bean>
<!-- CAS Configuration END --> <bean id="filterInvocationInterceptor" class="org.acegisecurity.intercept.web.FilterSecurityInterceptor">
        <property name="authenticationManager" ref="authenticationManager"/>
        <property name="accessDecisionManager" ref="accessDecisionManager"/>
        <property name="objectDefinitionSource">
            <value>
                PATTERN_TYPE_APACHE_ANT
                /clickstreams.jsp*=admin
                /flushCache.*=admin
                /passwordHint.html*=ROLE_ANONYMOUS,admin,user
                /reload.*=admin
                /signup.html*=ROLE_ANONYMOUS,admin,user
                /users.html*=admin
                /**/*.html*=admin,user
            </value>
        </property>
    </bean>
<bean id="accessDecisionManager" class="org.acegisecurity.vote.AffirmativeBased">
        <property name="allowIfAllAbstainDecisions" value="false"/>
        <property name="decisionVoters">
            <list>
                <bean class="org.acegisecurity.vote.RoleVoter">
                    <property name="rolePrefix" value=""/>
                </bean>
            </list>
        </property>
    </bean>
<bean id="rememberMeServices" class="org.acegisecurity.ui.rememberme.TokenBasedRememberMeServices"> <property name="userDetailsService" ref="userDao"/>
        <property name="key" value="appfuseRocks"/>
        <property name="parameter" value="rememberMe"/>
</bean> <bean id="authenticationManager" class="org.acegisecurity.providers.ProviderManager">
        <property name="providers">
            <list>
                <ref local="casAuthenticationProvider"/>
                <!-- <ref local="daoAuthenticationProvider"/> -->
                <ref local="anonymousAuthenticationProvider"/>
                <ref local="rememberMeAuthenticationProvider"/>
            </list>
        </property>
    </bean>
<bean id="daoAuthenticationProvider" class="org.acegisecurity.providers.dao.DaoAuthenticationProvider">
         <property name="userDetailsService" ref="userDao"/>
         <property name="userCache" ref="userCache"/>
         <property name="passwordEncoder" ref="passwordEncoder"/>
    </bean>

    <bean id="anonymousAuthenticationProvider" 
class="org.acegisecurity.providers.anonymous.AnonymousAuthenticationProvider">
        <property name="key" value="anonymous"/>
    </bean>

    <bean id="rememberMeAuthenticationProvider" 
class="org.acegisecurity.providers.rememberme.RememberMeAuthenticationProvider">
        <property name="key" value="appfuseRocks"/>
    </bean>

    <!-- This bean definition must be available to ApplicationContext.getBean() 
so StartupListener
         can look for it and detect if password encryption is turned on or not 
-->
    <bean id="passwordEncoder" 
class="org.acegisecurity.providers.encoding.ShaPasswordEncoder"/>

    <!-- This bean is optional; it isn't used by any other bean as it only listens 
and logs -->
    <bean id="loggerListener" 
class="org.acegisecurity.event.authentication.LoggerListener"/>

    <!-- Override 'userManager' bean definition to add userManagerSecurity 
interceptor -->
    <bean id="userManager" parent="txProxyTemplate">
        <property name="target">
            <bean class="[EMAIL PROTECTED]@.service.impl.UserManagerImpl">
                <property name="userDao" ref="userDao"/>
            </bean>
        </property>
        <!-- Override default transaction attributes b/c of UserExistsException 
-->
        <property name="transactionAttributes">
            <props>
                <prop 
key="save*">PROPAGATION_REQUIRED,-UserExistsException</prop>
                <prop key="remove*">PROPAGATION_REQUIRED</prop>
                <prop key="*">PROPAGATION_REQUIRED,readOnly</prop>
            </props>
        </property>
        <property name="preInterceptors">
            <list>
                <ref bean="userSecurityInterceptor"/>
                <ref bean="userManagerSecurity"/>
            </list>
        </property>
    </bean>

    <bean id="userManagerSecurity" 
class="org.acegisecurity.intercept.method.aopalliance.MethodSecurityInterceptor">
        <property name="authenticationManager" ref="authenticationManager"/>
        <property name="accessDecisionManager" ref="accessDecisionManager"/>
        <property name="objectDefinitionSource">
             <value>
                 [EMAIL PROTECTED]@.service.UserManager.getUsers=admin
                 [EMAIL PROTECTED]@.service.UserManager.removeUser=admin
             </value>
        </property>
    </bean>
<!-- SSL Switching: to use this, configure it in the filterChainProxy bean -->
    <bean id="channelProcessingFilter" 
class="org.acegisecurity.securechannel.ChannelProcessingFilter">
        <property name="channelDecisionManager" ref="channelDecisionManager"/>
        <property name="filterInvocationDefinitionSource">
            <value>
                PATTERN_TYPE_APACHE_ANT
                /admin/**=REQUIRES_SECURE_CHANNEL
                /login*=REQUIRES_SECURE_CHANNEL
                /j_security_check*=REQUIRES_SECURE_CHANNEL
                /editProfile.html*=REQUIRES_SECURE_CHANNEL
                /signup.html*=REQUIRES_SECURE_CHANNEL
                /saveUser.html*=REQUIRES_SECURE_CHANNEL
                /**=REQUIRES_INSECURE_CHANNEL
            </value>
        </property>
    </bean>

    <bean id="channelDecisionManager" 
class="org.acegisecurity.securechannel.ChannelDecisionManagerImpl">
        <property name="channelProcessors">
            <list>
                <bean 
class="org.acegisecurity.securechannel.SecureChannelProcessor"/>
                <bean 
class="org.acegisecurity.securechannel.InsecureChannelProcessor"/>
            </list>
        </property>
    </bean>
</beans>

------------------------------------------------------------------------

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to