grails spring-security-core / ui默认创建锁定的用户帐户

时间:2017-11-13 04:10:22

标签: grails spring-security

我正在构建一个无法访问电子邮件的简单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,但无济于事。

0 个答案:

没有答案