Logowanie za pomocą Spring Security

0

Próbuję stworzyć system logowania za pomocą Spring Security, lecz napotkałem pewien problem. Problem jest w miejscu

<authentication-manager>
        <authentication-provider>
            <jdbc-user-service data-source-ref="dataSource"
                               users-by-username-query=
                                       "SELECT Username, Password FROM users WHERE Username=?"
                               authorities-by-username-query=
                                       "SELECT Username, ‘ROLE_USER’ FROM users WHERE Username=?"/>
        </authentication-provider>
</authentication-manager>

podczas logowania wyrzuca mi błędy

01-Apr-2017 20:34:32.108 SEVERE [http-nio-8080-exec-6] org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter.doFilter An internal error occurred while trying to authenticate the user.
 org.springframework.security.authentication.InternalAuthenticationServiceException: For input string: "myPassword"

właśnie 'myPassword' to jest hasło do konta. Jak błędnie wpisuję jakieś dane to jest OK, ale jak wpiszę poprawne dane do zalogowania to wywala taki błąd i przechodzi na zadeklarowany

authentication-failure-url="/error"

W bazie użytkownicy mają pola ID, Username, Email, Password, ROLE_USER

Konfiguracja spring-security

<b:beans xmlns="http://www.springframework.org/schema/security"
         xmlns:b="http://www.springframework.org/schema/beans"
         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.xsd
                        http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security.xsd">
    <b:import resource="applicationContext.xml" />
 
    <http auto-config="true" use-expressions="true">
        <form-login login-page="/login"
                    default-target-url="/loginSuccessfully"
                    authentication-failure-url="/AA"
                    username-parameter="username"
                    password-parameter="password"/>
        <logout logout-success-url="/login"/>
        <csrf />
    </http>
 
    <authentication-manager>
        <authentication-provider>
            <jdbc-user-service data-source-ref="dataSource"
                               users-by-username-query=
                                       "SELECT Username, Password, Email FROM users WHERE Username=?"
                               authorities-by-username-query=
                                       "SELECT Username, ‘ROLE_USER’ FROM users WHERE Username=?"/>
        </authentication-provider>
    </authentication-manager>
 
</b:beans>

https://zapodaj.net/86ca500b9e96f.png.html

No i wysyłka formularza https://pastebin.com/UPwWZ11t

0

Co się dzieje jak wywalisz te dwie linijki z failure i target?

<form-login login-page="/login"
                    username-parameter="username"
                    password-parameter="password"/>
0

2017 a ludzie dalej klepią w XMLu...

1 użytkowników online, w tym zalogowanych: 0, gości: 1