Class: G5AuthenticatableApi::Services::TokenValidator
- Defined in:
- lib/g5_authenticatable_api/services/token_validator.rb
Overview
Validates an access token against the G5 Auth server
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.
9 10 11 |
# File 'lib/g5_authenticatable_api/services/token_validator.rb', line 9 def error @error end |
Instance Method Details
#auth_response_header ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/g5_authenticatable_api/services/token_validator.rb', line 24 def auth_response_header return unless error auth_header = String.new('Bearer') if access_token auth_header << " error=\"#{error_code}\"" if error_description.present? auth_header << ",error_description=\"#{error_description}\"" end end auth_header end |
#valid? ⇒ Boolean
17 18 19 20 21 22 |
# File 'lib/g5_authenticatable_api/services/token_validator.rb', line 17 def valid? validate! true rescue StandardError false end |
#validate! ⇒ Object
11 12 13 14 15 |
# File 'lib/g5_authenticatable_api/services/token_validator.rb', line 11 def validate! token_data unless skip_validation? rescue StandardError => @error raise error end |