我正在构建一个无法访问电子邮件的简单grails应用程序。但是,spring-security-core
会创建默认情况下ACCOUNT_LOCKED
属性设置为TRUE
的用户。这意味着此类用户永远无法登录,因为他们无法解锁帐户。
是否有针对此行为的简单修复?
这是我的User
课程:
import groovy.transform.EqualsAndHashCode
import groovy.transform.ToString
import grails.compiler.GrailsCompileStatic
@GrailsCompileStatic
@EqualsAndHashCode(includes='username')
@ToString(includes='username', includeNames=true, includePackage=false)
class User implements Serializable {
private static final long serialVersionUID = 1
String username
String password
boolean enabled = true
boolean accountExpired
boolean accountLocked
boolean passwordExpired
Set<Role> getAuthorities() {
(UserRole.findAllByUser(this) as List<UserRole>)*.role as Set<Role>
}
static constraints = {
password nullable: false, blank: false, password: true
username nullable: false, blank: false, unique: true
}
static mapping = {
password column: '`password`'
}
}
我尝试将accountLocked
初始化为false
,但无济于事。