简体   繁体   English

Devise + OmniAuth Saml:ActionController :: InvalidAuthenticityToken

[英]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.

相关问题 设计错误-ActionController :: InvalidAuthenticityToken - Devise error - ActionController::InvalidAuthenticityToken Rails 5 +设计:ActionController :: InvalidAuthenticityToken - Rails 5 + Devise: ActionController::InvalidAuthenticityToken 获取用于设计登录和注册的ActionController :: InvalidAuthenticityToken(ActionController :: InvalidAuthenticityToken)错误 - Getting ActionController::InvalidAuthenticityToken (ActionController::InvalidAuthenticityToken) error for devise sign in and sign up Rails Devise-注销错误ActionController :: InvalidAuthenticityToken - Rails Devise - Logout error ActionController::InvalidAuthenticityToken Devise :: SessionsController#create错误中的ActionController :: InvalidAuthenticityToken - ActionController::InvalidAuthenticityToken in Devise::SessionsController#create error 摆脱ActionController :: InvalidAuthenticityToken(Rails 3,webrick,devise) - Getting rid of ActionController::InvalidAuthenticityToken (Rails 3, webrick, devise) ActionController::InvalidAuthenticityToken Rails 5 / 设计 / 审计 / PaperTrail gem - ActionController::InvalidAuthenticityToken Rails 5 / Devise / Audited / PaperTrail gem 使用omniauth-saml进行设计的配置 - configuration for devise with omniauth-saml ActionController::InvalidAuthenticityToken - ActionController::InvalidAuthenticityToken ActionController :: InvalidAuthenticityToken(ActionController :: InvalidAuthenticityToken):Rails 5 - ActionController::InvalidAuthenticityToken (ActionController::InvalidAuthenticityToken): Rails 5
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM