Arborescence des pages

Introduction

L'installation d' ESUP-SGC au sein de la COMUE Normandie Université nécessite une configuration spécifique notamment au niveau des applications Desfire écrites sur la carte, du paramétrage CROUS et du contrôle d'acces.

Dans ce document on donne la structure des fichiers de configuration à titre d'exemple et sans les clés confidentielles.

Cest ce type d'installation qui a ainsi été réalisé dans les différents établissements de la COMUE Normandie Université.

Dans ce cadre, nous avons établi un document 'type' de 'qualification' que nous partageons ici également : ESUP-SGC-Point-Controle-COMUE-NU.pdf (fichier source Excel ici)

Versionning de la configuration

D'une manière générale il est conseillé de faite des commits GIT locaux pour sauvegarder vos modifications de configuration.

Par exemple, lors que vous avez fini la configuration du fichier "src/main/resources/META-INF/spring/applicationContext-custom.xml" vous pouvez exécuter les commandes suivantes depuis la racine de vos sources (ex : /opt/esup-nfc-tag):

git add src/main/resources/META-INF/spring/applicationContext-custom.xml
git commit -m "config prod univ-ville-fr"

La modification du fichier applicationContext-custom.xml sera versionnée ce qui permet de conserver les traces de toutes les modifications (procédure à faire à chaque modification). De plus lors d'une mise à jour d'ESUP-SGC (git pull) la configuration ne sera pas écrasée.

Configuration ESUP-NFC-TAG-SERVER

src/main/resources/META-INF/spring/applicationContext-custom.xml

Comprenant toutes les applications optionnelles ESUP-SGC ainsi qu'une authentification desfire sur la nouvelle application csn-domain (F585C2)

La desfireKey est à remplacer par la clé 01 de l'application F585C2 qui vous a été fournie.

L'attribut desfireFileSize du DesfireReadConfig n'est plus utile, il faut le supprimer

    <bean id="dummyExtApi" class="org.esupportail.nfctag.service.api.impl.AppliExtDummy"/>

	<bean id="tagIdCheckApiLdapWithCsn" class="org.esupportail.nfctag.service.api.impl.TagIdCheckLdap">
    	<property name="searchFilter" value="supannRefId='{'ISO15693'}'{0}"/>
		<property name="description" value="via LDAP ISO15693"/>
		<property name="ldapServices">
			<util:list>
				<ref bean="ldapServiceUnivVille"/>
			</util:list>
		</property>
    </bean>
 
    <bean id="tagIdCheckApiDummy" class="org.esupportail.nfctag.service.api.impl.TagIdCheckDummyWs">
    	<property name="description" value="TagIdCheckDummy"/>
    </bean>
    <bean id="csnAuthConfig" class="org.esupportail.nfctag.service.api.impl.CsnAuthConfig">
    	<property name="description" value="Authentification CSN"/>
    </bean>
    <bean id="desfireAuthConfigComue" class="org.esupportail.nfctag.service.api.impl.DesfireReadConfig">
        <property name="desfireKeyNumber" value="01"/>
        <property name="desfireFileNumber" value="00"/>
        <property name="desfireAppId" value="F585C2"/>
        <property name="desfireAppName" value="csn-domain"/>
        <property name="desfireFileOffset" value="000000"/>
        <property name="desfireKey" value="XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"/>
        <property name="description" value="Authentification Desfire CSN-DOMAIN"/>
    </bean>
    <bean id="ldapContextSourceUnivville" class="org.springframework.ldap.core.support.LdapContextSource">
	<property name="url" value="ldap://ldap.univ-ville.fr" />
	<property name="base" value="dc=univ-ville,dc=fr" />
	<property name="userDn" value="cn=admin,dc=univ-ville,dc=fr" />
	<property name="password" value="XXXXXXXX" />
    </bean>    
    <bean id="ldapTemplateUnivville" class="org.springframework.ldap.core.LdapTemplate">  
    	<constructor-arg ref="ldapContextSourceUnivville" />  
    </bean>
    <bean id="ldapServiceUnivville" class="org.esupportail.nfctag.service.LdapService">
	<property name="ldapTemplate" ref="ldapTemplateUnivville" />
    </bean> 
    <bean id="esupSgcExtApi" class="org.esupportail.nfctag.service.api.impl.AppliExtRestWs">
    	<property name="isTagableUrl" value="https://esup-sgc.univ-ville.fr/wsrest/nfc/isTagable"/>
    	<property name="validateTagUrl" value="https://esup-sgc.univ-ville.fr/wsrest/nfc/validateTag"/>
    	<property name="getLocationsUrl" value="https://esup-sgc.univ-ville.fr/wsrest/nfc/locations"/>
    	<property name="description" value="Web Service Write Esup SGC"/>
    </bean>
    <bean id="esupSgcUpdateExtApi" class="org.esupportail.nfctag.service.api.impl.AppliExtRestWs">
        <property name="isTagableUrl" value="https://esup-sgc.univ-ville.fr/wsrest/nfc/isTagable"/>
        <property name="validateTagUrl" value="https://esup-sgc.univ-ville.fr/wsrest/nfc/validateTag"/>
        <property name="getLocationsUrl" value="https://esup-sgc.univ-ville.fr/wsrest/nfc/locationsUpdater"/>
        <property name="description" value="Web Service Update Esup SGC"/>
    </bean>
	<bean id="esupSgcSearchExtApi" class="org.esupportail.nfctag.service.api.impl.AppliExtRestWs">
        <property name="isTagableUrl" value="https://esup-sgc.univ-ville.fr/wsrest/nfc/isTagable"/>
        <property name="validateTagUrl" value="https://esup-sgc.univ-ville.fr/wsrest/nfc/validateTag"/>
        <property name="getLocationsUrl" value="https://esup-sgc.univ-ville.fr/wsrest/nfc/locationsSearch"/>
        <property name="description" value="Web Service Search Esup SGC"/>
    </bean>
    <bean id="esupSgcLivraisonExtApi" class="org.esupportail.nfctag.service.api.impl.AppliExtRestWs">
    	<property name="isTagableUrl" value="https://esup-sgc.univ-ville.fr/wsrest/nfc/isTagable"/>
    	<property name="validateTagUrl" value="https://esup-sgc.univ-ville.fr/wsrest/nfc/validateTag"/>
    	<property name="getLocationsUrl" value="https://esup-sgc.univ-ville.fr/wsrest/nfc/locationsLivreur"/>
    	<property name="description" value="Web Service livraison Esup SGC"/>
    </bean>
    <bean id="esupSgcVersoExtApi" class="org.esupportail.nfctag.service.api.impl.AppliExtRestWs">
    	<property name="isTagableUrl" value="https://esup-sgc.univ-ville.fr/wsrest/nfc/isTagable"/>
    	<property name="validateTagUrl" value="https://esup-sgc.univ-ville.fr/wsrest/nfc/validateTag"/>
    	<property name="getLocationsUrl" value="https://esup-sgc.univ-ville.fr/wsrest/nfc/locationsVerso"/>
    	<property name="displayUrl" value="https://esup-sgc.univ-ville.fr/wsrest/nfc/verso"/>
    	<property name="description" value="Web Service Verso Esup SGC"/>
    </bean>
    
    <bean id="tagIdCheckApiEsupSgc" class="org.esupportail.nfctag.service.api.impl.TagIdCheckRestWs">
    	<property name="tagIdCheckUrl" value="https://esup-sgc.univ-ville.fr/wsrest/nfc/tagIdCheck"/>
    	<property name="idFromEppnInitUrl" value="https://esup-sgc.univ-ville.fr/wsrest/nfc/idFromEppnInit"/>
    	<property name="description" value="via Esup SGC"/>
    	</bean>


src/main/resources/META-INF/spring/applicationContext-desfire.xml

La carte doit comporter les applications leocode (F585C0), idp2s (F585C1) et csn-domain (F585C2)

Chaque p:key est à remplacer par les clés qui vous ont été fournies (les clés p:keyNo=00 sont les master key respectives de chaque application)

Suite à des modifications au niveau d'Esup-NFC-Tag-Server (possibilité de créer des applications vides, correction de l'application de mise à jour et optimisations) les TagUpdateRestWs sont supprimés. Il faut donc remplacer les références idp2sTagUpdateEsupSgc par idp2sTagWriteEsupSgc dans le bean desfireComueTagUpdateEsupSgc et remplacer la proprieté p:tagUpdateApi-ref par p:tagWriteApi-ref.

De plus un nouveau bean est à ajouter :

<bean id="dateLastUpdateEsupSgc" class="org.esupportail.nfctag.service.api.impl.TagLastUpdateRestWs">
 <property name="wsUrl" value="https://esup-sgc.univ-ville.fr/wsrest/nfc/lastUpdateFromCsn"/>
</bean>

Il permet de récupérer la date de dernier encodage de la carte en cours de mise à jour

Il faut aussi retirer l'attribut p:type au niveau de desfireKey et l'attribut p:keyVersionStart au niveau de desfireTag (ils ne sont plus utiles)

    <bean id="idp2sTagWriteEsupSgc" class="org.esupportail.nfctag.service.api.impl.TagWriteRestWs">
		<property name="idFromCsnUrlTemplate" value="https://esup-sgc.univ-ville.fr/wsrest/nfc/idFromCsn?csn={0}&amp;appName=access-control"/>
    </bean>

    <bean id="leocodeTagWriteEsupSgc" class="org.esupportail.nfctag.service.api.impl.TagWriteRestWs">
		<property name="idFromCsnUrlTemplate" value="https://esup-sgc.univ-ville.fr/wsrest/nfc/idFromCsn?csn={0}&amp;appName=bu"/>
    </bean>
    
    <bean id="csnDomainTagWriteEsupSgc" class="org.esupportail.nfctag.service.api.impl.TagWriteRestWs">
	    <property name="idFromCsnUrlTemplate" value="https://esup-sgc.univ-ville.fr/wsrest/nfc/idFromCsn?csn={0}&amp;appName=csn-domain"/>
    </bean>

    <bean id="dateLastUpdateEsupSgc" class="org.esupportail.nfctag.service.api.impl.TagLastUpdateRestWs">
    	<property name="wsUrl" value="https://esup-sgc.univ-ville.fr/wsrest/nfc/lastUpdateFromCsn"/>
    </bean>


    <bean id="damKeysTagWriteRestWs" class="org.esupportail.nfctag.service.api.impl.DamKeysTagWriteRestWs">
      <property name="createDamKeysFromCsnUrlTemplate" value="https://esup-sgc.univ-ville.fr/wsrest/nfc/createDamDiversBaseKey?csn={0}"/>
      <property name="damKeysFromCsnUrlTemplate" value="https://esup-sgc.univ-ville.fr/wsrest/nfc/getDamDiversBaseKey?csn={0}"/>
      <property name="resetDamKeysUrlTemplate" value="https://esup-sgc.univ-ville.fr/wsrest/nfc/resetDamDiversBaseKey?csn={0}"/>
    </bean>

	<bean id="desfireComueTagEsupSgc" class="org.esupportail.nfctag.beans.DesfireTag" p:formatBeforeWrite="false" 
p:keyStart="XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" p:keyTypeStart="AES" p:keyFinish="XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" p:keyTypeFinish="AES" p:keyVersionFinish="01" 
p:damKeysTagWriteApi-ref="damKeysTagWriteRestWs">    
 	<property name="applications">
		<util:list>
			<bean class="org.esupportail.nfctag.beans.DesfireApplication"
				p:desfireAppId="F585C0" p:amks="0B" p:nok="84">
				<property name="files">
					<util:list>
						<bean class="org.esupportail.nfctag.beans.DesfireFile"
							p:fileNumber="00" p:communicationSettings="03" p:accessRights="1223" p:tagWriteApi-ref="leocodeTagWriteEsupSgc"/>
					</util:list>
				</property>
				<property name="keys">
					<util:list>
						<bean class="org.esupportail.nfctag.beans.DesfireKey"
							p:keyNo="00" p:keyVer="01" p:key="XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"/>
						<bean class="org.esupportail.nfctag.beans.DesfireKey"
							p:keyNo="01" p:keyVer="01" p:key="XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"/>
						<bean class="org.esupportail.nfctag.beans.DesfireKey"
							p:keyNo="02" p:keyVer="01" p:key="XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"/>
						<bean class="org.esupportail.nfctag.beans.DesfireKey"
							p:keyNo="03" p:keyVer="01" p:key="XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"/>
					</util:list>
				</property>
			</bean>
			<bean class="org.esupportail.nfctag.beans.DesfireApplication"
				p:desfireAppId="F585C1" p:amks="0B" p:nok="85">
				<property name="files">
					<util:list>
						<bean class="org.esupportail.nfctag.beans.DesfireFile"
							p:fileNumber="00" p:communicationSettings="03" p:accessRights="1444" p:fileSize="1F0000" p:tagWriteApi-ref="idp2sTagWriteEsupSgc"/>
						<bean class="org.esupportail.nfctag.beans.DesfireFile"
							p:fileNumber="01" p:communicationSettings="03" p:accessRights="2444" p:fileSize="1F0000" p:tagWriteApi-ref="idp2sTagWriteEsupSgc"/>
						<bean class="org.esupportail.nfctag.beans.DesfireFile"
							p:fileNumber="02" p:communicationSettings="03" p:accessRights="3444" p:fileSize="1F0000" p:tagWriteApi-ref="idp2sTagWriteEsupSgc"/>
					</util:list>
				</property>
				<property name="keys">
					<util:list>
						<bean class="org.esupportail.nfctag.beans.DesfireKey"
							p:keyNo="00" p:keyVer="01" p:key="XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"/>
						<bean class="org.esupportail.nfctag.beans.DesfireKey"
							p:keyNo="01" p:keyVer="01" p:key="XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"/>
						<bean class="org.esupportail.nfctag.beans.DesfireKey"
							p:keyNo="02" p:keyVer="01" p:key="XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"/>
						<bean class="org.esupportail.nfctag.beans.DesfireKey"
							p:keyNo="03" p:keyVer="01" p:key="XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"/>		
						<bean class="org.esupportail.nfctag.beans.DesfireKey"
							p:keyNo="04" p:keyVer="01" p:key="XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"/>	
					</util:list>
				</property>
			</bean>
			<bean class="org.esupportail.nfctag.beans.DesfireApplication" 
				p:desfireAppId="F585C2" p:amks="0B" p:nok="86">
				<property name="files">
					<util:list>
						<bean class="org.esupportail.nfctag.beans.DesfireFile"
							p:fileNumber="00" p:communicationSettings="03" p:accessRights="1FFF" p:tagWriteApi-ref="csnDomainTagWriteEsupSgc"/>
						<bean class="org.esupportail.nfctag.beans.DesfireFile"
							p:fileNumber="01" p:communicationSettings="03" p:accessRights="2FFF" p:tagWriteApi-ref="csnDomainTagWriteEsupSgc"/>
						<bean class="org.esupportail.nfctag.beans.DesfireFile"
							p:fileNumber="02" p:communicationSettings="03" p:accessRights="3FFF" p:tagWriteApi-ref="csnDomainTagWriteEsupSgc"/>
						<bean class="org.esupportail.nfctag.beans.DesfireFile"
							p:fileNumber="03" p:communicationSettings="03" p:accessRights="4FFF" p:tagWriteApi-ref="csnDomainTagWriteEsupSgc"/>
						<bean class="org.esupportail.nfctag.beans.DesfireFile"
							p:fileNumber="04" p:communicationSettings="03" p:accessRights="5FFF" p:tagWriteApi-ref="csnDomainTagWriteEsupSgc"/>
					</util:list>
				</property>
				<property name="keys">
					<util:list>
						<bean class="org.esupportail.nfctag.beans.DesfireKey"
							p:keyNo="00" p:keyVer="01" p:key="XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"/>
						<bean class="org.esupportail.nfctag.beans.DesfireKey"
							p:keyNo="01" p:keyVer="01" p:key="XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"/>
						<bean class="org.esupportail.nfctag.beans.DesfireKey"
							p:keyNo="02" p:keyVer="01" p:key="XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"/>
						<bean class="org.esupportail.nfctag.beans.DesfireKey"
							p:keyNo="03" p:keyVer="01" p:key="XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"/>
						<bean class="org.esupportail.nfctag.beans.DesfireKey"
							p:keyNo="04" p:keyVer="01" p:key="XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"/>
						<bean class="org.esupportail.nfctag.beans.DesfireKey"
							p:keyNo="05" p:keyVer="01" p:key="XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"/>
					</util:list>
				</property>
			</bean>

	</util:list>
   </property>
</bean>


Configuration ESUP-SGC

src/main/resources/META-INF/spring/applicationContext-services.xml

   <!-- used for ldap search on /manager/ldapSearch - super-manager only -->
   <bean id="ldapPersonService" class="org.esupportail.sgc.services.ldap.LdapPersonService">
        <property name="ldapTemplate" ref="ldapTemplate"/>
        <property name="ldapTemplates">
        	<map>
        		<entry key="Ldap Université de Ville" value-ref="ldapTemplate"/>
        		<entry key="Ldap Comue" value-ref="comueLdapTemplate"/>
        	</map>
        </property>
   </bean>	
 
	<bean id="shibUserInfoService" class="org.esupportail.sgc.services.userinfos.ShibUserInfoService" p:order="1">
		<property name="sgcParam2requestHeader">
			<map>
				<entry key="email" value="mail"/>
				<entry key="firstname" value="givenname"/>
				<entry key="name" value="sn"/>
				<entry key="eduPersonPrimaryAffiliation" value="eduPersonPrimaryAffiliation"/>
				<entry key="supannEtuId" value="supannEtuId"/>
				<entry key="supannEmpId" value="supannEmpId"/>
				<entry key="supannEtuEtape" value="supannEtuEtape"/>
				<entry key="supannEntiteAffectationPrincipale" value="supannEntiteAffectationPrincipale"/>
				<entry key="supannEtablissement" value="supannEtablissement"/>
				<entry key="supannCodeINE" value="supannCodeINE"/>
				<entry key="schacDateOfBirth" value="schacDateOfBirth"/>
				<entry key="recto2" value="givenname"/>
				<entry key="recto3" value="sn"/>
			</map>
		</property>	
	</bean>
	
	<bean id="ldapContextSourcePool" class="org.springframework.ldap.pool.factory.PoolingContextSource">
		<property name="contextSource" ref="ldapContextSource" />
		<property name="dirContextValidator" ref="dirContextValidator"/>
		<property name="testWhileIdle" value="true"/>
		<property name="testOnBorrow" value="true"/>
	</bean>
   
	<bean id="dirContextValidator"
	 class="org.springframework.ldap.pool.validation.DefaultDirContextValidator" />
	
	<bean id="ldapContextSource"
		class="org.springframework.ldap.core.support.LdapContextSource">
		<property name="url" value="ldap://ldap.univ-ville.fr" />
		<property name="base" value="dc=univ-ville,dc=fr" />
		<property name="userDn" value="cn=admin,dc=univ-ville,dc=fr" />
		<property name="password" value="XXXXXXXX" />
	</bean>    
	
	<bean id="ldapTemplate" class="org.springframework.ldap.core.LdapTemplate">
		<constructor-arg ref="ldapContextSourcePool" />
	</bean>
	
	<bean id="ldapUserInfoService" class="org.esupportail.sgc.services.userinfos.LdapUserInfoService" p:order="2">
		<property name="eppnFilter" value=".*@univ-ville\.fr"/>
		<property name="ldapTemplate" ref="ldapTemplate"/>
		<property name="sgcParam2ldapAttr">
			<map>
				<entry key="email" value="mail"/>
				<entry key="eduPersonPrimaryAffiliation" value="eduPersonPrimaryAffiliation"/>
				<entry key="supannEtuId" value="supannEtuId"/>
				<entry key="supannEmpId" value="supannEmpId"/>
				<entry key="supannCodeINE" value="supannCodeINE"/>
				<entry key="supannEntiteAffectationPrincipale" value="supannEntiteAffectationPrincipale"/>
				<entry key="firstname" value="givenname"/>
				<entry key="name" value="sn"/>
				<entry key="schacDateOfBirth" value="schacDateOfBirth"/>
				<entry key="supannEtablissement" value="supannEtablissement"/>
				<entry key="jpegPhoto4ExternalCard" value="jpegPhoto"/>
				<entry key="recto3" value="givenname"/>
				<entry key="recto2" value="sn"/>
				<entry key="schacExpiryDate" value="schacExpiryDate"/>
			</map>
		</property>	
	</bean>
	
	<bean id="groupService" class="org.esupportail.sgc.services.ldap.LdapGroupService">
		<property name="ldapTemplate" ref="ldapTemplate"/>
		<property name="groupSearchBase" value="ou=groups" />
		<property name="groupSearchFilter" value="member={0}"/>
		<property name="memberSearchBase" value="ou=people"/>
		<property name="memberSearchFilter" value="memberOf={0}"/>
	</bean>
	<!--
	Exemple de sqlUserInfoService. Recupécation des informations utilisateur via une requete SQL
	-->

	<bean class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close" id="mysqlDataSource">
		<property name="driverClassName" value="com.mysql.jdbc.Driver"/>
		<property name="url" value="jdbc:mysql://mysql.univ-ville.fr:3306/database"/>
		<property name="username" value="admin"/>
		<property name="password" value="xxxxxxxx"/>
		<property name="testOnBorrow" value="true" />
		<property name="testOnReturn" value="true" />
		<property name="testWhileIdle" value="true" />
		<property name="timeBetweenEvictionRunsMillis" value="1800000" />
		<property name="numTestsPerEvictionRun" value="3" />
		<property name="minEvictableIdleTimeMillis" value="1800000" />
		<property name="validationQuery" value="SELECT version();" />
	</bean>
	
	<bean id="univvilleUserInfoService" class="org.esupportail.sgc.services.userinfos.SqlUserInfoService" p:order="3">
		<property name="eppnFilter" value=".*@univ-ville\.fr"/>
		<property name="dataSource" ref="mysqlDataSource"/>
		<property name="sqlQuery" value="select ligneTitre as recto1,
			nom as recto2,
			prenom as recto3,
			dateNaissance as recto4,
			identifiant as recto5,
			ligneAnneeUniv as recto7,
			divers1 as verso1,
			divers2 as verso2,
			divers3 as verso3,
			divers4 as verso4,
			anneeUniv as verso5,
			typepopulationcrous as referenceStatut,
			indiceinm as indice,
			concat(replace(datefindroits,'-',''),'235959Z') as schacExpiryDate,
			leocode as secondaryId,
			adresseFilterLibelle as address
			from SgcLeoCarte where eppn=?"/>
	</bean>
	
	<!-- 
	On s'assure que eduPersonPrimaryAffiliation est conservé
	On fait également en sorte de toujours conserver une email, même si celui-ci n'est plus valide : le crous exige qu'un compte ait toujours un email de présent
	-->
	<bean id="spelUserInfoServiceEPPA" class="org.esupportail.sgc.services.userinfos.SpelUserInfoService" p:order="4">
		<property name="sgcParam2spelExp">
			<map>
				<entry key="eduPersonPrimaryAffiliation" value="#userInfosInComputing['eduPersonPrimaryAffiliation'] == Null or #userInfosInComputing['eduPersonPrimaryAffiliation'] == '' ? 
							#user.eduPersonPrimaryAffiliation : #userInfosInComputing['eduPersonPrimaryAffiliation'] "/>
				<entry key="email" value="#userInfosInComputing['email'] != Null and #userInfosInComputing['email'] matches '.*@.*' ? #userInfosInComputing['email'] : #user.email"/>
			</map>
		</property>	
	</bean>
	
	<!-- 
	On calcule l'institute en fonction de l'eppn
	On calcule le userType en fonction de eduPersonPrimaryAffiliation
	On calcule le template de la carte en fonction de l'eppn
	-->
	<bean id="spelUserInfoService" class="org.esupportail.sgc.services.userinfos.SpelUserInfoService" p:order="5">
		<property name="sgcParam2spelExp">
			<map>
				<entry key="institute" value=" 
					#user.eppn matches '.*@univ-ville\.fr' ? 'Université de Ville' :
					#user.eppn matches '.*@univ-village\.fr' ? 'Université du Village' :
					#user.eppn matches '.*@ecole-ville\.fr' ? 'Ecolde de Ville' :
					#user.eppn matches '.*@comue\.fr' ? 'COMUE' :
					'Extérieur'"/>
				<entry key="userType" value="!(#user.eppn matches '.*@univ-ville\.fr') ? 'Ext' : 
					#userInfosInComputing['eduPersonPrimaryAffiliation'] == 'student' ? 'E' : 
					#userInfosInComputing['eduPersonPrimaryAffiliation'] == 'staff' or #userInfosInComputing['eduPersonPrimaryAffiliation'] == 'teacher' or #userInfosInComputing['eduPersonPrimaryAffiliation'] == 'employee' ? 'P' : 'I'"/>
				<entry key="template" value="#user.eppn matches '.*@univ-ville\.fr' ? 'univ-ville' : 'undefined'"/>
			</map>
		</property>	
	</bean>
	
	<!-- 
	Si recto1 et recot4 non trouvé (dans la Base de Données ici) on les calcule en fonction du userType et de schacDateOfBirth
	on reformatte recto7 : 2017/2018 -> 2017<br/>2018 - cf propriété recto7Replace donnée dans sgc.properties
	-->
	<bean id="spelUserInfoService2" class="org.esupportail.sgc.services.userinfos.SpelUserInfoService" p:order="6">
		<property name="sgcParam2spelExp">
			<map>
				<entry key="recto1" value="#userInfosInComputing['recto1'] != Null ? #userInfosInComputing['recto1'] : 
					#userInfosInComputing['userType']  == 'E' ? 'étudiant' : 
					#userInfosInComputing['userType'] == 'P' ? 'professionnelle' : 
					#userInfosInComputing['userType'] == 'I' ? 'invité' :  
					'extérieur'"/>
				<entry key="recto4" value="#userInfosInComputing['recto4'] != Null ? #userInfosInComputing['recto4'] : 
					#userInfosInComputing['schacDateOfBirth']  != Null ? 'Né le : ' + #dateUtils.schadDateOfBirthDay2FrenchDate(#userInfosInComputing['schacDateOfBirth']) : ''"/>
				<entry key="recto7" value="${recto7Replace}"/>
			</map>
		</property>	
	</bean>
 
	<!-- 
	requestFree à false pour les étudiants ayant une carte de moins de 3ans *par rapport au 6 juillet de l'année de demande de la carte*  
	les cartes avant le 29/06/2018 (anciennes leocartes) ne sont pas prises en compte
	-->
	<bean id="requestNotFreeUserInfoService" class="org.esupportail.sgc.services.userinfos.SqlUserInfoService" p:order="8">
		<property name="eppnFilter" value=".*@univ-ville\.fr"/>
		<property name="dataSource" ref="dataSource"/>
		<property name="sqlQuery" value="select (not exists (select c.id from card as c, 
			user_account as u 
			where c.request_date > (select x from (SELECT to_date('06.07.' || date_part('year', current_timestamp)-2, 'DD.MM.YYYY') as x 
			union SELECT to_date('06.07.' || date_part('year', current_timestamp)-3, 'DD.MM.YYYY') as x) AS d 
			where current_timestamp-d.x > INTERVAL '2 year' order by x desc limit 1) 
			and c.eppn=u.eppn and u.edu_person_primary_affiliation='student' 	
			and c.request_date > '2018-05-28'		 
			and u.eppn = ?)) ::text as requestFree"/>
	</bean>
 
 
	
	<bean id="comueLdapContextSourcePool" class="org.springframework.ldap.pool.factory.PoolingContextSource">
      <property name="contextSource" ref="comueLdapContextSource" />
      <property name="dirContextValidator" ref="comueDirContextValidator"/>
      <property name="testWhileIdle" value="true"/>
      <property name="testOnBorrow" value="true"/>
   </bean>
   
   <bean id="comueDirContextValidator"
         class="org.springframework.ldap.pool.validation.DefaultDirContextValidator" />
	
    <bean id="comueLdapContextSource"
		class="org.springframework.ldap.core.support.LdapContextSource">
		<property name="url" value="ldaps://ldap.comue.fr" />
		<property name="base" value="dc=unr-runn,dc=fr" />
		<property name="userDn" value="cn=esup-sgc-univ-ville,ou=system,dc=comue,dc=fr" />
		<property name="password" value="XXXXXXXX" />
	</bean>    
	
	<bean id="comueLdapTemplate" class="org.springframework.ldap.core.LdapTemplate">
		<constructor-arg ref="comueLdapContextSourcePool" />
	</bean>
	
	<bean id="comueLdapUserInfoService" class="org.esupportail.sgc.services.userinfos.LdapUserInfoService" p:order="2">
		<property name="eppnFilter" value="^((?!@univ-ville\.fr).)*$"/>
		<property name="ldapTemplate" ref="comueLdapTemplate"/>
		<property name="sgcParam2ldapAttr">
			<map>
				<entry key="email" value="mail"/>
				<entry key="eduPersonPrimaryAffiliation" value="eduPersonPrimaryAffiliation"/>
				<entry key="firstname" value="givenname"/>
				<entry key="name" value="sn"/>
				<entry key="schacDateOfBirth" value="schacDateOfBirth"/>
				<entry key="supannEtablissement" value="supannEtablissement"/>
				<entry key="supannRefId4ExternalCard" value="supannRefId"/>
				<entry key="jpegPhoto4ExternalCard" value="jpegPhoto"/>
				<entry key="recto3" value="givenname"/>
				<entry key="recto2" value="sn"/>
				<entry key="schacExpiryDate" value="schacExpiryDate"/>
			</map>
		</property>	
	</bean>
 
	<bean id="comueSpelUserInfoService" class="org.esupportail.sgc.services.userinfos.SpelUserInfoService" p:order="4">
		<property name="eppnFilter" value="^((?!@univ-ville\.fr).)*$"/>
		<property name="sgcParam2spelExp">
			<map>
				<entry key="secondaryId" value="${leocodeReplace}"/>
				<entry key="access-control4ExternalCard" value="${accesscontrolReplace}"/>
                <entry key="csn4ExternalCard" value="${csnReplace}"/>
			</map>
		</property>	
	</bean>
	
	
	<bean id="cardIdsService" class="org.esupportail.sgc.services.cardid.CardIdsService">
		<property name="cardIdServices">
			<list>
				<bean class="org.esupportail.sgc.services.cardid.ComueNuAccessControlCardIdService">
					<!-- warning : access-control is a keyword for access-control services :
						org.esupportail.sgc.services.ac.AccessControlService.AC_APP_NAME = 'access-control'
					 -->
					<property name="appName" value="access-control"/>
					<property name="idCounterBegin" value="XXXXXXXXXXXXXXXX"/>
					<property name="postgresqlSequence" value="card_sequence"/>
				</bean>
				<bean class="org.esupportail.sgc.services.cardid.ComueNuBuCardIdService">
					<property name="appName" value="bu"/>
				</bean>
                <bean class="org.esupportail.sgc.services.cardid.CsnDomainCardIdService">
                    <property name="appName" value="csn-domain"/>
                </bean>
			</list>
		</property>
	</bean>
	
	<bean id="esupNfcTagService" class="org.esupportail.sgc.services.EsupNfcTagService">
		<property name="restTemplate" ref="restTemplate"/>
		<property name="webUrl" value="https://esup-nfc-tag.univ-ville.fr"/>
		<property name="applicationName" value="Ecriture SGC"/>	
		<property name="location" value="Encodage ESUP SGC"/>
	</bean>
	
	<bean id="ldapAdminContextSourcePool" class="org.springframework.ldap.pool.factory.PoolingContextSource">
		<property name="contextSource" ref="ldapAdminContextSource" />
		<property name="dirContextValidator" ref="dirContextValidator"/>
		<property name="testWhileIdle" value="true"/>
		<property name="testOnBorrow" value="true"/>
	</bean>
	
	<bean id="ldapAdminContextSource"
		class="org.springframework.ldap.core.support.LdapContextSource">
		<property name="url" value="ldap://ldap.univ-ville.fr" />
		<property name="base" value="dc=univ-ville,dc=fr" />
		<property name="userDn" value="cn=admin,dc=univ-ville,dc=fr" />
		<property name="password" value="XXXXXXXX" />
	</bean>    
	
	<bean id="ldapAdminTemplate" class="org.springframework.ldap.core.LdapTemplate">
		<constructor-arg ref="ldapAdminContextSourcePool" />
	</bean>
	
	<bean id="ldapValidateService" class="org.esupportail.sgc.services.ldap.LdapValidateService">
		<property name="ldapTemplate" ref="ldapAdminTemplate"/>
		<property name="peopleSearchFilter" value="(eduPersonPrincipalName={0})"/>
		<property name="ldapCardIdsMappingMultiValues">
			<map>
				<entry key="swissEduPersonCardUID">
					<list>
						<value>%reverse_csn%@ISO15693</value>
					</list>
				</entry>
				<entry key="supannRefId">
					<list>
						<value>{ISO15693}%csn%</value>
						<value>{LEOCARTE:ACCESS-CONTROL}%access-control%</value>
					</list>
				</entry>
			</map>
		</property>
             <!-- 
		<property name="ldapCardIdsMappingValue">
			<map>
				<entry key="jpegPhoto" value="%photo%"/>
			</map>
	        </property>
 			-->
	</bean>
	
	<bean id="adContextSourcePool" class="org.springframework.ldap.pool.factory.PoolingContextSource">
		<property name="contextSource" ref="adContextSource" />
		<property name="dirContextValidator" ref="dirContextValidator"/>
		<property name="testWhileIdle" value="true"/>
		<property name="testOnBorrow" value="true"/>
	</bean>
	 
	<bean id="adContextSource"
		class="org.springframework.ldap.core.support.LdapContextSource">
		<property name="url" value="ldaps://ad.univ-ville.fr:636" />
		<property name="base" value="DC=ur,DC=univ-ville,DC=fr"/>
		<property name="pooled" value="true" />
		<property name="userDn"	value="cn=Administrateur,cn=users,dc=ur,dc=univ-ville,dc=fr"/>
		<property name="password" value="XXXXXXXX" />
	</bean>
	
	<bean id="adLdapTemplate" class="org.springframework.ldap.core.LdapTemplate">  
		<constructor-arg ref="adContextSourcePool" />
		<property name="ignorePartialResultException" value="true"/>
	</bean>
	<bean id="adValidateService" class="org.esupportail.sgc.services.ldap.LdapValidateService">
		<property name="ldapTemplate" ref="adLdapTemplate"/>
		<property name="peopleSearchFilter" value="(&amp;(objectClass=person)(cn={1}))"/>
		<property name="ldapCardIdsMappingValue">
			<map>
				<entry key="pager">
					<value>%csn%</value>
				</entry>
			</map>
		</property>
	</bean>
	<bean id="ipService" class="org.esupportail.sgc.services.IpService">
	    <property name="maps">
			<bean class="org.springframework.beans.factory.config.PropertiesFactoryBean">
				<property name="location" value="classpath:ip.properties"/>
			</bean>
		</property>
	</bean>
	<bean class="org.springframework.mail.javamail.JavaMailSenderImpl" id="mailSender">
		<property name="host" value="${email.host}"/>
		<property name="protocol" value="${email.protocol}"/>
	</bean>
    
	<bean id="emailService" class="org.esupportail.sgc.services.EmailService">
		<property name="mailSender" ref="mailSender"/>
		<property name="isEnabled" value="true"/>
	</bean>


	<bean id="papercutValidateService" class="org.esupportail.sgc.services.papercut.PapercutService">
		<property name="authToken" value="tokenPapercutUnivVille" />
		<property name="server" value="papercut.univ-ville.fr" />
		<property name="scheme" value="https" />
		<property name="port" value="443" />
		<property name="accountName" value="" />
		<property name="papercutUidFromEppnRegex" value="([^@]*)@.*"/>
	</bean>
	
	<bean id="comueRefSiRestValidateService" class="org.esupportail.sgc.services.AsyncRestValidateService">
		<property name="use4ExternalCard" value="true"/>
		<property name="delay" value="10000"/>
	    <property name="restTemplate" ref="comueRefSiRestTemplate"/>
	    <property name="validateRestUrl" value="https://referentiel.comue.fr/maj/%s"/>
	    <property name="invalidateRestUrl" value="https://referentiel.comue.fr/maj/%s"/>
	</bean>
	
	<bean id="comueRefSiRestTemplate" class="org.esupportail.sgc.tools.RestTemplateClientCertBuilder">
        <property name="certFile" value="classpath:META-INF/security/certif-esup-sgc.p12"/>
        <property name="password" value="passwordducertif"/>
    </bean>

src/main/resources/META-INF/spring/sgc.properties

Si cette règle (valeur/propriété recto7Replace) est déportée dans un fichier de properties c'est pour pouvoir utiliser les caractères (réservés en XML) < et > 

recto7Replace=#userInfosInComputing['recto7'] != Null ? #userInfosInComputing['recto7'].replaceAll('/','<br/>') : ''
accesscontrolReplace=#userInfosInComputing['supannRefId4ExternalCard'] != Null ? #userInfosInComputing['supannRefId4ExternalCard'].replaceFirst('^.*\\{LEOCARTE:ACCESS-CONTROL\\}([^;]*).*$', '$1') : ''           
csnReplace=#userInfosInComputing['supannRefId4ExternalCard'] != Null ? #userInfosInComputing['supannRefId4ExternalCard'].replaceFirst('^.*\\{ISO15693\\}([^;]*).*$', '$1') : ''                          
leocodeReplace=#userInfosInComputing['supannRefId4ExternalCard'] != Null ? #userInfosInComputing['supannRefId4ExternalCard'].replaceFirst('^.*\\{LEOCODE\\}([^;]*).*$', '$1') : ''   

src/main/resources/META-INF/spring/applicationContext-crous.xml

	<bean id="httpClientFactory"
		class="org.springframework.http.client.HttpComponentsClientHttpRequestFactory">
		<property name="connectTimeout" value="10000" />
		<property name="readTimeout" value="10000" />
		<property name="httpClient" ref="httpClient"/>
	</bean>
	<bean id="restTemplate" class="org.springframework.web.client.RestTemplate">
		<constructor-arg ref="httpClientFactory" />
	</bean>
	
	<bean id="httpClientBuilder" class="org.apache.http.impl.client.HttpClientBuilder"
	    factory-method="create">
	    <property name="connectionReuseStrategy">
	    	<bean class="org.apache.http.impl.NoConnectionReuseStrategy"/>
	    </property>
	</bean>
	
	<bean id="httpClient" factory-bean="httpClientBuilder" factory-method="build" />
	<bean id="apiCrousService" class="org.esupportail.sgc.services.crous.ApiCrousService">
		<property name="enable" value="true"/>
		<property name="webUrl" value="https://api.lescrous.fr" />
		<property name="appId" value="XXXXXXXX" />
		<property name="appSecret" value="XXXXXXXXXXXXXXXXXXXXXX" />
		<property name="restTemplate" ref="restTemplate" />
	</bean>
	
	
	<bean id="esistCrousService" class="org.esupportail.sgc.services.crous.EsistCrousService">
		<property name="esistFiles">
			<list>
				<!-- value>esist/ESIST-cnrs.xml</value-->
				<value>esist/ESIST-02012018-no-hbg.xml</value>
			</list>
		</property>
	</bean>

	<bean id="europeanStudentCardService" class="org.esupportail.sgc.services.esc.ApiEscrService">
		<property name="enable" value="false"/>
		<property name="webUrl" value="https://api.europeanstudentcard.eu/v1" />
		<property name="key" value="XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" />
		<property name="restTemplate" ref="restTemplate" />
		<property name="countryCode" value="FR"/>
		<property name="picInstitutionCode" value="XXXXXXXXXX"/>
		<!-- 
		Type of cards. Possibles values are :
		1 - passive card, with no electronic
		2 - Smartcard without European common data zone
		3 - Smartcard with European common data zone
		4 - Smartcard on which application may be installed by service providers
		 -->
 		<property name="cardType" value="2"/>
        <property name="cardTypes">
          <map>
            <entry key="2021-03-25 10:41:00" value="3"/>
			<entry key="2021-07-07 16:25:00" value="4"/>
          </map>
         </property>
	</bean>

	<bean id="escUidFactoryService" class="org.esupportail.sgc.services.esc.EscUidFactoryService">
		<property name="pic" value="XXXXXXXXX"/>
		<property name="prefixe" value="1 " />
		<property name="qrCodeUrlPrefixe" value="http://esc.gg/" />
	</bean>

</beans>

src/main/resources/META-INF/spring/applicationContext-acces-control.xml 

<bean id="accessControlService" class="org.esupportail.sgc.services.ac.AccessControlService">
	<property name="use4ExternalCard" value="true"/>
</bean>

<bean class="org.esupportail.sgc.services.ac.CsvExportP2sService">
    <constructor-arg ref="p2sVfsAccessService"/>
</bean>

<bean class="org.esupportail.sgc.services.ac.CsvExportSynchronicService">
    <constructor-arg ref="synchronicVfsAccessService"/>
</bean>


<bean class="org.esupportail.sgc.services.ac.CsvExportTilService">
    <constructor-arg ref="tilVfsAccessService"/>
</bean>

<bean id="p2sVfsAccessService" class="org.esupportail.sgc.services.fs.CifsAccessService">                                                                                                                       
	<property name="uri" value="smb://p2s.univ-ville.fr/import-P2S/" />                                                                                                                                     
	<property name="domain" value="univ-ville" />
	<property name="username" value="import-P2S" />
	<property name="password" value="XXXXXXXX" />                                                                                                                                                                 	
</bean>       
                                                                                                                                                                                                                 
<bean id="synchronicVfsAccessService" class="org.esupportail.sgc.services.fs.CifsAccessService">
	<property name="uri" value="smb://synchronic.univ-ville.fr/import-synchronic/" />
	<property name="domain" value="univ-ville" />
	<property name="username" value="import-SYNCHRONIC" />
	<property name="password" value="XXXXXXXX" />
</bean>                                                                                                                                                                                                       
                                                                                                                                                                                                         
<bean id="tilVfsAccessService" class="org.esupportail.sgc.services.fs.CifsAccessService">
	<property name="uri" value="smb://til.univ-ville.fr/import-til/" />
	<property name="domain" value="univ-ville" />
	<property name="username" value="import-TIL" />
	<property name="password" value="XXXXXXXX" />
</bean>     
 
  • Aucune étiquette