Class: OmniAuth::AuthenticityTokenProtection

Inherits:
Rack::Protection::AuthenticityToken show all
Defined in:
sig/omniauth.rbs,
lib/omniauth/authenticity_token_protection.rb

Overview

Raises AuthenticityError unless the request has a valid CSRF token.

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ AuthenticityTokenProtection

Used as a validation hook rather than as middleware, so there's no app.

Parameters:

  • options (Hash[Symbol, untyped]) (defaults to: {})


8
9
10
# File 'lib/omniauth/authenticity_token_protection.rb', line 8

def initialize(options = {})
  super(nil, options)
end

Class Method Details

.call(env) ⇒ void

This method returns an undefined value.

Parameters:

  • (env)


12
13
14
# File 'lib/omniauth/authenticity_token_protection.rb', line 12

def self.call(env)
  new.call!(env)
end

Instance Method Details

#call!(env) ⇒ void Also known as: call

This method returns an undefined value.

Parameters:

  • (env)


16
17
18
19
20
21
# File 'lib/omniauth/authenticity_token_protection.rb', line 16

def call!(env)
  return if accepts?(env)

  instrument env
  react env
end