Class: OmniAuth::Strategies::OpenID

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

Overview

OmniAuth strategy for connecting via OpenID. This allows for connection to a wide variety of sites, some of which are listed on the OpenID website.

Direct Known Subclasses

GoogleApps, GoogleHybrid, Steam

Constant Summary collapse

IDENTIFIER_URL_PARAMETER =
'openid_url'
AX =
{
  :email => 'http://axschema.org/contact/email',
  :name => 'http://axschema.org/namePerson',
  :nickname => 'http://axschema.org/namePerson/friendly',
  :first_name => 'http://axschema.org/namePerson/first',
  :last_name => 'http://axschema.org/namePerson/last',
  :city => 'http://axschema.org/contact/city/home',
  :state => 'http://axschema.org/contact/state/home',
  :website => 'http://axschema.org/contact/web/default',
  :image => 'http://axschema.org/media/image/aspect11'
}

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(app, store = nil, options = {}, &block) ⇒ OpenID

Initialize the strategy as a Rack Middleware.

Options Hash (options):

  • :required (Array)

    The identity fields that are required for the OpenID request. May be an ActiveExchange schema URL or an sreg identifier.

  • :optional (Array)

    The optional attributes for the OpenID request. May be ActiveExchange or sreg.

  • :name (Symbol, :open_id)

    The URL segment name for this provider.



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

def initialize(app, store = nil, options = {}, &block)
  super(app, (options[:name] || :open_id), &block)
  @options = options
  @options[:required] ||= [AX[:email], AX[:name], AX[:first_name], AX[:last_name], 'email', 'fullname']
  @options[:optional] ||= [AX[:nickname], AX[:city], AX[:state], AX[:website], AX[:image], 'postcode', 'nickname']
  @store = store
end

Instance Attribute Details

#optionsObject

Returns the value of attribute options



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

def options
  @options
end