简体   繁体   English

Grails Spring安全核心插件

[英]Grails Spring Security Core Plugin

I am (finally) upgrading my Acegi plugin to Spring Security Core. 我(最终)将我的Acegi插件升级到Spring Security Core。 At the same time, I am upgrading from Grails 1.3.7 to 2.0. 同时,我将从Grails 1.3.7升级到2.0。 My site was fully functional before, but now when I try to get to my default page (which is IS_AUTHENTICATED_ANONYMOUSLY ) I am redirected to the auth action of my LoginController . 我的网站以前可以正常运行,但是现在当我尝试进入默认页面(即IS_AUTHENTICATED_ANONYMOUSLY )时,我被重定向到LoginControllerauth操作。 This method was never invoked with Acegi, so I don't know what the problem is. Acegi从未调用过此方法,所以我不知道问题出在哪里。 Have I set up my configuration wrong or is there something else I need to be thinking about? 我的配置错误吗?还是需要考虑其他事项?

grails.plugins.springsecurity.securityConfigType = SecurityConfigType.InterceptUrlMap

    grails.plugins.springsecurity.interceptUrlMap  = [
                '/blog/**':['IS_AUTHENTICATED_ANONYMOUSLY'],
                '/static/**':['IS_AUTHENTICATED_ANONYMOUSLY'],
                '/consensus/**':['IS_AUTHENTICATED_FULLY'],
                '/login/**':['IS_AUTHENTICATED_ANONYMOUSLY'],
                '/signup/**':['IS_AUTHENTICATED_ANONYMOUSLY'],
                '/home/**':['IS_AUTHENTICATED_FULLY'],
                '/test/**':['ROLE_ADMIN'],
                '/admin/**':['ROLE_ADMIN'],
                '/adminmanage/**':['ROLE_ADMIN'],
                '/quartz/**':['ROLE_ADMIN'],
                '/**/*.css':['IS_AUTHENTICATED_ANONYMOUSLY'],
                '/js/**':['IS_AUTHENTICATED_ANONYMOUSLY'],
                '/images/**':['IS_AUTHENTICATED_ANONYMOUSLY'],
                '/monitoring**':['ROLE_ADMIN'],
                '/**':['IS_AUTHENTICATED_FULLY']
            ]

My UrlMappings.groovy is: 我的UrlMappings.groovy是:

class UrlMappings {
    static mappings = {
        "/"(controller:"x", action:"y")
        "/z/?"(controller:"x", action:"y")
        "/$controller/$action?/$id?"
                {
                    constraints {
                        // apply constraints here
                    }
                }
        "500"(view: '/error')
    }
}

I have been reading through the documentation but am having some problems, so I am not sure if there is more relevant code one would need to see. 我一直在阅读文档,但是遇到了一些问题,所以我不确定是否需要查看更多相关代码。 If there is, please let me know and I will add it. 如果有,请告诉我,我将添加它。 Thanks. 谢谢。

Other options in my Config.groovy were incorrect and this caused the problem. 我的Config.groovy中的其他选项不正确,这导致了问题。 Once I corrected them everything worked fine. 一旦我纠正了它们,一切都会很好。

Despite it being called out in the documentation, I had security fields that were not prepended with grails.plugins.springsecurity This caused the engine not to recognize them, which for some reason resulted in the call to auth . 尽管在文档中对此进行了grails.plugins.springsecurity ,但是我没有在grails.plugins.springsecurity添加安全字段,这导致引擎无法识别它们,出于某种原因导致调用auth

After remove openid plugin all requests redirects me to the login page! 删除openid插件后,所有请求都将我重定向到登录页面! I don't know what to do... I've already remove everything related. 我不知道该怎么办...我已经删除了所有相关内容。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM