| Remarque | ||
|---|---|---|
| ||
Shib |
Esup-commons n'authentifie pas les utilisateurs en tant que tel. Il est en revanche capable, en s'appuyant sur un service d'authentification externe, de savoir quel est l'utilisateur connecté à l'application web en cours.
Plusieurs moyens sont possibles pour cela. esup-commons s'appuie sur un service d'authentification externe, le bean authenticationService, pour authentifier les utilisateurs. Ce bean, qui doit implémenter l'interface AuthenticationService, possède une méthode getCurrentUserId(), qui renvoie l'identifiant de l'utilisateur courant.Le bean authenticationService est défini dans /properties/auth/auth.xml. Plusieurs classes implémentant l'interface AuthenticationService sont disponibles dans le package org.esupportail.commons.services.authentication, elles sont décrites ci après.
| Remarque |
|---|
Dans les applications d'exemples ESUP-Commons ainsi que dans les archétypes, en plus d'une implémentation de AuthenticationService, on va aussi trouvé un bean métier, nommé authenticator, auquel on va injecter l'authenticationService dont le but sera de transformer l'objet AuthInfo obtenu par l'authenticationService en un objet métier (User). |
...
Sommaire :
| Sommaire | ||
|---|---|---|
|
...
Authentification Shibboleth
...
...
Shib
La classe ShibbolethApacheModuleAuthenticationService propose une authentification shib.
| Bloc de code |
|---|
<bean id="delegatingAuthenticationService" lazy-init="true"
class="org.esupportail.commons.services.authentication.ShibbolethApacheModuleAuthenticationService">
<property name="idHeader" value=""/>
<property name="attributeHeaders">
<list>
<value></value>
</list>
</property>
</bean>
|
L'authentification shibboleth est faite par un module apache qui fonctionne en amont de l'application Java. Par l'option "ShibUseHeaders On" le module transmet à l'application, sous forme d'entêtes HTTP, l'ensemble des attributs de utilisateur connecté (reçus depuis le fournisseur d'identités). Ce sont ces attributs qui sont utilisés par l'implémentation ShibbolethApacheModuleAuthenticationService.
Authentification par le Remote User
...
| Bloc de code |
|---|
<bean id="authenticator" lazy-init="true"
class="org.esupportail.example.services.authentication.AuthenticatorImpl">
<property name="authenticationService" ref="delegatingAuthenticationService" />
</bean>
<bean id="delegatingAuthenticationService" lazy-init="true"
class="org.esupportail.commons.services.authentication.DelegatingAuthenticationService">
<property name="authenticationServices">
<list>
<ref bean="portletAuthenticationService" />
<ref bean="casFilterAuthenticationService" />
<ref bean="offlineFixedUserAuthenticationService" />
</list>
</property>
</bean>
<bean id="casFilterAuthenticationService" lazy-init="true"
class="org.esupportail.commons.services.authentication.CasFilterAuthenticationService">
</bean>
<bean id="portletAuthenticationService" lazy-init="true"
class="org.esupportail.commons.services.authentication.CasifiedPortalAuthenticationService">
<property name="uidPortalAttribute" value="uid" />
</bean>
<bean id="offlineFixedUserAuthenticationService"
class="org.esupportail.commons.services.authentication.OfflineFixedUserAuthenticationService">
<property name="authId" value="guest" />
<property name="authType" value="cas" />
</bean>
|
...