Class: OmniAuth::Strategies::Osso
- Inherits:
-
OAuth2
- Object
- OAuth2
- OmniAuth::Strategies::Osso
- Defined in:
- lib/omniauth/strategies/osso.rb
Overview
The main source for the Osso Omniauth Strategy
Instance Attribute Summary collapse
-
#env ⇒ Object
Returns the value of attribute env.
Instance Method Summary collapse
-
#callback_phase ⇒ Object
rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/MethodLength, Metrics/PerceivedComplexity.
- #raw_info ⇒ Object
- #request_params ⇒ Object
- #request_phase ⇒ Object
Instance Attribute Details
#env ⇒ Object
Returns the value of attribute env.
9 10 11 |
# File 'lib/omniauth/strategies/osso.rb', line 9 def env @env end |
Instance Method Details
#callback_phase ⇒ Object
rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/MethodLength, Metrics/PerceivedComplexity
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/omniauth/strategies/osso.rb', line 53 def callback_phase # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/MethodLength, Metrics/PerceivedComplexity error = request.params['error_reason'] || request.params['error'] if error fail!( error, CallbackError.new( request.params['error'], request.params['error_description'] || request.params['error_reason'], request.params['error_uri'] ) ) elsif request.params['state'] != 'IDP_INITIATED' && request.params['state'] != session.delete('omniauth.state') fail!(:csrf_detected, CallbackError.new(:csrf_detected, 'CSRF detected')) else self.access_token = build_access_token self.access_token = access_token.refresh! if access_token.expired? env['omniauth.auth'] = auth_hash call_app! end rescue ::OAuth2::Error, CallbackError => e fail!(:invalid_credentials, e) rescue ::Timeout::Error, ::Errno::ETIMEDOUT => e fail!(:timeout, e) rescue ::SocketError => e fail!(:failed_to_connect, e) end |
#raw_info ⇒ Object
49 50 51 |
# File 'lib/omniauth/strategies/osso.rb', line 49 def raw_info @raw_info ||= access_token.get("/oauth/me?access_token=#{access_token.token}").parsed end |
#request_params ⇒ Object
28 29 30 31 32 33 |
# File 'lib/omniauth/strategies/osso.rb', line 28 def request_params { redirect_uri: callback_url, domain: request_domain } end |
#request_phase ⇒ Object
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/omniauth/strategies/osso.rb', line 17 def request_phase redirect( client .auth_code .( request_params .merge() ) ) end |