Class: OmniAuth::Strategies::NCU
- Inherits:
-
OAuth2
- Object
- OAuth2
- OmniAuth::Strategies::NCU
- Defined in:
- lib/omniauth/strategies/ncu.rb
Constant Summary collapse
- DEFAULT_SCOPES =
%w(user.info.basic.read)
Instance Method Summary collapse
Instance Method Details
#authorize_params ⇒ Object
26 27 28 29 30 31 32 33 34 35 |
# File 'lib/omniauth/strategies/ncu.rb', line 26 def super.tap do |params| %w[scope client_options].each do |v| if request.params[v] params[v.to_sym] = request.params[v] end end params[:scope] = params[:scope].join ' ' if params[:scope] end end |
#info_allowed? ⇒ Boolean
71 72 73 74 75 |
# File 'lib/omniauth/strategies/ncu.rb', line 71 def info_allowed? info_scopes = %w(user.info.basic.read) scope = (['scope'] || DEFAULT_SCOPES) (info_scopes & scope).any? end |
#raw_info ⇒ Object
62 63 64 65 66 67 68 69 |
# File 'lib/omniauth/strategies/ncu.rb', line 62 def raw_info return {} unless info_allowed? access_token.[:mode] = :header @raw_info ||= access_token.get('personnel/v1/info').parsed rescue ::OAuth2::Error => e Logger.new(STDOUT).info e.to_s {} end |
#request_phase ⇒ Object
22 23 24 |
# File 'lib/omniauth/strategies/ncu.rb', line 22 def request_phase super end |