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.'
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.
-
#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.
21 22 23 |
# File 'lib/activeadmin/oidc/configuration.rb', line 21 def initialize reset! end |
Instance Attribute Details
#access_denied_message ⇒ Object
Returns the value of attribute access_denied_message.
15 16 17 |
# File 'lib/activeadmin/oidc/configuration.rb', line 15 def @access_denied_message end |
#admin_user_class ⇒ Object
Returns the value of attribute admin_user_class.
15 16 17 |
# File 'lib/activeadmin/oidc/configuration.rb', line 15 def admin_user_class @admin_user_class end |
#client_id ⇒ Object
Returns the value of attribute client_id.
15 16 17 |
# File 'lib/activeadmin/oidc/configuration.rb', line 15 def client_id @client_id end |
#client_secret ⇒ Object
Returns the value of attribute client_secret.
15 16 17 |
# File 'lib/activeadmin/oidc/configuration.rb', line 15 def client_secret @client_secret end |
#identity_attribute ⇒ Object
Returns the value of attribute identity_attribute.
15 16 17 |
# File 'lib/activeadmin/oidc/configuration.rb', line 15 def identity_attribute @identity_attribute end |
#identity_claim ⇒ Object
Returns the value of attribute identity_claim.
15 16 17 |
# File 'lib/activeadmin/oidc/configuration.rb', line 15 def identity_claim @identity_claim end |
#issuer ⇒ Object
Returns the value of attribute issuer.
15 16 17 |
# File 'lib/activeadmin/oidc/configuration.rb', line 15 def issuer @issuer end |
#login_button_label ⇒ Object
Returns the value of attribute login_button_label.
15 16 17 |
# File 'lib/activeadmin/oidc/configuration.rb', line 15 def @login_button_label end |
#on_login ⇒ Object
Returns the value of attribute on_login.
15 16 17 |
# File 'lib/activeadmin/oidc/configuration.rb', line 15 def on_login @on_login end |
#redirect_uri ⇒ Object
Returns the value of attribute redirect_uri.
15 16 17 |
# File 'lib/activeadmin/oidc/configuration.rb', line 15 def redirect_uri @redirect_uri end |
#scope ⇒ Object
Returns the value of attribute scope.
15 16 17 |
# File 'lib/activeadmin/oidc/configuration.rb', line 15 def scope @scope end |
#timeout ⇒ Object
Returns the value of attribute timeout.
15 16 17 |
# File 'lib/activeadmin/oidc/configuration.rb', line 15 def timeout @timeout end |
Instance Method Details
#pkce ⇒ Object
42 43 44 45 46 |
# File 'lib/activeadmin/oidc/configuration.rb', line 42 def pkce return @pkce_override unless @pkce_override.nil? client_secret.nil? || client_secret.to_s.empty? end |
#pkce=(value) ⇒ Object
48 49 50 |
# File 'lib/activeadmin/oidc/configuration.rb', line 48 def pkce=(value) @pkce_override = value end |
#reset! ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/activeadmin/oidc/configuration.rb', line 25 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 @on_login = nil @pkce_override = nil self end |
#validate! ⇒ Object
52 53 54 55 56 57 58 59 |
# File 'lib/activeadmin/oidc/configuration.rb', line 52 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 |