Class: ActiveAdmin::Oidc::Configuration
- Inherits:
-
Object
- Object
- ActiveAdmin::Oidc::Configuration
- Defined in:
- lib/activeadmin/oidc/configuration.rb
Constant Summary collapse
- DEFAULT_SCOPE =
'openid email profile'- DEFAULT_TIMEOUT =
5- DEFAULT_IDENTITY_ATTRIBUTE =
:email- DEFAULT_IDENTITY_CLAIM =
:email- DEFAULT_LOGIN_BUTTON_LABEL =
'Sign in with SSO'- DEFAULT_ADMIN_USER_CLASS =
'AdminUser'- DEFAULT_ACCESS_DENIED_MESSAGE =
'Your account has no permission to access this admin panel.'- DEFAULT_LOGIN_PATH =
'/admin/login'- DEFAULT_LOGOUT_PATH =
'/admin/logout'
Instance Attribute Summary collapse
-
#access_denied_message ⇒ Object
Returns the value of attribute access_denied_message.
-
#admin_user_class ⇒ Object
Returns the value of attribute admin_user_class.
-
#client_id ⇒ Object
Returns the value of attribute client_id.
-
#client_secret ⇒ Object
Returns the value of attribute client_secret.
-
#identity_attribute ⇒ Object
Returns the value of attribute identity_attribute.
-
#identity_claim ⇒ Object
Returns the value of attribute identity_claim.
-
#issuer ⇒ Object
Returns the value of attribute issuer.
-
#login_button_label ⇒ Object
Returns the value of attribute login_button_label.
-
#login_path ⇒ Object
Returns the value of attribute login_path.
-
#logout_path ⇒ Object
Returns the value of attribute logout_path.
-
#on_login ⇒ Object
Returns the value of attribute on_login.
-
#redirect_uri ⇒ Object
Returns the value of attribute redirect_uri.
-
#scope ⇒ Object
Returns the value of attribute scope.
-
#timeout ⇒ Object
Returns the value of attribute timeout.
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #pkce ⇒ Object
- #pkce=(value) ⇒ Object
- #reset! ⇒ Object
- #validate! ⇒ Object
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
24 25 26 |
# File 'lib/activeadmin/oidc/configuration.rb', line 24 def initialize reset! end |
Instance Attribute Details
#access_denied_message ⇒ Object
Returns the value of attribute access_denied_message.
17 18 19 |
# File 'lib/activeadmin/oidc/configuration.rb', line 17 def @access_denied_message end |
#admin_user_class ⇒ Object
Returns the value of attribute admin_user_class.
17 18 19 |
# File 'lib/activeadmin/oidc/configuration.rb', line 17 def admin_user_class @admin_user_class end |
#client_id ⇒ Object
Returns the value of attribute client_id.
17 18 19 |
# File 'lib/activeadmin/oidc/configuration.rb', line 17 def client_id @client_id end |
#client_secret ⇒ Object
Returns the value of attribute client_secret.
17 18 19 |
# File 'lib/activeadmin/oidc/configuration.rb', line 17 def client_secret @client_secret end |
#identity_attribute ⇒ Object
Returns the value of attribute identity_attribute.
17 18 19 |
# File 'lib/activeadmin/oidc/configuration.rb', line 17 def identity_attribute @identity_attribute end |
#identity_claim ⇒ Object
Returns the value of attribute identity_claim.
17 18 19 |
# File 'lib/activeadmin/oidc/configuration.rb', line 17 def identity_claim @identity_claim end |
#issuer ⇒ Object
Returns the value of attribute issuer.
17 18 19 |
# File 'lib/activeadmin/oidc/configuration.rb', line 17 def issuer @issuer end |
#login_button_label ⇒ Object
Returns the value of attribute login_button_label.
17 18 19 |
# File 'lib/activeadmin/oidc/configuration.rb', line 17 def @login_button_label end |
#login_path ⇒ Object
Returns the value of attribute login_path.
17 18 19 |
# File 'lib/activeadmin/oidc/configuration.rb', line 17 def login_path @login_path end |
#logout_path ⇒ Object
Returns the value of attribute logout_path.
17 18 19 |
# File 'lib/activeadmin/oidc/configuration.rb', line 17 def logout_path @logout_path end |
#on_login ⇒ Object
Returns the value of attribute on_login.
17 18 19 |
# File 'lib/activeadmin/oidc/configuration.rb', line 17 def on_login @on_login end |
#redirect_uri ⇒ Object
Returns the value of attribute redirect_uri.
17 18 19 |
# File 'lib/activeadmin/oidc/configuration.rb', line 17 def redirect_uri @redirect_uri end |
#scope ⇒ Object
Returns the value of attribute scope.
17 18 19 |
# File 'lib/activeadmin/oidc/configuration.rb', line 17 def scope @scope end |
#timeout ⇒ Object
Returns the value of attribute timeout.
17 18 19 |
# File 'lib/activeadmin/oidc/configuration.rb', line 17 def timeout @timeout end |
Instance Method Details
#pkce ⇒ Object
47 48 49 50 51 |
# File 'lib/activeadmin/oidc/configuration.rb', line 47 def pkce return @pkce_override unless @pkce_override.nil? client_secret.nil? || client_secret.to_s.empty? end |
#pkce=(value) ⇒ Object
53 54 55 |
# File 'lib/activeadmin/oidc/configuration.rb', line 53 def pkce=(value) @pkce_override = value end |
#reset! ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/activeadmin/oidc/configuration.rb', line 28 def reset! @issuer = nil @client_id = nil @client_secret = nil @scope = DEFAULT_SCOPE @redirect_uri = nil @login_button_label = DEFAULT_LOGIN_BUTTON_LABEL @timeout = DEFAULT_TIMEOUT @identity_attribute = DEFAULT_IDENTITY_ATTRIBUTE @identity_claim = DEFAULT_IDENTITY_CLAIM @access_denied_message = DEFAULT_ACCESS_DENIED_MESSAGE @admin_user_class = DEFAULT_ADMIN_USER_CLASS @login_path = DEFAULT_LOGIN_PATH @logout_path = DEFAULT_LOGOUT_PATH @on_login = nil @pkce_override = nil self end |
#validate! ⇒ Object
57 58 59 60 61 62 63 64 |
# File 'lib/activeadmin/oidc/configuration.rb', line 57 def validate! raise ConfigurationError, 'issuer is required' if issuer.blank? raise ConfigurationError, 'client_id is required' if client_id.blank? raise ConfigurationError, 'on_login is required' if on_login.nil? raise ConfigurationError, 'on_login must be callable (respond to #call)' unless on_login.respond_to?(:call) true end |