Class: G5AuthenticatableApi::Services::TokenInfo
- Inherits:
-
Object
- Object
- G5AuthenticatableApi::Services::TokenInfo
- Defined in:
- lib/g5_authenticatable_api/services/token_info.rb
Overview
Extract access token from request to retrieve token data from G5 Auth
Direct Known Subclasses
Instance Attribute Summary collapse
-
#headers ⇒ Object
readonly
Returns the value of attribute headers.
-
#params ⇒ Object
readonly
Returns the value of attribute params.
-
#warden ⇒ Object
readonly
Returns the value of attribute warden.
Instance Method Summary collapse
- #access_token ⇒ Object
- #auth_client ⇒ Object
-
#initialize(params = {}, headers = {}, warden = nil) ⇒ TokenInfo
constructor
A new instance of TokenInfo.
- #token_data ⇒ Object
Constructor Details
#initialize(params = {}, headers = {}, warden = nil) ⇒ TokenInfo
Returns a new instance of TokenInfo.
9 10 11 12 13 |
# File 'lib/g5_authenticatable_api/services/token_info.rb', line 9 def initialize(params = {}, headers = {}, warden = nil) @params = params || {} @headers = headers || {} @warden = warden end |
Instance Attribute Details
#headers ⇒ Object (readonly)
Returns the value of attribute headers.
7 8 9 |
# File 'lib/g5_authenticatable_api/services/token_info.rb', line 7 def headers @headers end |
#params ⇒ Object (readonly)
Returns the value of attribute params.
7 8 9 |
# File 'lib/g5_authenticatable_api/services/token_info.rb', line 7 def params @params end |
#warden ⇒ Object (readonly)
Returns the value of attribute warden.
7 8 9 |
# File 'lib/g5_authenticatable_api/services/token_info.rb', line 7 def warden @warden end |
Instance Method Details
#access_token ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/g5_authenticatable_api/services/token_info.rb', line 15 def access_token @access_token ||= begin extract_token_from_header || extract_token_from_params || extract_token_from_warden end end |
#auth_client ⇒ Object
27 28 29 30 31 32 |
# File 'lib/g5_authenticatable_api/services/token_info.rb', line 27 def auth_client @auth_client ||= G5AuthenticationClient::Client.new( allow_password_credentials: 'false', access_token: access_token ) end |
#token_data ⇒ Object
23 24 25 |
# File 'lib/g5_authenticatable_api/services/token_info.rb', line 23 def token_data auth_client.token_info end |