1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145
|
<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns="http://www.springframework.org/schema/security"
xmlns:security="http://www.springframework.org/schema/security"
xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:lang="http://www.springframework.org/schema/lang"
xmlns:sec="http://www.springframework.org/security/tags"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/security
http://www.springframework.org/schema/security/spring-security-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd">
<!-- ******************************************************************** -->
<!-- This context file was generated and is not intended to be changed manually. -->
<!-- ******************************************************************** -->
<!-- Déclaration de la DATASOURCE -->
<beans:bean id="dataSource"
class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<beans:property name="driverClassName" value="com.mysql.jdbc.Driver" />
<beans:property name="url" value="jdbc:mysql://localhost:3306/xtensusgmp2" />
<beans:property name="username" value="gmp" />
<beans:property name="password" value="gmp" />
</beans:bean>
<!-- Stratégie de Sécurité : ressources et Remember me -->
<global-method-security secured-annotations="enabled" />
<security:http auto-config="true" access-denied-page="/viewsGMP2/accessDenied.jsf">
<security:intercept-url pattern="/viewsGMP2/login2.jsf*"
filters="none" />
<security:intercept-url pattern="../framGraphique/xte-style-gmp.css"
filters="none" />
<security:intercept-url pattern="../framGraphique/images/**"
filters="none" />
<security:intercept-url pattern="/viewsGMP2/login.jsf*"
filters="none" />
<security:form-login login-processing-url="/j_spring_security_check"
login-page="/viewsGMP2/login.jsf"
default-target-url="/viewsGMP2/Ajout-groupe1.jsf"
authentication-failure-url="/viewsGMP2/login2.jsf" />
<security:logout logout-success-url="/viewsGMP2/login.jsf" />
<security:intercept-url pattern="/viewsGMP2/**"
access="ROLE_PARTICIPANT,ROLE_ADMIN,ROLE_COMMERCIAL,ROLE_FORMATEUR,ROLE_MAINTENANCE,ROLE_FORMATEUR" />
<!-- <sec:authorize ifAnyGranted="ROLE_PARTICIPANT">
<security:intercept-url patterrn ="/viewsGMP2/accessDenied.jsf"></security:intercept-url>
</sec:authorize>-->
<security:intercept-url pattern="/viewsGMP2/Ajout-groupe1.jsf" access="ROLE_PARTICIAPANT" />
<security:intercept-url pattern="/viewsGMP2/Test1.jsf" access="ROLE_PARTICIAPANT" />
<!--<security:intercept-url pattern="/viewsGMP2/Test2.jsf" access="ROLE_PARTICIAPANT,ROLE_ADMIN"/>-->
<!--<security:access-denied-handler error-page="/viewsGMP2/Test2.jsf"/>-->
<!--<security:intercept-url pattern="/viewGMP2/Test2.jsf" access="hasRole('ROLE_ADMIN')"/>-->
</security:http>
<!-- injection du provider au gestionnaire de securite de l'application -->
<!-- Authentification via base de données -->
<!-- authenticate the user with ldapAuthenticator using userSearch -->
<!--<beans:bean id = "contextSource"
class = "org.springframework.security.ldap.DefaultSpringSecurityContextSource">
<beans:constructor-arg value="ldap://192.168.198.131:389/dc=xtensus,dc=com"/>
<beans:property name="userDn" value="cn=admin,dc=xtensus,dc=com"/>
<beans:property name="password" value="ikhlass"/>
</beans:bean>-->
<ldap-server id="contextSource" url="ldap://192.168.198.131:389"
manager-dn="cn=admin,dc=xtensus,dc=com" manager-password="ikhlass"></ldap-server>
<beans:bean id="userSearch" class="org.springframework.security.ldap.search.FilterBasedLdapUserSearch">
<beans:constructor-arg index="0" value="ou=people"/>
<beans:constructor-arg index="1" value="(uid={0})"/>
<beans:constructor-arg index="2" ref="contextSource" />
</beans:bean>
<beans:bean id="ldapAuthProvider" class="org.springframework.security.ldap.authentication.LdapAuthenticationProvider">
<beans:constructor-arg>
<beans:bean class="org.springframework.security.ldap.authentication.BindAuthenticator">
<beans:constructor-arg ref="contextSource"/>
<beans:property name="userSearch" ref="userSearch"/>
</beans:bean>
</beans:constructor-arg>
<beans:constructor-arg>
<beans:bean id="userDetailsService" class="org.springframework.security.ldap.userdetails.DefaultLdapAuthoritiesPopulator">
<beans:constructor-arg ref="contextSource"/>
<beans:constructor-arg value="ou=Groups"/>
<beans:property name="groupRoleAttribute" value="ou"/>
</beans:bean>
</beans:constructor-arg>
</beans:bean>
<security:authentication-manager alias="authentificationManager">
<!-- reference provider LDAP -->
<security:ldap-authentication-provider
user-search-filter="(uid={0})"
user-search-base="ou=people"
group-search-filter="(uniqueMember={0})"
group-search-base="ou=Groups"
group-role-attribute="busniessCategory"
role-prefix="ROLE_">
</security:ldap-authentication-provider>
<!-- reference provider BD JDBC-->
<security:authentication-provider
user-service-ref='myUserDetailsService' />
<!-- <jdbc-user-service data-source-ref="dataSource"
users-by-username-query="SELECT utilisateursLogin as username, utilisateursMotDePasse ,enabled ,
utilisateursNom , utilisateursPrenom FROM utilisateurs WHERE utilisateursLogin = ?"
authorities-by-username-query="SELECT utilisateursLogin as username, role FROM roles WHERE utilisateursLogin = ?" />-->
</security:authentication-manager>
<beans:bean id="myUserDetailsService"
class="org.springframework.security.core.userdetails.jdbc.JdbcDaoImpl">
<beans:property name="dataSource" ref="dataSource" />
<beans:property name="usersByUsernameQuery"
value="SELECT utilisateursLogin as username, utilisateursMotDePasse ,enabled ,
utilisateursNom , utilisateursPrenom FROM utilisateurs WHERE utilisateursLogin = ?" ></beans:property>
<beans:property name="authoritiesByUsernameQuery"
value="SELECT utilisateursLogin as username, role FROM roles WHERE utilisateursLogin = ?" />
</beans:bean>
</beans:beans> |
Partager