Module: Kreuzcrawl::AuthConfig

Extended by:
T::Helpers, T::Sig
Included in:
AuthConfigBasic, AuthConfigBearer, AuthConfigHeader
Defined in:
lib/kreuzcrawl/native.rb

Overview

Authentication configuration.

Class Method Summary collapse

Class Method Details

.from_hash(hash) ⇒ Object



22
23
24
25
26
27
28
29
30
# File 'lib/kreuzcrawl/native.rb', line 22

def self.from_hash(hash)
  discriminator = hash[:type] || hash["type"]
  case discriminator
  when "basic" then AuthConfigBasic.from_hash(hash)
  when "bearer" then AuthConfigBearer.from_hash(hash)
  when "header" then AuthConfigHeader.from_hash(hash)
  else raise "Unknown discriminator: #{discriminator}"
  end
end