0
Good morning, folks, I’d like to ask for your help. I created a project with Spring Security and Hibernate 5 and I’m trying to get Spring to manage my transactions with Hibernate, is already opening the login page normally, but I try to log in says I missed the login, but I already checked all the login data, I know it’s not that. If you could help me, I’d appreciate it. Below follows applicationContext.xml source code.
<context:component-scan base-package="br.com.sga"/>
<context:property-placeholder location="classpath:jdbc.properties" />
<context:annotation-config/>
<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource"
p:driverClassName="org.postgresql.Driver" p:url="${jdbc.url}"
p:username="${jdbc.user}" p:password="${jdbc.password}">
</bean>
<bean id="sessionFactory"
class="org.springframework.orm.hibernate5.LocalSessionFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="configLocation">
<value>classpath:hibernate.cfg.xml</value>
</property>
</bean>
<bean id="transactionManager"
class="org.springframework.orm.hibernate5.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory" />
</bean>
<tx:annotation-driven />
Applicationcontext_security.xml
http://www.springframework.org/schema/beans/spring-beans-4.3.xsd http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-4.1.xsd">
<csrf disabled="true"/>
<intercept-url pattern="/admin/**" access="ROLE_ADMINISTRADOR" />
<intercept-url pattern="/restrito/**" access="ROLE_ADMINISTRADOR" />
<intercept-url pattern="/templates" access="ROLE_ADMINISTRADOR" />
<form-login login-page="/publico/login.jsf" login-processing-url="/j_spring_security_check"
always-use-default-target="true" default-target-url="/templates/layout.jsf"
authentication-failure-url="/publico/login.jsf?login_error=1" />
<logout delete-cookies="JSESSIONID" logout-success-url="/templates/layout.jsf"/>
<remember-me />
<session-management invalid-session-url="/publico/login.jsf" session-fixation-protection="migrateSession">
<concurrency-control max-sessions="1" expired-url="/publico/login.jsf" error-if-maximum-exceeded="true" />
</session-management>
</http>
<authentication-manager>
<authentication-provider>
<password-encoder hash="md5"/>
<jdbc-user-service data-source-ref="dataSource"
authorities-by-username-query="SELECT u.login, p.id_permissao
FROM usuario u, usuario_permissao p
WHERE u.id_usuario = p.id_usuario
AND u.login = ?"
users-by-username-query="SELECT login, senha, ativo
FROM usuario
WHERE login = ?" />
</authentication-provider>
</authentication-manager>