Class: OmniAuth::Strategies::Pubcookie
- Inherits:
-
Object
- Object
- OmniAuth::Strategies::Pubcookie
- Includes:
- OmniAuth::Strategy, Rack::Pubcookie::Auth
- Defined in:
- lib/omniauth/strategies/pubcookie.rb
Instance Method Summary collapse
- #auth_hash(username) ⇒ Object
- #callback_phase ⇒ Object
-
#initialize(app, options, &block) ⇒ Pubcookie
constructor
A new instance of Pubcookie.
- #request_phase ⇒ Object
Constructor Details
#initialize(app, options, &block) ⇒ Pubcookie
Returns a new instance of Pubcookie.
11 12 13 14 |
# File 'lib/omniauth/strategies/pubcookie.rb', line 11 def initialize app, , &block self. = super app, :pubcookie, &block end |
Instance Method Details
#auth_hash(username) ⇒ Object
40 41 42 43 44 45 46 |
# File 'lib/omniauth/strategies/pubcookie.rb', line 40 def auth_hash username OmniAuth::Utils.deep_merge(super(), { 'uid' => username, 'provider' => 'pubcookie', 'user_info' => {'name' => username} }) end |
#callback_phase ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/omniauth/strategies/pubcookie.rb', line 20 def callback_phase username = extract_username request request.env['REMOTE_USER'] = username # Part of the pubcookie spec if username request.env['omniauth.auth'] = auth_hash(username) request.env['REQUEST_METHOD'] = 'GET' status, headers, body = call_app! # Set the actual cookie for pubcookie, as per its spec response = Rack::Response.new body, status, headers request, response response.finish else fail! :login_failed end end |
#request_phase ⇒ Object
16 17 18 |
# File 'lib/omniauth/strategies/pubcookie.rb', line 16 def request_phase Rack::Response.new(login_page_html).finish end |