【发布时间】:2014-11-02 06:58:01
【问题描述】:
这很奇怪。身份验证工作正常,但是当我今天启动该项目时,它不再工作了。我完全不知道有什么问题。当我输入正确的数据(是的,我 100% 确定它是正确的)并对其进行调试时,SPRING_SECURITY_LAST_EXCEPTION 包含 BadCredentialsException。这是我的 UserDetailsService 类返回的内容:
如您所见,它从数据库中获取信息,构建用户并返回它,但 Spring Security 出于某种原因发疯了。
我的安全配置:
<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 和惰性获取类型将我的帐户表与另一个帐户表相关联,但我认为这与此无关。
【问题讨论】:
标签: java spring spring-mvc authentication spring-security