Class: K8y::Kubeconfig::AuthInfo

Inherits:
Object
  • Object
show all
Defined in:
lib/k8y/kubeconfig/auth_info.rb

Instance Method Summary collapse

Constructor Details

#initialize(client_certificate: nil, client_certificate_data: nil, client_key: nil, client_key_data: nil, token: nil, token_file: nil, as: nil, as_groups: nil, as_user_extra: nil, username: nil, password: nil, auth_provider: nil, exec_options: nil, extensions: nil) ⇒ AuthInfo

Returns a new instance of AuthInfo.



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/k8y/kubeconfig/auth_info.rb', line 29

def initialize(client_certificate: nil, client_certificate_data: nil, client_key: nil, client_key_data: nil,
  token: nil, token_file: nil, as: nil, as_groups: nil, as_user_extra: nil, username: nil, password: nil,
  auth_provider: nil, exec_options: nil, extensions: nil)
  @client_certificate = client_certificate
  @client_certificate_data = client_certificate_data
  @client_key = client_key
  @client_key_data = client_key_data
  @token = token
  @token_file = token_file
  @as = as
  @as_groups = as_groups
  @as_user_extra = as_user_extra
  @username = username
  @password = password
  @auth_provider = auth_provider
  @exec_options = exec_options
  @extensions = extensions
end

Instance Method Details

#strategyObject



48
49
50
51
52
53
54
55
56
57
58
# File 'lib/k8y/kubeconfig/auth_info.rb', line 48

def strategy
  if username && password
    :basic
  elsif token
    :token
  elsif auth_provider.present?
    :auth_provider
  else
    :default
  end
end