Class: ExvoAuth::Strategies::NonInteractive
- Inherits:
-
Base
- Object
- OmniAuth::Strategies::OAuth2
- Base
- ExvoAuth::Strategies::NonInteractive
- Defined in:
- lib/exvo_auth/strategies/non_interactive.rb
Instance Method Summary collapse
- #callback_url ⇒ Object
-
#fail!(message_key, exception = nil) ⇒ Object
FIXME this does not bubble up the 401 response code, although the error message is returned.
-
#initialize(app, options = {}) ⇒ NonInteractive
constructor
A new instance of NonInteractive.
- #request_phase ⇒ Object
Methods inherited from Base
#auth_hash, #user_data, #user_info
Constructor Details
#initialize(app, options = {}) ⇒ NonInteractive
Returns a new instance of NonInteractive.
2 3 4 |
# File 'lib/exvo_auth/strategies/non_interactive.rb', line 2 def initialize(app, = {}) super(app, :non_interactive, ) end |
Instance Method Details
#callback_url ⇒ Object
14 15 16 17 18 19 20 21 22 23 |
# File 'lib/exvo_auth/strategies/non_interactive.rb', line 14 def callback_url key = ExvoAuth::Config.callback_key value = request[key] if value super + "?" + Rack::Utils.build_query(key => value) else super end end |
#fail!(message_key, exception = nil) ⇒ Object
FIXME this does not bubble up the 401 response code, although the error message is returned
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/exvo_auth/strategies/non_interactive.rb', line 26 def fail!(, exception = nil) error = case when :invalid_credentials, :session_expired "Please sign in." when :invalid_response "Invalid response from the authorization server. Please try again." when :timeout "Timeout occured. Please try again." when :service_unavailable "Authorization service is not available. Please try again later." else "Unknown error. Please try again." end body = MultiJson.encode(:error => error) [401, { "Content-Type" => "application/json", "Content-Length" => body.length.to_s }, [body]] end |
#request_phase ⇒ Object
6 7 8 9 10 11 12 |
# File 'lib/exvo_auth/strategies/non_interactive.rb', line 6 def request_phase [:redirect_uri] = callback_url if callback_url [:scope] = request["scope"] if request["scope"] [:state] = request["state"] if request["state"] redirect client.non_interactive.() end |