如何使用Grails Spring安全性插件(Requestmap) [英] how used Grails Spring Security Plugin (Requestmap)

查看:88
本文介绍了如何使用Grails Spring安全性插件(Requestmap)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须在哪里写这个?

Where I must write this?

new Requestmap(url: '/*', configAttribute: 'IS_AUTHENTICATED_ANONYMOUSLY').save();

推荐答案

Information obtained from Dynamic Request Maps section on Spring.io's blog post titled "Simplified Spring Security with Grails".

要启用此机制,请将以下内容添加到Config.groovy:

To enable this mechanism, add the following to Config.groovy:

import grails.plugins.springsecurity.SecurityConfigType
...
grails.plugins.springsecurity.securityConfigType = SecurityConfigType.Requestmap

您要做的就是创建Requestmap域的实例 类,例如在BootStrap.groovy中:

All you then have to do is create instances of the Requestmap domain class, for example in BootStrap.groovy:

new Requestmap(url: '/timeline', configAttribute: 'ROLE_USER').save()
new Requestmap(url: '/person/*', configAttribute: 'IS_AUTHENTICATED_REMEMBERED').save()
new Requestmap(url: '/post/followAjax', configAttribute: 'ROLE_USER').save()
new Requestmap(url: '/post/addPostAjax', configAttribute: 'ROLE_USER,IS_AUTHENTICATED_FULLY').save()
new Requestmap(url: '/**', configAttribute: 'IS_AUTHENTICATED_ANONYMOUSLY').save() 

这篇关于如何使用Grails Spring安全性插件(Requestmap)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆