Sha256: da45855ef111603623859aa730951e6caa96f7393041f5b3e0eb39c8f2fb87b1

Contents?: true

Size: 742 Bytes

Versions: 4

Compression:

Stored size: 742 Bytes

Contents

module SoarAuthenticationToken
  class TokenProvider
    def initialize(configuration)
      @configuration = configuration
      validate_configuration
      instantiate_provider
    end

    def fetch(request)
      @provider.fetch(request)
    end

    private

    def instantiate_provider
      @provider = Object::const_get(@configuration['authentication_token']['provider'])
                      .new(@configuration['authentication_token'])
    end

    def validate_configuration
      raise 'authentication_token provider must be configured' if @configuration['authentication_token'].nil? or
                                                                  @configuration['authentication_token']['provider'].nil?
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
soar_authentication_token-7.1.1 lib/soar_authentication_token/token_provider.rb
soar_authentication_token-7.1.0 lib/soar_authentication_token/token_provider.rb
soar_authentication_token-7.0.1 lib/soar_authentication_token/token_provider.rb
soar_authentication_token-7.0.0 lib/soar_authentication_token/token_provider.rb