Module: Rodauth
- Defined in:
- lib/rodauth/tools/version.rb,
lib/rodauth/tools.rb,
lib/rodauth/secret_guard.rb,
lib/rodauth/table_inspector.rb,
lib/rodauth/tools/migration.rb,
lib/rodauth/sequel_generator.rb,
lib/rodauth/template_inspector.rb,
lib/rodauth/features/table_guard.rb,
lib/rodauth/tools/console_helpers.rb,
lib/rodauth/tools/account_id_cipher.rb,
lib/rodauth/features/jwt_secret_guard.rb,
lib/rodauth/features/external_identity.rb,
lib/rodauth/features/hmac_secret_guard.rb,
lib/rodauth/features/account_id_obfuscation.rb
Overview
Enable with:
enable :external_identity
Configuration (Layer 1 - Basic):
external_identity_column :stripe_customer_id
external_identity_column :redis_uuid, method_name: :redis_session_key
external_identity_on_conflict :warn # :error, :warn, :skip
external_identity_check_columns true # true (default), false, or :autocreate
Configuration (Layer 2 - Extended Features):
external_identity_column :stripe_customer_id,
before_create_account: -> { Stripe::Customer.create(email: account[:email]).id },
formatter: -> (v) { v.to_s.strip.downcase },
validator: -> (v) { v.start_with?('cus_') },
verifier: -> (id) { Stripe::Customer.retrieve(id) && !customer.deleted? },
handshake: -> (id, token) { session[:oauth_state] == token }
Usage:
rodauth.stripe_customer_id # Auto-generated helper method
rodauth.redis_uuid # Auto-generated helper method
Introspection:
rodauth.external_identity_column_list # [:stripe_customer_id, :redis_uuid]
rodauth.external_identity_column_config(:stripe_customer_id) # {...}
rodauth.external_identity_status # Complete debug info
Example:
plugin :rodauth do
enable :login, :logout, :external_identity
# Declare external identity columns
external_identity_column :stripe_customer_id
external_identity_column :redis_uuid
# Custom method name
external_identity_column :redis_key, method_name: :redis_session_key
end
# In your app
rodauth.stripe_customer_id # => "cus_abc123"
rodauth.redis_uuid # => "550e8400-e29b-41d4-a716-446655440000"
Defined Under Namespace
Modules: SecretGuard, TableInspector, TemplateInspector, Tools Classes: SequelGenerator