Class: SettingsReader::VaultResolver::Helpers::VaultAuthentication

Inherits:
Object
  • Object
show all
Defined in:
lib/settings_reader/vault_resolver/helpers/vault_authentication.rb

Overview

Helps with authentication using different schemes

Constant Summary collapse

FAKE_RESOLVER_PATH =
'vault/authentication'.freeze

Instance Method Summary collapse

Instance Method Details

#authenticate_via_k8s(role, route: nil, service_token_path: nil) ⇒ Object



10
11
12
13
14
15
# File 'lib/settings_reader/vault_resolver/helpers/vault_authentication.rb', line 10

def authenticate_via_k8s(role, route: nil, service_token_path: nil)
  params = { role: role, route: route, service_token_path: service_token_path, no_cache: true }
  url_params = URI.encode_www_form(params.compact)
  backend = SettingsReader::VaultResolver::Engines::Auth::AUTH_BACKEND
  resolver.resolve("vault://auth/#{backend}/login?#{url_params}#client_token", FAKE_RESOLVER_PATH)
end