Class: G5AuthenticatableApi::Services::TokenInfo
- Inherits:
-
Object
- Object
- G5AuthenticatableApi::Services::TokenInfo
- Defined in:
- lib/g5_authenticatable_api/services/token_info.rb
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.
6 7 8 9 10 |
# File 'lib/g5_authenticatable_api/services/token_info.rb', line 6 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.
4 5 6 |
# File 'lib/g5_authenticatable_api/services/token_info.rb', line 4 def headers @headers end |
#params ⇒ Object (readonly)
Returns the value of attribute params.
4 5 6 |
# File 'lib/g5_authenticatable_api/services/token_info.rb', line 4 def params @params end |
#warden ⇒ Object (readonly)
Returns the value of attribute warden.
4 5 6 |
# File 'lib/g5_authenticatable_api/services/token_info.rb', line 4 def warden @warden end |
Instance Method Details
#access_token ⇒ Object
12 13 14 15 16 |
# File 'lib/g5_authenticatable_api/services/token_info.rb', line 12 def access_token @access_token ||= (extract_token_from_header || params['access_token'] || warden.try(:user).try(:g5_access_token)) end |
#auth_client ⇒ Object
22 23 24 25 |
# File 'lib/g5_authenticatable_api/services/token_info.rb', line 22 def auth_client @auth_client ||= G5AuthenticationClient::Client.new(allow_password_credentials: 'false', access_token: access_token) end |
#token_data ⇒ Object
18 19 20 |
# File 'lib/g5_authenticatable_api/services/token_info.rb', line 18 def token_data auth_client.token_info end |