Class: OmniAuth::Strategies::ICOS

Inherits:
OAuth2
  • Object
show all
Defined in:
lib/omniauth/strategies/icos.rb

Constant Summary collapse

DEFAULT_SCOPES =
'hydra.consent offline'

Instance Method Summary collapse

Instance Method Details

#basic_auth_headerObject



81
82
83
# File 'lib/omniauth/strategies/icos.rb', line 81

def basic_auth_header
  'Basic ' + Base64.strict_encode64("#{options[:client_id]}:#{options[:client_secret]}")
end

#build_access_tokenObject



76
77
78
79
# File 'lib/omniauth/strategies/icos.rb', line 76

def build_access_token
  options.token_params.merge!(:headers => {'Authorization' => basic_auth_header })
  super
end

#callback_urlObject



62
63
64
# File 'lib/omniauth/strategies/icos.rb', line 62

def callback_url
  full_host + script_name + callback_path
end

#compact_full_nameObject



66
67
68
# File 'lib/omniauth/strategies/icos.rb', line 66

def compact_full_name
  [['FirstName'], ['MiddleName'], ['LastName']].reject { |name| name.empty? }.join(' ')
end

#raw_infoObject



70
71
72
73
74
# File 'lib/omniauth/strategies/icos.rb', line 70

def raw_info
  @raw_info ||= MultiJson.decode(access_token.get('/v1/services/client/').body)
rescue ::Errno::ETIMEDOUT
  raise ::Timeout::Error
end

#user_infoObject



85
86
87
# File 'lib/omniauth/strategies/icos.rb', line 85

def 
  @user_info ||= raw_info.nil? ? {} : raw_info['Result']
end