Module OmniAuth::Strategy
In: lib/omniauth/strategy.rb

The Strategy is the base unit of OmniAuth‘s ability to wrangle multiple providers. Each strategy provided by OmniAuth includes this mixin to gain the default functionality necessary to be compatible with the OmniAuth library.

Methods

Classes and Modules

Module OmniAuth::Strategy::ClassMethods
Class OmniAuth::Strategy::Options

Constants

CURRENT_PATH_REGEX = %r{/$}
EMPTY_STRING = ''.freeze

Attributes

app  [R] 
env  [R] 
options  [R] 
response  [R] 

Public Class methods

Initializes the strategy by passing in the Rack endpoint, the unique URL segment name for this strategy, and any additional arguments. An `options` hash is automatically created from the last argument if it is a hash.

@param app [Rack application] The application on which this middleware is applied.

@overload new(app, options = {})

  If nothing but a hash is supplied, initialized with the supplied options
  overriding the strategy's default options via a deep merge.

@overload new(app, *args, options = {})

  If the strategy has supplied custom arguments that it accepts, they may
  will be passed through and set to the appropriate values.

@yield [Options] Yields options to block for further configuration.

Public Instance methods

Duplicates this instance and runs call! on it. @param [Hash] The Rack environment.

The logic for dispatching any additional actions that need to be taken. For instance, calling the request phase if the request path is recognized.

@param env [Hash] The Rack environment.

Performs the steps necessary to run the callback phase of a strategy.

Direct access to the OmniAuth logger, automatically prefixed with this strategy‘s name.

@example

  log :warn, "This is a warning."

This is called in lieu of the normal request process in the event that OmniAuth has been configured to be in test mode.

Returns true if the environment recognizes either the request or callback path.

Responds to an OPTIONS request.

Performs the steps necessary to run the request phase of a strategy.

@abstract This method is called when the user is on the request path. You should perform any information gathering you need to be able to authenticate the user in this phase.

The setup phase looks for the `:setup` option to exist and, if it is, will call either the Rack endpoint supplied to the `:setup` option or it will call out to the setup path of the underlying application. This will default to `/auth/:provider/setup`.

Determines whether or not user info should be retrieved. This allows some strategies to save a call to an external API service for existing users. You can use it either by setting the `:skip_info` to true or by setting `:skip_info` to a Proc that takes a uid and evaluates to true when you would like to skip info.

@example

  use MyStrategy, :skip_info => lambda{|uid| User.find_by_uid(uid)}

Protected Instance methods

[Validate]