Class: Kadmin::Auth::Configuration
- Inherits:
-
Object
- Object
- Kadmin::Auth::Configuration
- Defined in:
- lib/kadmin/auth/configuration.rb
Defined Under Namespace
Classes: OAuthCredentials
Instance Attribute Summary collapse
-
#oauth_credentials ⇒ Kadmin::Auth::Configuration::OAuthCredentials
Credentials for OAuth2 authentication; if absent, fallback to :developer provider.
-
#user_class ⇒ Class<Kadmin::Auth::User>
Class to use for authenticated users (mostly for resource authorization).
-
#user_store_class ⇒ Class<Kadmin::Auth::UserStore>
Class for user lookup/registration.
Instance Method Summary collapse
-
#disable! ⇒ Object
Disables authentication and removes OmniAuth middlewares.
-
#enable! ⇒ Object
Enables authentication and adds OmniAuth middlewares.
-
#enabled? ⇒ Boolean
True if enabled, false otherwise.
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
15 16 17 18 19 20 21 |
# File 'lib/kadmin/auth/configuration.rb', line 15 def initialize @oauth_credentials = nil @user_class = Kadmin::Auth::User @user_store_class = Kadmin::Auth::UserStore @enabled = false @__omniauth_appended = false end |
Instance Attribute Details
#oauth_credentials ⇒ Kadmin::Auth::Configuration::OAuthCredentials
Returns credentials for OAuth2 authentication; if absent, fallback to :developer provider.
7 8 9 |
# File 'lib/kadmin/auth/configuration.rb', line 7 def oauth_credentials @oauth_credentials end |
#user_class ⇒ Class<Kadmin::Auth::User>
Returns class to use for authenticated users (mostly for resource authorization).
10 11 12 |
# File 'lib/kadmin/auth/configuration.rb', line 10 def user_class @user_class end |
#user_store_class ⇒ Class<Kadmin::Auth::UserStore>
Returns class for user lookup/registration.
13 14 15 |
# File 'lib/kadmin/auth/configuration.rb', line 13 def user_store_class @user_store_class end |
Instance Method Details
#disable! ⇒ Object
Disables authentication and removes OmniAuth middlewares
37 38 39 |
# File 'lib/kadmin/auth/configuration.rb', line 37 def disable! @enabled = false end |
#enable! ⇒ Object
Enables authentication and adds OmniAuth middlewares
29 30 31 32 33 34 |
# File 'lib/kadmin/auth/configuration.rb', line 29 def enable! unless @enabled append_omniauth_middleware @enabled = true end end |
#enabled? ⇒ Boolean
Returns true if enabled, false otherwise.
24 25 26 |
# File 'lib/kadmin/auth/configuration.rb', line 24 def enabled? return @enabled end |