Redmine:422无效形式真实性令牌

时间:2015-02-25 12:58:31

标签: ruby authentication single-sign-on redmine redmine-plugins

我正在使用this插件在我的IDP和redmine之间启用SSO。目的是避免在登录redmine时重新输入用户名和密码。 Redmine和IDP都连接到外部LDAP。问题是从我的IDP重定向回redmine(输入用户名和密码后),它给出了这个错误。

Redmine版本:2.5.2, Ruby版本:1.9.3, Rails版本:3.2.19

error

3 个答案:

答案 0 :(得分:3)

Redmine 3.4.2

的一些细节

如果您收到错误422(无法验证CSRF令牌真实性), 你必须去控制器文件

/app/controller/aplication_controller.rb

并删除或注释带代码的字符串

render_error :status => 422, :message => "invalid form authenticity token."

然后添加代码

redirect_back_or_default(home_path)

所以,你的代码将是这样的

# render_error :status => 422, :message => "invalid form authenticity token."
redirect_back_or_default(home_path) 

答案 1 :(得分:0)

对于我们来说,当已经登录的用户尝试重新登录时(例如,使用多个浏览器选项卡),会出现此错误。 解决方案是here,补丁application_controller.rb:

-    render_error "Invalid form authenticity token." 
+    redirect_back_or_default home_path

答案 2 :(得分:0)

使用反向代理SSO时,这发生在我们身上。 SSO中配置的名称与Redmine中的用户名大小写不同。

从nginx配置中提取:

                       # Pass the user to that stupid Passenger Phusion
                       # that cannot evaluate variables like $http_x_forwarded_user
                       passenger_env_var REMOTE_USER nicolasm;

我们在Redmine中的用户名为NicolasM

按照其他答案的建议取消安全性不是持久的解决方案。

相关问题