Class: Authkeeper::Configuration
- Inherits:
-
Object
- Object
- Authkeeper::Configuration
- Defined in:
- lib/authkeeper/configuration.rb
Constant Summary collapse
- InitializeError =
Class.new(StandardError)
Instance Attribute Summary collapse
-
#access_token_name ⇒ Object
Returns the value of attribute access_token_name.
-
#domain ⇒ Object
Returns the value of attribute domain.
-
#fallback_url_session_name ⇒ Object
Returns the value of attribute fallback_url_session_name.
-
#omniauth_configs ⇒ Object
readonly
Returns the value of attribute omniauth_configs.
-
#omniauth_providers ⇒ Object
Returns the value of attribute omniauth_providers.
-
#token_expiration_seconds ⇒ Object
Returns the value of attribute token_expiration_seconds.
-
#user_model ⇒ Object
Returns the value of attribute user_model.
-
#user_session_model ⇒ Object
Returns the value of attribute user_session_model.
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #omniauth(provider, **args) ⇒ Object
- #validate ⇒ Object
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/authkeeper/configuration.rb', line 11 def initialize @user_model = 'User' @user_session_model = 'User::Session' @access_token_name = nil @domain = nil @fallback_url_session_name = nil @omniauth_providers = [] @omniauth_configs = {} @token_expiration_seconds = 18_144_000 # 30.days end |
Instance Attribute Details
#access_token_name ⇒ Object
Returns the value of attribute access_token_name.
7 8 9 |
# File 'lib/authkeeper/configuration.rb', line 7 def access_token_name @access_token_name end |
#domain ⇒ Object
Returns the value of attribute domain.
7 8 9 |
# File 'lib/authkeeper/configuration.rb', line 7 def domain @domain end |
#fallback_url_session_name ⇒ Object
Returns the value of attribute fallback_url_session_name.
7 8 9 |
# File 'lib/authkeeper/configuration.rb', line 7 def fallback_url_session_name @fallback_url_session_name end |
#omniauth_configs ⇒ Object (readonly)
Returns the value of attribute omniauth_configs.
9 10 11 |
# File 'lib/authkeeper/configuration.rb', line 9 def omniauth_configs @omniauth_configs end |
#omniauth_providers ⇒ Object
Returns the value of attribute omniauth_providers.
7 8 9 |
# File 'lib/authkeeper/configuration.rb', line 7 def omniauth_providers @omniauth_providers end |
#token_expiration_seconds ⇒ Object
Returns the value of attribute token_expiration_seconds.
7 8 9 |
# File 'lib/authkeeper/configuration.rb', line 7 def token_expiration_seconds @token_expiration_seconds end |
#user_model ⇒ Object
Returns the value of attribute user_model.
7 8 9 |
# File 'lib/authkeeper/configuration.rb', line 7 def user_model @user_model end |
#user_session_model ⇒ Object
Returns the value of attribute user_session_model.
7 8 9 |
# File 'lib/authkeeper/configuration.rb', line 7 def user_session_model @user_session_model end |
Instance Method Details
#omniauth(provider, **args) ⇒ Object
31 32 33 |
# File 'lib/authkeeper/configuration.rb', line 31 def omniauth(provider, **args) @omniauth_configs[provider] = args end |
#validate ⇒ Object
25 26 27 28 29 |
# File 'lib/authkeeper/configuration.rb', line 25 def validate raise InitializeError, 'User model must be present' if user_model.nil? raise InitializeError, 'User session model must be present' if user_session_model.nil? raise InitializeError, 'Access token name must be present' if access_token_name.nil? end |