Class: Solidcrud::Configuration
- Inherits:
-
Object
- Object
- Solidcrud::Configuration
- Defined in:
- lib/solidcrud/configuration.rb
Instance Attribute Summary collapse
-
#auth_type ⇒ Object
Returns the value of attribute auth_type.
-
#authenticate_method ⇒ Object
Returns the value of attribute authenticate_method.
-
#basic_auth_password ⇒ Object
Returns the value of attribute basic_auth_password.
-
#basic_auth_username ⇒ Object
Returns the value of attribute basic_auth_username.
-
#devise_scope ⇒ Object
Returns the value of attribute devise_scope.
-
#jwt_secret ⇒ Object
Returns the value of attribute jwt_secret.
-
#models_exclude ⇒ Object
Returns the value of attribute models_exclude.
Instance Method Summary collapse
- #authenticate_with(&block) ⇒ Object
- #basic_auth_enabled? ⇒ Boolean
- #devise_enabled? ⇒ Boolean
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #jwt_enabled? ⇒ Boolean
-
#use_basic_auth ⇒ Object
Authentication type setters.
- #use_custom(&block) ⇒ Object
- #use_devise(scope: :user) ⇒ Object
- #use_jwt ⇒ Object
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
19 20 21 22 23 24 25 26 27 |
# File 'lib/solidcrud/configuration.rb', line 19 def initialize @models_exclude = [] @authenticate_method = nil @basic_auth_username = nil @basic_auth_password = nil @auth_type = :custom # Default to custom authentication @jwt_secret = nil @devise_scope = :user end |
Instance Attribute Details
#auth_type ⇒ Object
Returns the value of attribute auth_type.
15 16 17 |
# File 'lib/solidcrud/configuration.rb', line 15 def auth_type @auth_type end |
#authenticate_method ⇒ Object
Returns the value of attribute authenticate_method.
13 14 15 |
# File 'lib/solidcrud/configuration.rb', line 13 def authenticate_method @authenticate_method end |
#basic_auth_password ⇒ Object
Returns the value of attribute basic_auth_password.
14 15 16 |
# File 'lib/solidcrud/configuration.rb', line 14 def basic_auth_password @basic_auth_password end |
#basic_auth_username ⇒ Object
Returns the value of attribute basic_auth_username.
14 15 16 |
# File 'lib/solidcrud/configuration.rb', line 14 def basic_auth_username @basic_auth_username end |
#devise_scope ⇒ Object
Returns the value of attribute devise_scope.
17 18 19 |
# File 'lib/solidcrud/configuration.rb', line 17 def devise_scope @devise_scope end |
#jwt_secret ⇒ Object
Returns the value of attribute jwt_secret.
16 17 18 |
# File 'lib/solidcrud/configuration.rb', line 16 def jwt_secret @jwt_secret end |
#models_exclude ⇒ Object
Returns the value of attribute models_exclude.
12 13 14 |
# File 'lib/solidcrud/configuration.rb', line 12 def models_exclude @models_exclude end |
Instance Method Details
#authenticate_with(&block) ⇒ Object
41 42 43 |
# File 'lib/solidcrud/configuration.rb', line 41 def authenticate_with(&block) @authenticate_method = block end |
#basic_auth_enabled? ⇒ Boolean
29 30 31 |
# File 'lib/solidcrud/configuration.rb', line 29 def basic_auth_enabled? @basic_auth_username.present? && @basic_auth_password.present? end |
#devise_enabled? ⇒ Boolean
37 38 39 |
# File 'lib/solidcrud/configuration.rb', line 37 def devise_enabled? @auth_type == :devise end |
#jwt_enabled? ⇒ Boolean
33 34 35 |
# File 'lib/solidcrud/configuration.rb', line 33 def jwt_enabled? @jwt_secret.present? end |
#use_basic_auth ⇒ Object
Authentication type setters
46 47 48 |
# File 'lib/solidcrud/configuration.rb', line 46 def use_basic_auth @auth_type = :basic_auth end |
#use_custom(&block) ⇒ Object
59 60 61 62 |
# File 'lib/solidcrud/configuration.rb', line 59 def use_custom(&block) @auth_type = :custom @authenticate_method = block end |
#use_devise(scope: :user) ⇒ Object
50 51 52 53 |
# File 'lib/solidcrud/configuration.rb', line 50 def use_devise(scope: :user) @auth_type = :devise @devise_scope = scope end |
#use_jwt ⇒ Object
55 56 57 |
# File 'lib/solidcrud/configuration.rb', line 55 def use_jwt @auth_type = :jwt end |