Class: Bosh::Monitor::UAAToken

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

Constant Summary collapse

EXPIRATION_DEADLINE_IN_SECONDS =
60

Instance Method Summary collapse

Constructor Details

#initialize(client_id, client_secret, uaa_url, ca_cert, logger) ⇒ UAAToken

Returns a new instance of UAAToken.



39
40
41
42
43
44
45
46
47
# File 'lib/bosh/monitor/auth_provider.rb', line 39

def initialize(client_id, client_secret, uaa_url, ca_cert, logger)
  @uaa_token_issuer = CF::UAA::TokenIssuer.new(
    uaa_url,
    client_id,
    client_secret,
    {ssl_ca_file: ca_cert}
  )
  @logger = logger
end

Instance Method Details

#auth_headerObject



49
50
51
52
53
54
55
56
57
# File 'lib/bosh/monitor/auth_provider.rb', line 49

def auth_header
  if @uaa_token && !expires_soon?
    return @uaa_token.auth_header
  end

  fetch

  @uaa_token ? @uaa_token.auth_header : nil
end