Class: K8y::REST::Auth::Factory

Inherits:
Object
  • Object
show all
Defined in:
lib/k8y/rest/auth/factory.rb

Instance Method Summary collapse

Instance Method Details

#from_auth_info(auth_info) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/k8y/rest/auth/factory.rb', line 11

def from_auth_info(auth_info)
  case auth_info.strategy
  when :basic
    Basic.new(username: auth_info.username, password: auth_info.password)
  when :token
    Token.new(token: auth_info.token)
  when :auth_provider
    Providers::Factory.new.from_auth_provider(auth_info.auth_provider)
  else
    AuthBase.new
  end
end