Module: VaultPlugin::Authentication

Included in:
VaultPlugin::API::Backend, Endpoint
Defined in:
lib/smart_proxy_vault/authentication.rb,
lib/smart_proxy_vault/authentication/chef.rb

Defined Under Namespace

Modules: Chef

Instance Method Summary collapse

Instance Method Details

#auth_backendObject



5
6
7
# File 'lib/smart_proxy_vault/authentication.rb', line 5

def auth_backend
  ::VaultPlugin::Plugin.settings.auth_backend.to_sym
end

#auth_moduleObject



9
10
11
# File 'lib/smart_proxy_vault/authentication.rb', line 9

def auth_module
  Object.const_get('::VaultPlugin::Authentication::' + auth_backend.capitalize.to_s)
end

#authorized?Boolean

Returns:

  • (Boolean)


20
21
22
23
24
# File 'lib/smart_proxy_vault/authentication.rb', line 20

def authorized?
  create_setting_accessors
  extend auth_module
  authorized?
end

#create_setting_accessorsObject

Creates convenient accessor methods for all keys underneath auth_backend



14
15
16
17
18
# File 'lib/smart_proxy_vault/authentication.rb', line 14

def create_setting_accessors
  ::VaultPlugin::Plugin.settings[auth_backend].each do |key,value|
    define_singleton_method(key.to_sym) { value }
  end
end

#vault_clientObject

Returns the human-readable identity for the requesting client Optionally used in a token’s metadata & display-name



28
29
30
31
# File 'lib/smart_proxy_vault/authentication.rb', line 28

def vault_client
  extend auth_module
  vault_client
end