CAS et Kerberos
Pages enfant
  • Installation et configuration du serveur CAS (archive)

Comparaison des versions

Légende

  • Ces lignes ont été ajoutées. Ce mot a été ajouté.
  • Ces lignes ont été supprimées. Ce mot a été supprimé.
  • La mise en forme a été modifiée.

...

Dans le fichier src/main/webapp/WEB-INF/deployerConfigContext.xml, ajouter le bean suivant pour déclarer le contexte LDAP :

Bloc de code
xml
xml
<bean id="contextSource" class="org.springframework.ldap.core.support.LdapContextSource">
  <property name="pooled" value="true"/>
  <property name="urls">
    <list>
      <value>ldap://ldapglobal.univ-rennes1.fr/</value>
    </list>
  </property>
  <property name="userDn" value=""/>
  <property name="password" value=""/>
  <property name="baseEnvironmentProperties">
    <map>
      <entry>
       <key>
         <value>java.naming.security.authentication</value>
       </key>
       <value>simple</value>
      </entry>
     </map>
  </property>
</bean>

puis changer le handler SimpleTestUsernamePasswordAuthenticationHandler par celui-ci :

Bloc de code
xml
xml
<bean
   class="org.jasig.cas.adaptors.ldap.FastBindLdapAuthenticationHandler" >
     <property name="filter" value="uid=%u,ou=people,dc=univ-rennes1,dc=fr" />
     <property name="contextSource" ref="contextSource" />
</bean>

...

Editer le fichier <cas-home>/cas-server-webapp/pom.xml et ajouter la dépendance suivante (par exemple juste après la dépendance vers le module cas-server-support-ldap) :

Bloc de code
xml
xml
<dependency>
<groupId>org.jasig.cas</groupId>
<artifactId>cas-server-support-trusted</artifactId>

<version>${project.version}</version>
</dependency>

...

Editer le fichier <cas-home>/cas-server-webapp/src/main/webapp/WEB-INF/login-webflow.xml et ajouter l'état suivant juste avant l'état viewLoginForm :

Bloc de code
xml
xml
<action-state id="remoteAuthenticate">
<action bean="principalFromRemoteAction" />
<transition on="success" to="sendTicketGrantingTicket" />
<transition on="error" to="viewLoginForm" />
</action-state>

Dans ce même fichier, remplacer les références à viewLoginForm par remoteAuthenticate pour les trois decision-state gatewayRequestCheck, renewRequestCheck et generateServiceTicket :

Bloc de code
xml
xml
<decision-state id="gatewayRequestCheck">
  <if
    test="${externalContext.requestParameterMap['gateway'] != '' &amp;&amp; externalContext.requestParameterMap['gateway'] != null &amp;&amp; flowScope.service != null}"
    then="redirect"
    else="remoteAuthenticate" />
</decision-state>
Bloc de code
xml
xml
<decision-state id="renewRequestCheck">
  <if
    test="${externalContext.requestParameterMap['renew'] != '' &amp;&amp; externalContext.requestParameterMap['renew'] != null}"
    then="remoteAuthenticate"
    else="generateServiceTicket" />
</decision-state>
Bloc de code
xml
xml
<action-state id="generateServiceTicket">
  <action bean="generateServiceTicketAction" />
  <transition on="success" to ="warn" />
  <transition on="error" to="remoteAuthenticate" />
  <transition on="gateway" to="redirect" />
</action-state>

Déclarer le bean implémentant le nouvel état du webflow en ajoutant les lignes suivantes dans le fichier <cas-home>/cas-server-webapp/src/main/webapp/WEB-INF/cas-servlet.xml :

Bloc de code
xml
xml
<bean
  id="principalFromRemoteAction"
  class="org.jasig.cas.adaptors.trusted.web.flow.PrincipalFromRequestRemoteUserNonInteractiveCredentialsAction"
  p:centralAuthenticationService-ref="centralAuthenticationService" />

...

  • PrincipalBearingCredentialsToPrincipalResolver après les resolvers existants de credentialsToPrincipalResolvers
  • PrincipalBearingCredentialsAuthenticationHandler avant les handlers existants de authenticationHandlers
Bloc de code
xml
xml
<bean id="authenticationManager" class="org.jasig.cas.authentication.AuthenticationManagerImpl">
<property name="credentialsToPrincipalResolvers">
<list>
<!--  ... the others credentialsToPrincipalResolvers ... -->
<bean class="org.jasig.cas.adaptors.trusted.authentication.principal.PrincipalBearingCredentialsToPrincipalResolver" />
</list>
</property>
<property name="authenticationHandlers">
<list>
<bean class="org.jasig.cas.adaptors.trusted.authentication.handler.support.PrincipalBearingCredentialsAuthenticationHandler" />
<!--  ... the others authenticationHandlers... -->
</list>
</property>
</bean>

Test

ça doit marcher...