Exception: TokenError
- Inherits:
-
StandardError
- Object
- StandardError
- TokenError
- Defined in:
- lib/keycloak-api-rails/token_error.rb
Instance Attribute Summary collapse
-
#original_error ⇒ Object
readonly
Returns the value of attribute original_error.
-
#reason ⇒ Object
readonly
Returns the value of attribute reason.
-
#token ⇒ Object
readonly
Returns the value of attribute token.
Class Method Summary collapse
- .expired(token) ⇒ Object
- .invalid_format(token, original_error) ⇒ Object
- .no_token(token) ⇒ Object
- .unknown(token) ⇒ Object
- .verification_failed(token, original_error) ⇒ Object
Instance Method Summary collapse
-
#initialize(token, reason, message, original_error) ⇒ TokenError
constructor
A new instance of TokenError.
Constructor Details
#initialize(token, reason, message, original_error) ⇒ TokenError
Returns a new instance of TokenError.
4 5 6 7 8 9 |
# File 'lib/keycloak-api-rails/token_error.rb', line 4 def initialize(token, reason, , original_error) super() @token = token @reason = reason @original_error = original_error end |
Instance Attribute Details
#original_error ⇒ Object (readonly)
Returns the value of attribute original_error.
2 3 4 |
# File 'lib/keycloak-api-rails/token_error.rb', line 2 def original_error @original_error end |
#reason ⇒ Object (readonly)
Returns the value of attribute reason.
2 3 4 |
# File 'lib/keycloak-api-rails/token_error.rb', line 2 def reason @reason end |
#token ⇒ Object (readonly)
Returns the value of attribute token.
2 3 4 |
# File 'lib/keycloak-api-rails/token_error.rb', line 2 def token @token end |
Class Method Details
.expired(token) ⇒ Object
23 24 25 |
# File 'lib/keycloak-api-rails/token_error.rb', line 23 def self.expired(token) TokenError.new(token, :expired, "JWT token is expired", nil) end |
.invalid_format(token, original_error) ⇒ Object
15 16 17 |
# File 'lib/keycloak-api-rails/token_error.rb', line 15 def self.invalid_format(token, original_error) TokenError.new(token, :invalid_format, "Wrong JWT Format", original_error) end |
.no_token(token) ⇒ Object
19 20 21 |
# File 'lib/keycloak-api-rails/token_error.rb', line 19 def self.no_token(token) TokenError.new(token, :no_token, "No JWT token provided", nil) end |
.unknown(token) ⇒ Object
27 28 29 |
# File 'lib/keycloak-api-rails/token_error.rb', line 27 def self.unknown(token) TokenError.new end |
.verification_failed(token, original_error) ⇒ Object
11 12 13 |
# File 'lib/keycloak-api-rails/token_error.rb', line 11 def self.verification_failed(token, original_error) TokenError.new(token, :verification_failed, "Failed to verify JWT token", original_error) end |