Grails 3.3.9 spring security 3.2.3 spring security ui 3.1.2 无法更改用户数据

Posted

技术标签:

【中文标题】Grails 3.3.9 spring security 3.2.3 spring security ui 3.1.2 无法更改用户数据【英文标题】:Grails 3.3.9 spring security 3.2.3 spring security ui 3.1.2 cannot change user data 【发布时间】:2020-04-06 10:26:21 【问题描述】:

在 Grails 3.3.9 上使用 Spring Security core 3.2.3 我可以在 BootStrap.groovy 中添加一个用户,例如:

User u1 = new User(username: 'testuser1', password: 'finkaroney', email: 'any@any.com')
Role sur = Role.findByAuthority('ROLE_USER')
u1.save(flush: true)
UserRole.create(u1, sur, true)

现有用户也可以毫无问题地登录和退出。

使用 Spring Security UI 3.1.2 的界面,我可以列出用户、角色等。

但是使用 S2UI 3.1.2 我不能:

添加用户 删除用户 修改用户的参数,例如启用、帐户过期等

当我尝试执行这些操作时,通常会在浏览器窗口的右上角弹出一条消息。

例如,如果我尝试删除用户,我会看到此弹出窗口

Oops! That may not have been deleted. Either the form was submitted twice or possible CSRF attempt. Be careful what you click.

或者如果我尝试说让用户过期,我会看到这个弹出窗口

testuser1 may not have been updated. Either the form was submitted twice or possible CSRF attempt. Be careful what you click.

果然,第一种情况用户没有被删除,第二种情况他/她没有过期。

在我运行 Grails 的窗口中没有崩溃或任何其他相关消息。

这个应用程序已经通过了 Grails 和 Groovy 的几个次要和主要版本,所以如果在某个地方有一些杂乱无章的东西我不会感到惊讶。但是我不确定从哪里开始,也不确定如何开始寻找这种问题。

【问题讨论】:

【参考方案1】:

经过大量检查和诅咒等等,我今天注意到我的 gradle.properties 中报告的 Grails 版本设置为 3.3.3 而不是 3.3.9。更正后,我的 UI 现在可以正确更改和删除用户。

【讨论】:

以上是关于Grails 3.3.9 spring security 3.2.3 spring security ui 3.1.2 无法更改用户数据的主要内容,如果未能解决你的问题,请参考以下文章

Grails - grails-spring-security-rest - 无法从 application.yml 加载 jwt 机密

grails-spring-security-rest 插件和悲观锁定

Grails + spring-security-core:用户登录后如何分配角色?

Grails Spring Security注释问题

Grails Spring Security 插件网址

Grails spring-security-oauth-google:如何设置