Panneau latéral

Sommaire

Branchement avec le service d'authentification CAS

Afin d'adapter le contenu de cette page avec le nom de votre serveur, Mettez le nom du poste ici :

Nous allons modifier le mode d'authentification de l'IdP Shibboleth : l'authentification va être déléguée à un serveur d'authentification CAS. Dans le cadre de ce tutoriel, vous utiliserez un serveur CAS de test, mais par la suite vous pourrez le connecter avec le serveur CAS de votre organisme.

Serveur CAS JASIG versus Shibboleth IdP :
l'IdP Shibboleth 3.x a été conçu pour faciliter l'implémentation de protocoles autres que SAML, voir cette documentation. Il est livré avec une implémentation native du protocole CAS v2 et est donc une alternative à un serveur CAS JASIG. Un IdP Shibboleth 3.x peut donc proposer deux types de fonctionnalités CAS :
  • serveur CAS : nous n'avons pas évalué ces fonctionnalités du logiciel ;
  • client CAS : nous continuons à proposer une documentation permettant de configurer Shibboleth IdP en tant que client CAS.
Différence avec la version 2 : la mise en œuvre d'un client CAS avec un IdP Shibboleth 2.x consistait à utiliser un filtre CAS en amont du login handler de type RemoteUser. Avec la version 3 de l'IdP Shibboleth, cette possibilité est toujours envisageable, mais vous disposer d'un plugin CAS apportant un meilleur niveau d'intégration (fonctionnalités SAML préservées).

1. Configuration

Téléchargez et installez le plugin d'authentification CAS :

$> cd
$> wget https://github.com/Unicon/shib-cas-authn3/archive/3.3.0.tar.gz -O shib-cas-authn3-3.3.0.tar.gz
$> tar -zxf shib-cas-authn3-3.3.0.tar.gz
$> sudo cp shib-cas-authn3-3.3.0/IDP_HOME/edit-webapp/no-conversation-state.jsp /opt/shibboleth-idp/edit-webapp
$> wget https://github.com/Unicon/shib-cas-authn3/releases/download/3.3.0/shib-cas-authenticator-3.3.0.jar
$> sudo cp shib-cas-authenticator-3.3.0.jar /opt/shibboleth-idp/edit-webapp/WEB-INF/lib/
$> wget https://repo.maven.apache.org/maven2/org/jasig/cas/client/cas-client-core/3.6.1/cas-client-core-3.6.1.jar
$> sudo cp cas-client-core-3.6.1.jar /opt/shibboleth-idp/edit-webapp/WEB-INF/lib/

Modifiez le Web flow pour utiliser le plugin CAS :

/opt/shibboleth-idp/conf/idp.properties
**# Regular expression matching login flows to enable, e.g. IPAddress|Password**
**#idp.authn.flows= Password**
**idp.authn.flows = External**
 
**# CAS Client properties (usage loosely matches that of the Java CAS Client)**
**## CAS Server Properties**
**shibcas.casServerUrlPrefix = https://test-cas.federation.renater.fr/cas-formation**
**shibcas.casServerLoginUrl = ${shibcas.casServerUrlPrefix}/login**
 
**## Shibboleth Server Properties**
**shibcas.serverName = https://mon-poste.fr**

Activez les librairies Shibcas dans le fichier web.xml. Ce fichier n'étant pas par dfaut disponible dans le dossier d'édition de l'archive web (webapp), il faut commencer par le récupérer :

$> sudo cp /opt/shibboleth-idp/dist/webapp/WEB-INF/web.xml /opt/shibboleth-idp/edit-webapp/WEB-INF/

Editez à présent le fichier /opt/shibboleth-idp/edit-webapp/WEB-INF/web.xml

/opt/shibboleth-idp/edit-webapp/WEB-INF/web.xml
  [...]
  <!-- Servlet for receiving a callback from an external CAS Server and continues the IdP login flow -->
  <servlet>
      <servlet-name>ShibCas Auth Servlet</servlet-name>
      <servlet-class>net.unicon.idp.externalauth.ShibcasAuthServlet</servlet-class>
      <load-on-startup>2</load-on-startup>
  </servlet>
  <servlet-mapping>
      <servlet-name>ShibCas Auth Servlet</servlet-name>
      <url-pattern>/Authn/External/*</url-pattern>
  </servlet-mapping>
  [...]

Reconstruire le fichier idp.war et redémarrez le serveur Tomcat.

Le script build.sh commence par demander dans quelle arborescence compiler l'IdP (/opt/shibboleth-idp par défaut).
Vous pouvez donc appuyer sur “Entrée” une 2nde fois si le chemin vous convient.
$> cd /opt/shibboleth-idp
$> sudo -E ./bin/build.sh
Installation Directory: [/opt/shibboleth-idp]
** APPUYER SUR ENTREE **
Rebuilding /opt/shibboleth-idp/war/idp.war ...
...done

ILD SUCCESSFUL
''Total time: 14 seconds
# systemctl restart tomcat

Vous pouvez à présent re-tester votre IdP en accédant à nouveau à la ressource de test https://test-sp.federation.renater.fr/.

Authentification CAS : Vous serez redirigé vers le serveur CAS de test puisque nous avons configuré notre IdP pour utiliser ce serveur CAS. Utilisez l'identifiant/mot de passe = etudiant1/etudiant1. Ce compte de test transmet un ensemble d'attributs facilitant les tests, sous réserve de configurer la diffusion de plus d'attributs au niveau de l'IdP, voir plus haut.

Fichiers de configuration édités dans ce chapitre :
  • /opt/shibboleth-idp/flows/authn/
  • /opt/shibboleth-idp/edit-webapp/WEB-INF/lib/shib-cas-authenticator-3.0.0.jar
  • /opt/shibboleth-idp/edit-webapp/WEB-INF/lib/cas-client-core-3.3.3.jar
  • /opt/shibboleth-idp/conf/idp.properties
  • /opt/shibboleth-idp/conf/authn/general-authn.xml