Class: JWTEasy::Configuration
- Inherits:
-
Object
- Object
- JWTEasy::Configuration
- Defined in:
- lib/jwt_easy/configuration.rb
Overview
A configuration object used to define various options for encoding and decoding tokens.
-
This is usually not instantiated directly, but rather by way of calling
JWTEasy.configure
.
Instance Attribute Summary collapse
-
#algorithm ⇒ String
Gets the algorithm to use when encoding tokens.
-
#expiration_time ⇒ Object
Returns the value of attribute expiration_time.
-
#leeway ⇒ Object
Returns the value of attribute leeway.
-
#not_before_time ⇒ Object
Returns the value of attribute not_before_time.
-
#secret ⇒ Object
Returns the value of attribute secret.
Instance Method Summary collapse
-
#claim ⇒ Symbol
Infers the claim to observe during encoding or decoding.
Instance Attribute Details
#algorithm ⇒ String
Gets the algorithm to use when encoding tokens
-
If no secret has been set, this returns ‘none’
21 22 23 |
# File 'lib/jwt_easy/configuration.rb', line 21 def algorithm secret ? (@algorithm || ALGORITHM_HMAC_HS256) : 'none' end |
#expiration_time ⇒ Object
Returns the value of attribute expiration_time.
11 12 13 |
# File 'lib/jwt_easy/configuration.rb', line 11 def expiration_time @expiration_time end |
#leeway ⇒ Object
Returns the value of attribute leeway.
11 12 13 |
# File 'lib/jwt_easy/configuration.rb', line 11 def leeway @leeway end |
#not_before_time ⇒ Object
Returns the value of attribute not_before_time.
11 12 13 |
# File 'lib/jwt_easy/configuration.rb', line 11 def not_before_time @not_before_time end |
#secret ⇒ Object
Returns the value of attribute secret.
11 12 13 |
# File 'lib/jwt_easy/configuration.rb', line 11 def secret @secret end |
Instance Method Details
#claim ⇒ Symbol
Infers the claim to observe during encoding or decoding.
28 29 30 31 32 33 34 |
# File 'lib/jwt_easy/configuration.rb', line 28 def claim if expiration_time CLAIM_EXPIRATION_TIME elsif not_before_time CLAIM_NOT_BEFORE_TIME end end |