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()',它的依賴不注入。任何建議? –