module SoarAuthenticationToken class TokenGenerator def initialize(configuration) @configuration = configuration validate_configuration instantiate_provider end def inject_store_provider(store_provider) @provider.inject_store_provider(store_provider) end def generate(authenticated_identifier:, flow_identifier: nil) @provider.generate(authenticated_identifier: authenticated_identifier, flow_identifier: flow_identifier) end private def instantiate_provider @provider = Object::const_get("SoarAuthenticationToken::#{@configuration['provider']}").new(@configuration) end def validate_configuration raise "'provider' must be configured" unless @configuration['provider'] end end end