Bonjour a tous,
j'ai un problème d'identification avec mon application spring.
Voici ma configuration xml :
Que je passe par "http-basic" ou "form-login" tout fonctionne si j'utilise "user-service". Par contre aucun ne fonctionne si j'utilise "jdbc-user-service".
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 <http auto-config="true" use-expressions="true" > <intercept-url pattern="/*" access="hasAnyRole('ROLE_1','ROLE_3'" /> <form-login login-page="/login.jsp" default-target-url="/rechercheApp.do" authentication-failure-url="/login.jsp?access=denied"></form-login> <!-- OU <http-basic/> --> </http> <authentication-manager> <authentication-provider> <jdbc-user-service data-source-ref="dataSource" users-by-username-query="SELECT Login as username, Password as password FROM USERS WHERE Login=?" authorities-by-username-query="SELECT Role as authorities FROM USERS WHERE Login=?" /> <!-- <user-service> <user name="toto" password="tata" authorities="ROLE_1,ROLE_2" /> </user-service>--> </authentication-provider> </authentication-manager>
La connexion a la base de donnée est OK.
Seul "subtibilité" c'est que ma base de donnée utilisateurs contient également les rôles (séparé par des "," )
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11 CREATE TABLE `USERS` ( `ID` int(11) NOT NULL auto_increment, `Login` varchar(256) NOT NULL, `Password` varchar(256) default NULL, `Role` varchar(256) default NULL, PRIMARY KEY (`ID`) ) INSERT INTO `USERS` (`ID`, `Login`, `Password`, `Role`) VALUES (1, 'toto', 'tata', 'ROLE_1,ROLE_2'),
Savez vous vers quoi je devrais m'orienter ??
Merci a vous !
Partager