0
我想要做的事,如:测试断言SpringSecurity编码的密码
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 “
这不起作用(断言失败)。有任何想法吗??
我不能在我的规范注入springSecurityService,如果我初始化'新的SpringSecurityService()',它的依赖不注入。任何建议? –