Spring安全休息插件:基于令牌的身份验证

时间:2015-04-02 08:27:41

标签: rest grails spring-security spring-security-rest

我正在努力成功整合Spring security rest plugin

但我经常失败,我正在使用memcahed进行令牌存储。我用来实现插件的Config.groovy设置是:

//login end point url

grails.plugin.springsecurity.rest.login.active=true
grails.plugin.springsecurity.rest.login.endpointUrl='/api/login'
grails.plugin.springsecurity.rest.login.failureStatusCode='401'

//for  memcached
grails.plugin.springsecurity.rest.token.storage.useMemcached=false
grails.plugin.springsecurity.rest.token.storage.memcached.hosts='localhost:11211'
grails.plugin.springsecurity.rest.token.storage.memcached.username=''
grails.plugin.springsecurity.rest.token.storage.memcached.password=''
grails.plugin.springsecurity.rest.token.storage.memcached.expiration=3600

//token generation
grails.plugin.springsecurity.rest.token.generation.useSecureRandom=true
grails.plugin.springsecurity.rest.token.generation.useUUID=false

我通过Post man rest client通过

/api/login上发出请求
{
    "username": "john.doe",
    "password": "dontTellAnybody"
}

json数据,但它给了我spring security auth页面的html作为响应,我做了一些错误的配置吗?是否需要进一步的配置。我提到我正在使用memcache进行令牌存储。任何想法对我都有帮助

修改:请参阅logs文件

Edit2 :请查看此log文件

0 个答案:

没有答案