Bonjour,

Je suis entrain de développer une page de test concernant spring security avec des page failure et pages success.J'ai deja tester mon code avec des username password et roles statiques et l'application marche par contre maintenant lorsque je veux stocker mes valeurs dans la base de données, et je lance l'application : j'ai toujours une redirection de la page login vers la page failure.

Est-ce-que vous pouvez m'aider s'il vous plait :

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
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
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:util="http://www.springframework.org/schema/util"
	xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx"
	xmlns:security="http://www.springframework.org/schema/security"
	xsi:schemaLocation="http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.1.xsd
		http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
		http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.1.xsd
		http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.1.xsd
		http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.1.xsd">
 
 
	<security:http use-expressions="true"
		access-denied-page="/faces/errors/no-access.xhtml">
		<security:intercept-url pattern="/faces/**/open*.xhtml"
			access="hasRole('Recruteur')" />
		<security:intercept-url pattern="/faces/**"
			access="permitAll" />
		<security:intercept-url pattern="/**" access="denyAll" />
 
		<security:form-login login-processing-url="/faces/j_spring_security_check"
			login-page="/faces/pages/login.xhtml" always-use-default-target="true"
			default-target-url="/faces/pages/index.xhtml"
			authentication-failure-url="/faces/errors/login-failure.xhtml" />
		<security:logout />
 
	</security:http>
 
	<security:authentication-manager>
		<security:authentication-provider>
			<security:jdbc-user-service id="jdbcMemoryAP"
				data-source-ref="dataSource"
				users-by-username-query="
		      select EMAIL,PASSWORD,enabled 
		      from administrateur where EMAIL=?" 
 
				 authorities-by-username-query="
		      select u.EMAIL, ur.autorite from administrateur u, role ur 
		      where u.IdAdmin = ur.administrateur and u.EMAIL =? "  />
		</security:authentication-provider>
	</security:authentication-manager>
 
 
 
 
 
 
	<bean id="sessionFactory"
		class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean"
		lazy-init="true">
		<property name="dataSource" ref="dataSource" />
		<property name="annotatedClasses">
			<list>
 
				<value>com.model.Administrateur</value>
								<value>com.model.Role</value>
 
 
			</list>
		</property>
		<property name="exposeTransactionAwareSessionFactory">
			<value>false</value>
		</property>
 
		<property name="hibernateProperties">
			<props>
				<prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>
				<prop key="hibernate.show_sql">true</prop>
				<prop key="hibernate.use_outer_join">true</prop>
				<prop key="hibernate.max_fetch_depth">3</prop>
				<prop key="hibernate.jdbc.batch_size">0</prop>
				<prop key="hibernate.cache.provider_class">org.hibernate.cache.EhCacheProvider</prop>
				<prop key="hibernate.cache.use_query_cache">true</prop>
				<prop key="hibernate.current_session_context_class">thread</prop>
 
			</props>
		</property>
	</bean>
	<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"
		destroy-method="close" lazy-init="true">
		<property name="driverClassName" value="com.mysql.jdbc.Driver" />
		<property name="url" value="jdbc:mysql://localhost:3306/recrutement" />
		<property name="username" value="root" />
		<property name="password" value="root" />
 
	</bean>
 
 
</beans>

dans ma table rôle j'ai un id, username, autorité et clé étrangère administrateur