允许方法的Grails的Spring Security插件使用interceptMap被公开 [英] Allowing a method to be public using interceptMap in Grails Spring Security plugin

查看:298
本文介绍了允许方法的Grails的Spring Security插件使用interceptMap被公开的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我怎样才能打开的控制装置的方法,利用公众与interceptMap Grails的Spring Security的插件?

我有这样一个网址:

<$p$p><$c$c>http://localhost:8080/testapp/user/showIdentity?token=2&userID=b18cac92f0636da8fcd464d5b595b9aba86b5f11

所以在我的interceptMap我有:

  grails.plugin.springsecurity.interceptUrlMap = [
    '/':['permitAll'],
    '/指数':'permitAll'],
    '/index.gsp':['permitAll'],
    / ** / JS / **':'permitAll'],
    / ** / CSS / **':'permitAll'],
    / ** /图像/ **':'permitAll'],
    '/**/favicon.ico':['permitAll'],
    '/登录/ **':'permitAll'],
    '/注销/ **':'permitAll'],
    / **':'ROLE_ADMIN']
    ]

什么是允许控制器permitAll的showIdentity的方法和的控制器方法作为ROLE_ADMIN其余是控制器的默认的方式?

我知道在Spring Security ACL插件,我们可以做更多的东西,但我想知道如果我可以使用Spring Security插件,只是做到这一点。


解决方案

添加这两个应该这样做:

 /用户/ showIdentity':'permitAll'],
'/user/showIdentity.*':['permitAll'],

需要像 /user/showIdentity.xml 请求第二之一。其他 /用户/ ** 请求将由匹配/ ** 规则。

How can I open up a method of a controller to public using interceptMap with Grails Spring Security Plugin ?

I have a url like this:

http://localhost:8080/testapp/user/showIdentity?token=2&userID=b18cac92f0636da8fcd464d5b595b9aba86b5f11

So in my interceptMap I have:

grails.plugin.springsecurity.interceptUrlMap = [
    '/':                  ['permitAll'],
    '/index':             ['permitAll'],
    '/index.gsp':         ['permitAll'],
    '/**/js/**':          ['permitAll'],
    '/**/css/**':         ['permitAll'],
    '/**/images/**':      ['permitAll'],
    '/**/favicon.ico':    ['permitAll'],
    '/login/**':          ['permitAll'],
    '/logout/**':         ['permitAll'],        
    '/**':         ['ROLE_ADMIN']   
    ]

What is the way to allow "showIdentity" method of the controller as permitAll and the rest of the controller methods as ROLE_ADMIN which is the controller's default ?

I know with Spring Security ACL Plugin we can do more stuff, but I was wondering if I could use Spring Security Plugin and just do this.

解决方案

Adding these two should do it:

'/user/showIdentity':   ['permitAll'],
'/user/showIdentity.*': ['permitAll'],

The 2nd one is needed for requests like /user/showIdentity.xml. Other /user/** requests will be matched by the /** rule.

这篇关于允许方法的Grails的Spring Security插件使用interceptMap被公开的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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