gpt4 book ai didi

spring - Grails Spring Security Core插件无法正常工作

转载 作者:行者123 更新时间:2023-12-02 15:44:35 25 4
gpt4 key购买 nike

我正在尝试将grails 3.3.5的Spring Security插件3.2.1。

以下是我在应用程序常规中的静态规则

[pattern: '/error',          access: ['permitAll']],
[pattern: '/index', access: ['permitAll']],
[pattern: '/index.gsp', access: ['permitAll']],
[pattern: '/shutdown', access: ['permitAll']],
[pattern: '/assets/**', access: ['permitAll']],
[pattern: '/fonts/**', access: ['permitAll']],
[pattern: '/**/js/**', access: ['permitAll']],
[pattern: '/**/css/**', access: ['permitAll']],
[pattern: '/**/images/**', access: ['permitAll']],
[pattern: '/**/favicon.ico', access: ['permitAll']],
[pattern: '/user/**', access: 'ROLE_USER'],
[pattern: '/admin/**', access:['ROLE_ADMIN','isFullyAuthenticated()']],
[pattern: '/inputParam/chipInput/', access: 'isAuthenticated()',httpMethod: 'PUT']



grails.plugin.springsecurity.filterChain.chainMap = [
[pattern: '/assets/**', filters: 'none'],
[pattern: '/**/js/**', filters: 'none'],
[pattern: '/**/css/**', filters: 'none'],
[pattern: '/**/images/**', filters: 'none'],
[pattern: '/**/favicon.ico', filters: 'none']

但它仍然允许用户和/ inputParam / chipInput /页面无需登录。我已经在两个 Controller 中都添加了安全注释@Secured('ROLE_USER')。我究竟做错了什么?

最佳答案

在我看来,该模式可能不正确和/或访问表达式不正确。尝试将规则更改为:

[pattern: '/inputParam/chipInput', access: ["isAuthenticated() and request.getMethod().equals('PUT')"]

参见 section on expressions in Grails Spring Security Core docs

关于spring - Grails Spring Security Core插件无法正常工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50496117/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com