Spring Security 4, hibernate 5 and Wildfly 9 does not log

0

Good morning, I would like to ask for your help. I created a project with Spring Security and Hibernate 5 and I'm trying to make Spring manage my transactions with hibernate, it's already opening the login page normally, but I try to log in and say I missed the login, but I already checked all the data I know it's not that. If you can help me, I'd appreciate it. Below is the source code for the applicationContext.xml.

<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

link link link " >     

    <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>

    
asked by anonymous 17.09.2016 / 14:58

1 answer

0

Good people, I did not get help, but anyway I'll leave the correction here, reading the spring migration documentation from 3.x to 4.x finding out that you should add this code

username-parameter="j_username" password-parameter="j_password" no form-login

It expects the user and password. I hope this helps others.

    
06.10.2016 / 01:59