Class: JwtAuthEngine::Configuration
- Inherits:
-
Object
- Object
- JwtAuthEngine::Configuration
- Defined in:
- lib/jwt_auth_engine/configuration.rb
Overview
Runtime configuration container for auth model and token settings.
Instance Attribute Summary collapse
- #access_token_expiry ⇒ Object
- #auth_model ⇒ Object
- #identifier_field ⇒ Object
- #jwt_secret_key ⇒ Object
- #password_field ⇒ Object
- #refresh_token_expiry ⇒ Object
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
6 7 8 9 10 11 12 13 |
# File 'lib/jwt_auth_engine/configuration.rb', line 6 def initialize @jwt_secret_key = nil @auth_model = nil @identifier_field = nil @password_field = nil @access_token_expiry = nil @refresh_token_expiry = nil end |
Instance Attribute Details
#access_token_expiry ⇒ Object
42 43 44 |
# File 'lib/jwt_auth_engine/configuration.rb', line 42 def access_token_expiry @access_token_expiry.presence || Constants::DEFAULT_ACCESS_TOKEN_EXPIRY end |
#auth_model ⇒ Object
30 31 32 |
# File 'lib/jwt_auth_engine/configuration.rb', line 30 def auth_model @auth_model.presence || Constants::DEFAULT_AUTH_MODEL end |
#identifier_field ⇒ Object
34 35 36 |
# File 'lib/jwt_auth_engine/configuration.rb', line 34 def identifier_field @identifier_field.presence || Constants::DEFAULT_IDENTIFIER_FIELD end |
#jwt_secret_key ⇒ Object
22 23 24 25 26 27 28 |
# File 'lib/jwt_auth_engine/configuration.rb', line 22 def jwt_secret_key @jwt_secret_key.presence || ( raise MissingSecretKey, 'Missing JWT secret key. ' \ "Set `config.#{JwtAuthEngine::Constants::JWT_SECRET_CONFIG_KEY}` in your initializer." ) end |
#password_field ⇒ Object
38 39 40 |
# File 'lib/jwt_auth_engine/configuration.rb', line 38 def password_field @password_field.presence || Constants::DEFAULT_PASSWORD_FIELD end |
#refresh_token_expiry ⇒ Object
46 47 48 |
# File 'lib/jwt_auth_engine/configuration.rb', line 46 def refresh_token_expiry @refresh_token_expiry.presence || Constants::DEFAULT_REFRESH_TOKEN_EXPIRY end |