Bonjour,
je développe une application web j2ee (jsf-spring-hibernate), je souhaite gérer la sécurisation avec spring security, le problème c'est que qu'on je souhaite m'authentifier le couple login/mot de passe n'est pas pris en compte.
voici le contenu de applicationContext-security.xml
j'extrais les données d'une seule table (personne) qui contient le login, le mot de passe et le role de l'utilisateur, merci d'avance pour votre aide.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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 <beans xmlns="http://www.springframework.org/schema/beans" xmlns:security="http://www.springframework.org/schema/security" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-2.0.4.xsd"> <security:http auto-config="true"> <security:intercept-url pattern="/pages/**" access="ROLE_ADMIN,ROLE_FORMATEUR" /> <security:form-login login-page='/login.jsf' default-target-url="/pages/index.jsf"/> </security:http> <security:authentication-provider user-service-ref='myUserDetailsService' /> <bean id="myUserDetailsService" class="org.springframework.security.userdetails.jdbc.JdbcDaoImpl"> <property name="dataSource" ref="dataSource"/> <property name="usersByUsernameQuery" value="SELECT p.matricule_pers as username, p.mdp_compte as password, enabled FROM personne p WHERE p.matricule_pers = ?"/> <property name="authoritiesByUsernameQuery" value="SELECT p.matricule_pers as username p.profil_compte as role FROM personne p WHERE p.matricule_pers = ?"/> </bean> </beans>
Partager