Class: OmniAuth::Strategies::Ub

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

Constant Summary collapse

REGEXP_SANITIZER =
/[<>?%&^*#@()\[\]=+:;"{}\\|]/

Instance Method Summary collapse

Instance Method Details

#callback_urlObject



26
27
28
# File 'lib/omniauth/strategies/ub.rb', line 26

def callback_url
  full_host + callback_path
end

#raw_infoObject



30
31
32
33
34
35
36
37
38
39
40
# File 'lib/omniauth/strategies/ub.rb', line 30

def raw_info
  @raw_info ||= begin
    connection = Faraday.new(url: options.client_options[:site], ssl: { verify: true }) do |conn|
      conn.headers["Authorization"] = "#{access_token.response.parsed.token_type} #{access_token.token}"
    end
    response = connection.get("/api/adas/oauth2/tokendata")
    raise Error, "Unable to fetch the user information" unless response.success?

    JSON.parse(response.body).to_h
  end
end