Class: CastleDevise::Configuration
- Inherits:
-
Object
- Object
- CastleDevise::Configuration
- Defined in:
- lib/castle_devise/configuration.rb
Overview
Plain Ruby configuration object for CastleDevise.
Previously this used ActiveSupport::Configurable, which is deprecated and slated for removal in Rails 8.2.
Instance Attribute Summary collapse
-
#after_request_hooks ⇒ Array<Proc>
Array of procs that will get called after a request to the Castle API.
-
#api_secret ⇒ String
Your API secret.
-
#app_id ⇒ String
Your Castle App ID.
-
#before_request_hooks ⇒ Array<Proc>
Array of procs that will get called before a request to the Castle API.
- #castle_client ⇒ Object
- #castle_sdk_facade_class ⇒ Object
- #logger ⇒ Object
-
#monitoring_mode ⇒ true, false
When CastleDevise is in monitoring mode, it sends requests to Castle but it doesn’t act on “deny” verdicts.
Instance Method Summary collapse
-
#after_request(&blk) ⇒ Object
Adds a new after_request hook.
-
#before_request(&blk) ⇒ Object
Adds a new before_request hook.
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
40 41 42 43 44 |
# File 'lib/castle_devise/configuration.rb', line 40 def initialize @monitoring_mode = false @before_request_hooks = [] @after_request_hooks = [] end |
Instance Attribute Details
#after_request_hooks ⇒ Array<Proc>
Returns Array of procs that will get called after a request to the Castle API.
36 37 38 |
# File 'lib/castle_devise/configuration.rb', line 36 def after_request_hooks @after_request_hooks end |
#api_secret ⇒ String
Returns Your API secret.
13 14 15 |
# File 'lib/castle_devise/configuration.rb', line 13 def api_secret @api_secret end |
#app_id ⇒ String
Returns Your Castle App ID.
17 18 19 |
# File 'lib/castle_devise/configuration.rb', line 17 def app_id @app_id end |
#before_request_hooks ⇒ Array<Proc>
Returns Array of procs that will get called before a request to the Castle API.
32 33 34 |
# File 'lib/castle_devise/configuration.rb', line 32 def before_request_hooks @before_request_hooks end |
#castle_client ⇒ Object
60 61 62 |
# File 'lib/castle_devise/configuration.rb', line 60 def castle_client @castle_client ||= ::Castle::Client.new end |
#castle_sdk_facade_class ⇒ Object
54 55 56 |
# File 'lib/castle_devise/configuration.rb', line 54 def castle_sdk_facade_class @castle_sdk_facade_class ||= ::CastleDevise::SdkFacade end |
#logger ⇒ Object
48 49 50 |
# File 'lib/castle_devise/configuration.rb', line 48 def logger @logger ||= Logger.new(File::NULL) end |
#monitoring_mode ⇒ true, false
When CastleDevise is in monitoring mode, it sends requests to Castle but it doesn’t act on “deny” verdicts.
This mode is useful if you’re just checking Castle out and you’re not yet sure whether your configuration is correct so you don’t accidentally block legitimate users from logging in/registering.
28 29 30 |
# File 'lib/castle_devise/configuration.rb', line 28 def monitoring_mode @monitoring_mode end |
Instance Method Details
#after_request(&blk) ⇒ Object
Adds a new after_request hook
72 73 74 |
# File 'lib/castle_devise/configuration.rb', line 72 def after_request(&blk) after_request_hooks << blk end |
#before_request(&blk) ⇒ Object
Adds a new before_request hook
66 67 68 |
# File 'lib/castle_devise/configuration.rb', line 66 def before_request(&blk) before_request_hooks << blk end |