Class: Spikard::JwtConfig
- Inherits:
-
Object
- Object
- Spikard::JwtConfig
- Defined in:
- lib/spikard/config.rb
Overview
JWT authentication configuration.
Validates JWT tokens using the specified secret and algorithm. Tokens are expected in the Authorization header as “Bearer <token>”.
Supported algorithms:
-
HS256, HS384, HS512 (HMAC with SHA)
-
RS256, RS384, RS512 (RSA signatures)
-
ES256, ES384, ES512 (ECDSA signatures)
-
PS256, PS384, PS512 (RSA-PSS signatures)
Instance Attribute Summary collapse
-
#algorithm ⇒ Object
Returns the value of attribute algorithm.
-
#audience ⇒ Object
Returns the value of attribute audience.
-
#issuer ⇒ Object
Returns the value of attribute issuer.
-
#leeway ⇒ Object
Returns the value of attribute leeway.
-
#secret ⇒ Object
Returns the value of attribute secret.
Instance Method Summary collapse
-
#initialize(secret:, algorithm: 'HS256', audience: nil, issuer: nil, leeway: 0) ⇒ JwtConfig
constructor
A new instance of JwtConfig.
Constructor Details
#initialize(secret:, algorithm: 'HS256', audience: nil, issuer: nil, leeway: 0) ⇒ JwtConfig
Returns a new instance of JwtConfig.
105 106 107 108 109 110 111 |
# File 'lib/spikard/config.rb', line 105 def initialize(secret:, algorithm: 'HS256', audience: nil, issuer: nil, leeway: 0) @secret = secret @algorithm = algorithm @audience = audience @issuer = issuer @leeway = leeway end |
Instance Attribute Details
#algorithm ⇒ Object
Returns the value of attribute algorithm.
98 99 100 |
# File 'lib/spikard/config.rb', line 98 def algorithm @algorithm end |
#audience ⇒ Object
Returns the value of attribute audience.
98 99 100 |
# File 'lib/spikard/config.rb', line 98 def audience @audience end |
#issuer ⇒ Object
Returns the value of attribute issuer.
98 99 100 |
# File 'lib/spikard/config.rb', line 98 def issuer @issuer end |
#leeway ⇒ Object
Returns the value of attribute leeway.
98 99 100 |
# File 'lib/spikard/config.rb', line 98 def leeway @leeway end |
#secret ⇒ Object
Returns the value of attribute secret.
98 99 100 |
# File 'lib/spikard/config.rb', line 98 def secret @secret end |