Class: StandardConfig::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/standard_config/config.rb

Overview

Manages configuration for the StandardId engine

Usage:

StandardId.configure do |config|
  config. = "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

Instance Method Summary collapse

Constructor Details

#initializeConfig

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_nameObject

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
end

#allowed_post_logout_redirect_urisObject

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_storeObject

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_namespaceObject

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

#issuerObject

OAuth issuer identifier for ID tokens



19
20
21
# File 'lib/standard_config/config.rb', line 19

def issuer
  @issuer
end

#loggerObject

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_urlObject

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
end

#passwordless_email_senderObject

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_senderObject

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_attributesObject

Social login hooks



27
28
29
# File 'lib/standard_config/config.rb', line 27

def 
  @social_account_attributes
end

#use_inertiaObject

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_layoutObject

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_classObject



67
68
69
70
71
# File 'lib/standard_config/config.rb', line 67

def 
  .constantize
rescue NameError
  raise NameError, "Could not find account class: #{}. Please set a valid class name using `StandardId.configure { |c| c.account_class_name = 'YourAccountClass' }`"
end