我想做类似的事情:
class MySpec extends Specification{
def 'test'(){
given: 'a user that has its password encoded by SpringSecurity'
def user = new SecUser(username: 'blah', password: 'p').save(flush:true)
MessageDigest md = MessageDigest.getInstance('MD5')
md.update('p'.getBytes('UTF-8'))
expect: 'the password should be encoded with MD5 algorithm'
user.password == (new BASE64Encoder()).encode(md.digest())
}
}
在我的 Config.groovy 中,我添加了以下行:
grails.plugins.springsecurity.password.algorithm="MD5"
这不起作用(断言失败)。有任何想法吗??