Class: OmniAuth::Strategies::Developer

Inherits:
Object
  • Object
show all
Includes:
OmniAuth::Strategy
Defined in:
lib/omniauth/strategies/developer.rb

Overview

The Developer strategy is a very simple strategy that can be used as a placeholder in your application until a different authentication strategy is swapped in. It has zero security and should never be used in a production setting.

Usage

To use the Developer strategy, all you need to do is put it in like any other strategy:

This will create a strategy that, when the user visits /auth/developer they will be presented a form that prompts for (by default) their name and email address. The auth hash will be populated with these fields and the uid will simply be set to the provided email.

Examples:

Basic Usage


use OmniAuth::Builder do
  provider :developer
end

Custom Fields


use OmniAuth::Builder do
  provider :developer,
    :fields => [:first_name, :last_name],
    :uid_field => :last_name
end

Constant Summary

Constants included from OmniAuth::Strategy

OmniAuth::Strategy::CURRENT_PATH_REGEX, OmniAuth::Strategy::EMPTY_STRING

Instance Attribute Summary

Attributes included from OmniAuth::Strategy

#app, #env, #options, #response

Instance Method Summary collapse

Methods included from OmniAuth::Strategy

#auth_hash, #call, #call!, #call_app!, #callback_call, #callback_path, #callback_phase, #callback_url, #credentials, #current_path, #custom_path, #extra, #fail!, #full_host, included, #info, #initialize, #inspect, #log, #mock_call!, #mock_callback_call, #mock_request_call, #name, #on_auth_path?, #on_callback_path?, #on_path?, #on_request_path?, #options_call, #options_request?, #path_prefix, #query_string, #redirect, #request, #request_call, #request_path, #script_name, #session, #setup_path, #setup_phase, #skip_info?, #uid, #user_info, #warn_if_using_get_on_request_path

Instance Method Details

#request_phaseObject



37
38
39
40
41
42
43
44
# File 'lib/omniauth/strategies/developer.rb', line 37

def request_phase
  form = OmniAuth::Form.new(:title => 'User Info', :url => callback_path, :method => 'get')
  options.fields.each do |field|
    form.text_field field.to_s.capitalize.tr('_', ' '), field.to_s
  end
  form.button 'Sign In'
  form.to_response
end