Class: OmniAuth::Strategies::Cobot

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

Instance Method Summary collapse

Instance Method Details

#clientObject



14
15
16
17
18
19
20
21
22
23
24
# File 'lib/omniauth/strategies/cobot.rb', line 14

def client
  ::OAuth2::Client.new(
    options.client_id,
    options.client_secret,
    deep_symbolize(
      options.client_options.merge(
        authorize_url: space_subdomain_authorize_url
      )
    )
  )
end

#raw_infoObject



48
49
50
51
# File 'lib/omniauth/strategies/cobot.rb', line 48

def raw_info
  access_token.options[:mode] = :query
  @raw_info ||= access_token.get('/api/user').parsed
end

#space_subdomain_authorize_urlObject



26
27
28
29
30
31
32
33
# File 'lib/omniauth/strategies/cobot.rb', line 26

def space_subdomain_authorize_url
  params = Rack::Utils.parse_nested_query(env['QUERY_STRING'])
  if (subdomain = params['cobot_space_subdomain'])
    options.client_options[:authorize_url].sub('www.', "#{subdomain}.")
  else
    options.client_options[:authorize_url]
  end
end