Class: G5AuthenticatableApi::Services::TokenValidator
- Defined in:
- lib/g5_authenticatable_api/services/token_validator.rb
Instance Attribute Summary collapse
-
#error ⇒ Object
readonly
Returns the value of attribute error.
Attributes inherited from TokenInfo
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 Attribute Details
#error ⇒ Object (readonly)
Returns the value of attribute error.
6 7 8 |
# File 'lib/g5_authenticatable_api/services/token_validator.rb', line 6 def error @error end |
Instance Method Details
#auth_response_header ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/g5_authenticatable_api/services/token_validator.rb', line 25 def auth_response_header if error auth_header = "Bearer" if access_token auth_header << " error=\"#{error_code}\"" auth_header << ",error_description=\"#{error_description}\"" if error_description end auth_header end end |
#valid? ⇒ Boolean
16 17 18 19 20 21 22 23 |
# File 'lib/g5_authenticatable_api/services/token_validator.rb', line 16 def valid? begin validate! true rescue StandardError => e false end end |
#validate! ⇒ Object
8 9 10 11 12 13 14 |
# File 'lib/g5_authenticatable_api/services/token_validator.rb', line 8 def validate! begin token_data unless skip_validation? rescue StandardError => @error raise error end end |