class OmniAuth::Configuration

def self.default_logger

def self.default_logger
  logger = Logger.new(STDOUT)
  logger.progname = 'omniauth'
  logger
end

def self.defaults # rubocop:disable MethodLength

rubocop:disable MethodLength
def self.defaults # rubocop:disable MethodLength
  @defaults ||= {
    :camelizations => {},
    :path_prefix => '/auth',
    :on_failure => OmniAuth::FailureEndpoint,
    :failure_raise_out_environments => ['development'],
    :request_validation_phase => OmniAuth::AuthenticityTokenProtection,
    :before_request_phase   => nil,
    :before_callback_phase  => nil,
    :before_options_phase   => nil,
    :form_css => Form::DEFAULT_CSS,
    :test_mode => false,
    :logger => default_logger,
    :allowed_request_methods => %i[post],
    :mock_auth => {:default => AuthHash.new('provider' => 'default', 'uid' => '1234', 'info' => {'name' => 'Example User'})},
    :silence_get_warning => false
  }
end

def add_camelization(name, camelized)

Parameters:
  • camelized (String) -- The properly camelized name, e.g. 'OAuth'
  • name (String) -- The underscored name, e.g. `oauth`
def add_camelization(name, camelized)
  camelizations[name.to_s] = camelized.to_s
end

def add_mock(provider, original = {})

def add_mock(provider, original = {})
  # Create key-stringified new hash from given auth hash
  mock = {}
  original.each_pair do |key, val|
    mock[key.to_s] = if val.is_a? Hash
                       Hash[val.each_pair { |k, v| [k.to_s, v] }]
                     else
                       val
                     end
  end
  # Merge with the default mock and ensure provider is correct.
  mock = mock_auth[:default].dup.merge(mock)
  mock['provider'] = provider.to_s
  # Add it to the mocks.
  mock_auth[provider.to_sym] = mock
end

def before_callback_phase(&block)

def before_callback_phase(&block)
  if block_given?
    @before_callback_phase = block
  else
    @before_callback_phase
  end
end

def before_options_phase(&block)

def before_options_phase(&block)
  if block_given?
    @before_options_phase = block
  else
    @before_options_phase
  end
end

def before_request_phase(&block)

def before_request_phase(&block)
  if block_given?
    @before_request_phase = block
  else
    @before_request_phase
  end
end

def initialize

def initialize
  self.class.defaults.each_pair { |k, v| send("#{k}=", v) }
end

def on_failure(&block)

def on_failure(&block)
  if block_given?
    @on_failure = block
  else
    @on_failure
  end
end

def request_validation_phase(&block)

def request_validation_phase(&block)
  if block_given?
    @request_validation_phase = block
  else
    @request_validation_phase
  end
end