Class: ActionController::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/hobo_openid.rb

Class Method Summary collapse

Class Method Details

.openid_login(options = {}) ⇒ Object

Recognized options

:login_action     - default :openid_login
:complete_action  - default :complete_openid
:openid_opts      - forwarded to hobo_openid_login, hobo_openid_complete
:openid_opts recognizes
  :model        - class of your user model (required)
  :login        - field of params where users provide openIDs (default :login)
  :return_to    - page to return after OpenID auth. -> should point to action executing hobo_openid_complete
  :openid_field - field of your user model that stores openID
  :mappings       - simple registration mappings (currently unsupported)
  :redirect_to    - where to redirect after success
  :*_notice       - failure, cancellation, setup_needed, new_user_failure


19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/hobo_openid.rb', line 19

def self.(options = {})
  options.reverse_merge!(:login_action => :openid_login,
                          :complete_action => :complete_openid,
                          :openid_opts => Hash.new)

  include Hobo::OpenidController

  define_method(options[:complete_action]) do
    hobo_openid_complete(options[:openid_opts])
  end

  define_method(options[:login_action]) do
    (request, options[:openid_opts])
  end

end