class OmniAuth::Configuration
Attributes
Public Class Methods
Source
# File lib/omniauth.rb, line 31 def self.default_logger logger = Logger.new(STDOUT) logger.progname = 'omniauth' logger end
Source
# File lib/omniauth.rb, line 37 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
Source
# File lib/omniauth.rb, line 56 def initialize self.class.defaults.each_pair { |k, v| send("#{k}=", v) } end
Public Instance Methods
Source
# File lib/omniauth.rb, line 125 def add_camelization(name, camelized) camelizations[name.to_s] = camelized.to_s end
This is a convenience method to be used by strategy authors so that they can add special cases to the camelization utility method that allows OmniAuth::Builder
to work.
@param name [String] The underscored name, e.g. ‘oauth` @param camelized [String] The properly camelized name, e.g. ’OAuth’
Source
# File lib/omniauth.rb, line 100 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
Source
# File lib/omniauth.rb, line 68 def before_callback_phase(&block) if block_given? @before_callback_phase = block else @before_callback_phase end end
Source
# File lib/omniauth.rb, line 76 def before_options_phase(&block) if block_given? @before_options_phase = block else @before_options_phase end end
Source
# File lib/omniauth.rb, line 92 def before_request_phase(&block) if block_given? @before_request_phase = block else @before_request_phase end end
Source
# File lib/omniauth.rb, line 60 def on_failure(&block) if block_given? @on_failure = block else @on_failure end end
Source
# File lib/omniauth.rb, line 84 def request_validation_phase(&block) if block_given? @request_validation_phase = block else @request_validation_phase end end