Class: Bosh::Monitor::AuthProvider

Inherits:
Object
  • Object
show all
Defined in:
lib/bosh/monitor/auth_provider.rb

Instance Method Summary collapse

Constructor Details

#initialize(auth_info, config, logger) ⇒ AuthProvider

Returns a new instance of AuthProvider.



5
6
7
8
9
10
11
12
13
14
15
# File 'lib/bosh/monitor/auth_provider.rb', line 5

def initialize(auth_info, config, logger)
  @auth_info = auth_info.fetch('user_authentication', {})

  @user = config['user'].to_s
  @password = config['password'].to_s
  @client_id = config['client_id'].to_s
  @client_secret = config['client_secret'].to_s
  @ca_cert = config['ca_cert'].to_s

  @logger = logger
end

Instance Method Details

#auth_headerObject



17
18
19
20
21
22
23
24
# File 'lib/bosh/monitor/auth_provider.rb', line 17

def auth_header
  if @auth_info.fetch('type', 'local') == 'uaa'
    uaa_url = @auth_info.fetch('options', {}).fetch('url')
    return uaa_token_header(uaa_url)
  end

  [@user, @password]
end