[英]Devise + OmniAuth Saml: ActionController::InvalidAuthenticityToken
I am using Devise with OmniAuth for Saml. 我正在使用Devise和OmniAuth for Saml。 Saml callbacks do not post csrf token back and hence I get this error: Saml回调不会发回csrf令牌,因此我收到此错误:
ActionController::InvalidAuthenticityToken at /users/auth/saml/callback
So, to prevent CSRF check for my SAML call back, I added the :except
for saml
method. 因此,为了防止CSRF检查我的SAML回调,我添加了:except
saml
方法。 But that doesn't seem to work. 但这似乎不起作用。 What would be a way for me to prevent CSRF checks for SAML callbacks with Devise and OmniAuth? 使用Devise和OmniAuth阻止CSRF检查SAML回调的方法是什么?
Here is my OmniauthCallbacks
controller: 这是我的OmniauthCallbacks
控制器:
class Auth::OmniauthCallbacksController < Devise::OmniauthCallbacksController
protect_from_forgery :except => [:saml]
def saml
response = OneLogin::RubySaml::Response.new(params[:SAMLResponse])
raise response.to_yaml
# if response.is_valid?
# redirect_to root_url
# end
end
end
我在一个代码库中通过在控制器顶部使用这个位来解决这个问题:
skip_before_filter :verify_authenticity_token
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.