module Darrrr
Handles binary serialization/deserialization of recovery token data. It does not manage signing/verification of tokens. Only account providers will ever call the decode function
Constants
- VERSION
Attributes
recovery provider data is only loaded (and cached) upon use.
recovery provider data is only loaded (and cached) upon use.
recovery provider data is only loaded (and cached) upon use.
recovery provider data is only loaded (and cached) upon use.
recovery provider data is only loaded (and cached) upon use.
recovery provider data is only loaded (and cached) upon use.
recovery provider data is only loaded (and cached) upon use.
Public Class Methods
Returns a hash of all configuration values, recovery and account provider.
# File lib/darrrr.rb, line 125 def account_and_recovery_provider_config provider_data = Darrrr.this_account_provider&.to_h || {} if Darrrr.this_recovery_provider provider_data.merge!(recovery_provider_config) do |key, lhs, rhs| unless lhs == rhs raise ArgumentError, "inconsistent config value detected #{key}: #{lhs} != #{rhs}" end lhs end end provider_data end
Find and load remote account provider configuration data.
provider_origin: the origin that contains the config data in a well-known location.
# File lib/darrrr.rb, line 93 def account_provider(provider_origin, &block) unless self.account_providers raise "No account providers configured" end if provider_origin == this_account_provider&.origin this_account_provider elsif self.account_providers.include?(provider_origin) AccountProvider.new(provider_origin).load else raise UnknownProviderError, "Unknown account provider: #{provider_origin}" end end
returns the account provider information in hash form
# File lib/darrrr.rb, line 142 def account_provider_config this_account_provider&.to_h end
Find and load remote recovery provider configuration data.
provider_origin: the origin that contains the config data in a well-known location.
# File lib/darrrr.rb, line 67 def recovery_provider(provider_origin) unless self.recovery_providers raise "No recovery providers configured" end if provider_origin == this_recovery_provider&.origin this_recovery_provider elsif self.recovery_providers.include?(provider_origin) RecoveryProvider.new(provider_origin).load else raise UnknownProviderError, "Unknown recovery provider: #{provider_origin}" end end
returns the account provider information in hash form
# File lib/darrrr.rb, line 147 def recovery_provider_config this_recovery_provider&.to_h end
Permit an origin to act as an account provider.
account_origin: the origin to permit
# File lib/darrrr.rb, line 109 def register_account_provider(account_origin) self.account_providers ||= [] self.account_providers << account_origin end
Permit an origin to act as a recovery provider.
provider_origin: the origin to permit
# File lib/darrrr.rb, line 84 def register_recovery_provider(provider_origin) self.recovery_providers ||= [] self.recovery_providers << provider_origin end
Provide a reference to the account provider configuration for this web app
# File lib/darrrr.rb, line 115 def this_account_provider AccountProvider.this end
Provide a reference to the recovery provider configuration for this web app
# File lib/darrrr.rb, line 120 def this_recovery_provider RecoveryProvider.this end