Class: StandardConfig::Config
- Inherits:
-
Object
- Object
- StandardConfig::Config
- Defined in:
- lib/standard_config/config.rb
Overview
Manages configuration for the StandardId engine
Usage:
StandardId.configure do |config|
config.account_class_name = "User"
config.cache_store = ActiveSupport::Cache::MemoryStore.new
config.logger = Rails.logger
config.allowed_post_logout_redirect_uris = ["https://example.com/logout"]
end
Instance Attribute Summary collapse
-
#account_class_name ⇒ Object
The name of the Account model class as a String, e.g.
-
#allowed_post_logout_redirect_uris ⇒ Object
Allowed post-logout redirect URIs for OIDC logout endpoint If empty or nil, no redirects are allowed and the endpoint will return a JSON message If provided, the post_logout_redirect_uri must exactly match one of the values in this list.
-
#cache_store ⇒ Object
Optional cache store and logger, used by StandardId.cache_store and StandardId.logger.
-
#inertia_component_namespace ⇒ Object
Namespace prefix for Inertia component paths Example: “Auth” will generate component paths like “Auth/Login/show”.
-
#issuer ⇒ Object
OAuth issuer identifier for ID tokens.
-
#logger ⇒ Object
Optional cache store and logger, used by StandardId.cache_store and StandardId.logger.
-
#login_url ⇒ Object
Optional login URL for redirecting unauthenticated browser requests Example: “/login” or a full URL like “app.example.com/login” If set, Authorization endpoints can redirect to this path with a redirect_uri param.
-
#passwordless_email_sender ⇒ Object
Passwordless authentication delivery callbacks (deprecated - use events instead).
-
#passwordless_sms_sender ⇒ Object
Passwordless authentication delivery callbacks (deprecated - use events instead).
-
#social_account_attributes ⇒ Object
Social login hooks.
-
#use_inertia ⇒ Object
Enable Inertia.js rendering for StandardId Web controllers When true and inertia_rails gem is available, controllers will render Inertia components.
-
#web_layout ⇒ Object
Layout name to use for StandardId Web controllers.
Instance Method Summary collapse
- #account_class ⇒ Object
-
#initialize ⇒ Config
constructor
A new instance of Config.
Constructor Details
#initialize ⇒ Config
Returns a new instance of Config.
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/standard_config/config.rb', line 50 def initialize @account_class_name = nil @cache_store = nil @logger = nil @issuer = nil @login_url = nil @apple_key_id = nil @apple_team_id = nil @social_account_attributes = nil @passwordless_email_sender = nil @passwordless_sms_sender = nil @allowed_post_logout_redirect_uris = [] @web_layout = nil @use_inertia = nil @inertia_component_namespace = nil end |
Instance Attribute Details
#account_class_name ⇒ Object
The name of the Account model class as a String, e.g. “User” or “Account”
13 14 15 |
# File 'lib/standard_config/config.rb', line 13 def account_class_name @account_class_name end |
#allowed_post_logout_redirect_uris ⇒ Object
Allowed post-logout redirect URIs for OIDC logout endpoint If empty or nil, no redirects are allowed and the endpoint will return a JSON message If provided, the post_logout_redirect_uri must exactly match one of the values in this list
35 36 37 |
# File 'lib/standard_config/config.rb', line 35 def allowed_post_logout_redirect_uris @allowed_post_logout_redirect_uris end |
#cache_store ⇒ Object
Optional cache store and logger, used by StandardId.cache_store and StandardId.logger
16 17 18 |
# File 'lib/standard_config/config.rb', line 16 def cache_store @cache_store end |
#inertia_component_namespace ⇒ Object
Namespace prefix for Inertia component paths Example: “Auth” will generate component paths like “Auth/Login/show”
48 49 50 |
# File 'lib/standard_config/config.rb', line 48 def inertia_component_namespace @inertia_component_namespace end |
#issuer ⇒ Object
OAuth issuer identifier for ID tokens
19 20 21 |
# File 'lib/standard_config/config.rb', line 19 def issuer @issuer end |
#logger ⇒ Object
Optional cache store and logger, used by StandardId.cache_store and StandardId.logger
16 17 18 |
# File 'lib/standard_config/config.rb', line 16 def logger @logger end |
#login_url ⇒ Object
Optional login URL for redirecting unauthenticated browser requests Example: “/login” or a full URL like “app.example.com/login” If set, Authorization endpoints can redirect to this path with a redirect_uri param
24 25 26 |
# File 'lib/standard_config/config.rb', line 24 def login_url @login_url end |
#passwordless_email_sender ⇒ Object
Passwordless authentication delivery callbacks (deprecated - use events instead)
30 31 32 |
# File 'lib/standard_config/config.rb', line 30 def passwordless_email_sender @passwordless_email_sender end |
#passwordless_sms_sender ⇒ Object
Passwordless authentication delivery callbacks (deprecated - use events instead)
30 31 32 |
# File 'lib/standard_config/config.rb', line 30 def passwordless_sms_sender @passwordless_sms_sender end |
#social_account_attributes ⇒ Object
Social login hooks
27 28 29 |
# File 'lib/standard_config/config.rb', line 27 def @social_account_attributes end |
#use_inertia ⇒ Object
Enable Inertia.js rendering for StandardId Web controllers When true and inertia_rails gem is available, controllers will render Inertia components
44 45 46 |
# File 'lib/standard_config/config.rb', line 44 def use_inertia @use_inertia end |
#web_layout ⇒ Object
Layout name to use for StandardId Web controllers. If nil, controllers should default to “application” (host app or dummy app). Examples: “application”, “standard_id/web/application”, “my_custom_layout”
40 41 42 |
# File 'lib/standard_config/config.rb', line 40 def web_layout @web_layout end |
Instance Method Details
#account_class ⇒ Object
67 68 69 70 71 |
# File 'lib/standard_config/config.rb', line 67 def account_class account_class_name.constantize rescue NameError raise NameError, "Could not find account class: #{account_class_name}. Please set a valid class name using `StandardId.configure { |c| c.account_class_name = 'YourAccountClass' }`" end |