Class: G5AuthenticatableApi::Services::UserFetcher

Inherits:
TokenInfo
  • Object
show all
Defined in:
lib/g5_authenticatable_api/services/user_fetcher.rb

Overview

Fetch user data from G5 Auth based on access token

Instance Attribute Summary

Attributes inherited from TokenInfo

#headers, #params, #warden

Instance Method Summary collapse

Methods inherited from TokenInfo

#access_token, #auth_client, #initialize, #token_data

Constructor Details

This class inherits a constructor from G5AuthenticatableApi::Services::TokenInfo

Instance Method Details

#current_userObject



9
10
11
12
13
14
15
# File 'lib/g5_authenticatable_api/services/user_fetcher.rb', line 9

def current_user
  if access_token == @warden.try(:user).try(:g5_access_token)
    @warden.user
  else
    auth_client.me
  end
end