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
- #callback_phase ⇒ Object
-
#initialize(app, *args, &block) ⇒ Pubcookie
constructor
Override initialize.
- #raw_info ⇒ Object
- #request_phase ⇒ Object
Constructor Details
#initialize(app, *args, &block) ⇒ Pubcookie
Override initialize. Omniauth frowns on this but we need to set pubcookie_options on initialize
15 16 17 18 |
# File 'lib/omniauth/strategies/pubcookie.rb', line 15 def initialize(app, *args, &block) super(app, *args, &block) self. = end |
Instance Method Details
#callback_phase ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/omniauth/strategies/pubcookie.rb', line 25 def callback_phase # Part of the pubcookie spec request.env['REMOTE_USER'] = raw_info[:username] if raw_info[:username] self.env['omniauth.auth'] = auth_hash # provided by Omniauth now 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 |
#raw_info ⇒ Object
52 53 54 |
# File 'lib/omniauth/strategies/pubcookie.rb', line 52 def raw_info @raw_info ||= {:username => extract_username(request)} end |
#request_phase ⇒ Object
20 21 22 23 |
# File 'lib/omniauth/strategies/pubcookie.rb', line 20 def request_phase @raw_info = nil Rack::Response.new(login_page_html).finish end |