Spring Grails3-没有插件的安全性

Spring Grails3-没有插件的安全性,spring,grails,spring-security,Spring,Grails,Spring Security,我在Grails3.x应用程序上使用SAML实现Spring安全性,而不使用插件 我已经添加了必要的罐子,如下所示: compile group: 'ca.juliusdavies', name: 'not-yet-commons-ssl', version: '0.3.17' compile 'org.opensaml:opensaml:2.6.0' compile 'org.opensaml:openws:1.4.1' compile 'org.ope

我在Grails3.x应用程序上使用SAML实现Spring安全性,而不使用插件

我已经添加了必要的罐子,如下所示:

     compile group: 'ca.juliusdavies', name: 'not-yet-commons-ssl', version: '0.3.17'
     compile 'org.opensaml:opensaml:2.6.0'
     compile 'org.opensaml:openws:1.4.1'
     compile 'org.opensaml:xmltooling:1.3.1'
     compile group: 'org.springframework.security', name: 'spring-security-core', version: '3.2.5.RELEASE'
     compile group: 'org.springframework.security', name: 'spring-security-config', version: '3.2.5.RELEASE'
     compile group: 'org.springframework.security.extensions', name: 'spring-security-saml2-core', version: '1.0.5.BUILD-SNAPSHOT'
我的securitycontext.xml文件集成在resources.groovy中

beans = {
        importBeans('classpath:security/springSecuritySamlBeans.xml')
}
我需要在my web.xml中添加以下安全过滤器,但在Grails 3中这是不可能的。有人能建议在哪里添加这些过滤器以及如何添加它们吗

<filter>
        <filter-name>springSecurityFilterChain</filter-name>
        <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
    </filter>
    <filter-mapping>
        <filter-name>springSecurityFilterChain</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>

springSecurityFilterChain
org.springframework.web.filter.DelegatingFilterProxy
springSecurityFilterChain
/*
据我所知,这些过滤器需要在resources.groovy中定义,但我不确定这是如何实现的

我需要在我的web.xml中添加以下安全过滤器,但在 Grails3这是不可能的


您可能真的不需要将它们添加到
web.xml
中。你可能只需要将它们应用到你的应用程序中。在Grails3中实现这一点的一种方法是使用
FilterRegistrationBean
。有关几个示例,请参见。您可能希望在应用程序的
资源中执行类似的操作。groovy

在我看来,这听起来仍然很麻烦。与此相反,如果您不清楚发生了什么,您可以将您的用户注册工作流委托给第三方服务,例如Firebase


用一个拦截器来写

请参考“在我看来,这听起来仍然很麻烦。”-我不理解这句话。问题与不知道如何在Grails3中注册servlet过滤器有关,解决方案是向
resources.groovy
添加一条语句。这看起来并不麻烦,这是关于如何在Grails3中注册servlet过滤器的最佳实践。如果问题是关于管理注册工作流的最佳实践是什么,那么这里给出的答案将更合适。这仍然不是我同意的答案,但至少是对这个问题的一个有效答案。事实上,这并不能回答所提出的问题。