這很奇怪。身份驗證工作正常,但是當我今天啓動該項目時,它不再工作。我完全不知道是什麼問題。當我輸入CORRECT數據(是的,我100%確定它是正確的),並調試它時,SPRING_SECURITY_LAST_EXCEPTION包含BadCredentialsException。下面是由我的UserDetailsService類返回: 春季安全突然停止認證,即使它工作正常
因此,大家可以看到,它從數據庫中的信息,建立用戶和返回,但春天安全瘋出於某種原因。
我的安全配置:
<context:component-scan base-package="pl.sikor.security" />
<http use-expressions="true">
<intercept-url pattern="/game/**" access="isAuthenticated()"/>
<intercept-url pattern="/**" access="permitAll"/>
<form-login password-parameter="password" username-parameter="username" login-page="/login"
default-target-url="/game/profile" login-processing-url="/processLogin" authentication-failure-url="/login"/>
<logout logout-url="/game/logout" logout-success-url="/logout" delete-cookies="true" invalidate-session="true"/>
</http>
<authentication-manager alias="authenticationManager">
<authentication-provider user-service-ref="userDetailsServiceImpl">
<password-encoder ref="bCryptPasswordEncoder" />
</authentication-provider>
</authentication-manager>
<beans:bean id="bCryptPasswordEncoder" class="org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder"/>
我沒有任何過濾器,springSecurityFilterChain是唯一的一個,所以我想世界上沒有點我的貼web.xml中任何幫助將非常感激。這讓我瘋狂。
順便說一句,昨天,我使用@OneToOne和惰性獲取類型將帳戶表與另一個帳戶表關聯起來,但我認爲這與此無關。