Class: OmniAuth::Strategies::SSO
- Inherits:
-
OAuth2
- Object
- OAuth2
- OmniAuth::Strategies::SSO
- Defined in:
- lib/sso/client/omniauth/strategies/sso.rb
Class Method Summary collapse
- .development_environment? ⇒ Boolean
- .endpoint ⇒ Object
- .passports_path ⇒ Object
- .test_environment? ⇒ Boolean
Instance Method Summary collapse
Class Method Details
.development_environment? ⇒ Boolean
19 20 21 |
# File 'lib/sso/client/omniauth/strategies/sso.rb', line 19 def self.development_environment? defined?(Rails) && Rails.env.development? end |
.endpoint ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/sso/client/omniauth/strategies/sso.rb', line 7 def self.endpoint if ENV['OMNIAUTH_SSO_ENDPOINT'].to_s != '' ENV['OMNIAUTH_SSO_ENDPOINT'].to_s elsif development_environment? ENV['OMNIAUTH_SSO_ENDPOINT'] || 'http://sso.dev:8080' elsif test_environment? 'https://sso.example.com' else fail 'You must set OMNIAUTH_SSO_ENDPOINT to point to the SSO OAuth server' end end |
.passports_path ⇒ Object
27 28 29 30 31 32 33 34 |
# File 'lib/sso/client/omniauth/strategies/sso.rb', line 27 def self.passports_path if ENV['OMNIAUTH_SSO_PASSPORTS_PATH'].to_s != '' ENV['OMNIAUTH_SSO_PASSPORTS_PATH'].to_s else # We know this namespace is not occupied because /oauth is owned by Doorkeeper '/oauth/sso/v1/passports' end end |
.test_environment? ⇒ Boolean
23 24 25 |
# File 'lib/sso/client/omniauth/strategies/sso.rb', line 23 def self.test_environment? defined?(Rails) && Rails.env.test? || ENV['RACK_ENV'] == 'test' end |
Instance Method Details
#raw_info ⇒ Object
51 52 53 54 |
# File 'lib/sso/client/omniauth/strategies/sso.rb', line 51 def raw_info params = { ip: request.ip, agent: request.user_agent } @raw_info ||= access_token.post(self.class.passports_path, params: params).parsed end |