Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagexml
   <!-- 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="comueSpelUserInfoServiceWithCsn" class="org.esupportail.sgc.services.userinfos.SpelUserInfoService" p:order="3">
		<property name="eppnFilter" value="^((?!@univ-ville\.fr).)*$"/>
		<property name="sgcParam2spelExp">
			<map>
				<entry key="supannRefId4ExternalCard" value="#userInfosInComputing['supannRefId4ExternalCard'] != Null and #userInfosInComputing['supannRefId4ExternalCard'].contains('{ISO15693}') ? #userInfosInComputing['supannRefId4ExternalCard'] : null"/>
			</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>

...