class Negroni::Configuration
`Configuration` encapsulates all of the configuration for Negroni
, keeping it out of the main module.
Constants
- DEFAULT_EMAIL_VALIDATION_REGEX
The default email validation regex.
Attributes
Keys used when authenticating @return [Array<Symbol>]
Keys that should be treated as case-insensitive @return [Array<Symbol>]
Regular expression to validate emails @return [RegExp]
Defines which strategy will be used to lock an account.
* `:failed_attempts` = Locks an account after a number of failed attempts. * `:none` = No lock strategy. You should handle locking by yourself.
@return [Symbol] the name of the lock strategy.
The sender for all mailers @return [String] the email address for the sender
Number of authentication tries before locking an account @return [Integer]
The name of the exception class that will be raised upon receiving an invalid auth token.
Default: {Negroni::TokenNotFound}
@return [Class, String]
The class `Negroni::BaseController` should inherit from.
Default: ActionController::API
@return [String, Class]
The class `Mailer` should inherit from (`'ActionMailer::Base'` by default) @return [String]
Range validation for password @return [Range]
Used to hash the password. Generate one with `rake secret`. @return [String] the pepper used to hash the password
Defines which key will be used when recovering the password for an account @return [Array<Symbol>]
Time interval you can reset your password with a reset password key @return [ActiveSupport::Duration]
When true, send an email to notify password changes @return [Boolean]
The number of times to hash the password @return [Integer]
Keys that should have whitespace skipped @return [Array<Symbol>]
The algorithm used to encode the token. Default: 'HS256'
@return [String]
The audience claim to identify the recipients that the token is intended for.
@return [Object]
How long before a token is expired. If nil is provided, token will last forever.
@return [ActiveSupport::Duration]
An optional public key used to decode tokens.
@return [String]
The secret key that will be used for the token. Default: {Negroni::secret_key}.
@return [String]
Time interval to unlock the account if `:time` is defined as `unlock_strategy`.
@return [ActiveSupport::Duration]
Defines which key will be used when locking and unlocking an account @return [Array<Symbol>]
Defines which strategy can be used to unlock an account. Valid values: `:email,` `:time,` `:both` @return [Symbol]
Public Class Methods
Create a new instance of `Configuration`, using default values for all attributes.
# File lib/negroni/configuration.rb, line 147 def initialize # rubocop:disable Metrics/AbcSize,MethodLength @authentication_keys = [:email] @case_insensitive_keys = [:email] @strip_whitespace_keys = [:email] @send_password_change_notification = false @token_lifetime = 1.day @token_algorithm = 'HS256' @not_found_exception = 'Negroni::TokenNotFound' @email_regexp = DEFAULT_EMAIL_VALIDATION_REGEX @password_length = 8..72 @stretches = 11 @pepper = nil @lock_strategy = :failed_attempts @unlock_keys = [:email] @unlock_strategy = :both @maximum_attempts = 20 @unlock_in = 1.hour @reset_password_keys = [:email] @reset_password_within = 6.hours @mailer_sender = nil @parent_mailer = 'ActionMailer::Base' @parent_controller = 'ActionController::API' end