Class: ProxyRb::PasswordFetchers::VaultPasswordFetcher
- Inherits:
-
BasicPasswordFetcher
- Object
- BasicPasswordFetcher
- ProxyRb::PasswordFetchers::VaultPasswordFetcher
- Includes:
- Contracts::Builtin, Contracts::Core
- Defined in:
- lib/proxy_rb/password_fetchers/vault_password_fetcher.rb
Overview
… from HashiCorp Vault
Instance Method Summary collapse
- #call(user_name) ⇒ Object
-
#initialize(prefix:, client: ::Vault::Client.new(address: ENV['VAULT_ADDR'])) ⇒ VaultPasswordFetcher
constructor
A new instance of VaultPasswordFetcher.
Constructor Details
#initialize(prefix:, client: ::Vault::Client.new(address: ENV['VAULT_ADDR'])) ⇒ VaultPasswordFetcher
Returns a new instance of VaultPasswordFetcher.
30 31 32 33 |
# File 'lib/proxy_rb/password_fetchers/vault_password_fetcher.rb', line 30 def initialize(prefix:, client: ::Vault::Client.new(address: ENV['VAULT_ADDR'])) @prefix = prefix @client = client end |
Instance Method Details
#call(user_name) ⇒ Object
38 39 40 41 42 43 44 |
# File 'lib/proxy_rb/password_fetchers/vault_password_fetcher.rb', line 38 def call(user_name) client.with_retries(::Vault::HTTPConnectionError, ::Vault::HTTPError) do |_attempt, _e| UserPasswords::VaultUserPassword.new( fetch_password_for_user(user_name) ).to_s end end |