Class: Bosh::Monitor::UAAToken
- Inherits:
-
Object
- Object
- Bosh::Monitor::UAAToken
- Defined in:
- lib/bosh/monitor/auth_provider.rb
Constant Summary collapse
- EXPIRATION_DEADLINE_IN_SECONDS =
60
Instance Method Summary collapse
- #auth_header ⇒ Object
-
#initialize(client_id, client_secret, uaa_url, ca_cert_file_path, logger) ⇒ UAAToken
constructor
A new instance of UAAToken.
Constructor Details
#initialize(client_id, client_secret, uaa_url, ca_cert_file_path, logger) ⇒ UAAToken
Returns a new instance of UAAToken.
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/bosh/monitor/auth_provider.rb', line 39 def initialize(client_id, client_secret, uaa_url, ca_cert_file_path, logger) = {} if File.exist?(ca_cert_file_path) && !File.read(ca_cert_file_path).strip.empty? [:ssl_ca_file] = ca_cert_file_path else cert_store = OpenSSL::X509::Store.new cert_store.set_default_paths [:ssl_cert_store] = cert_store end @uaa_token_issuer = CF::UAA::TokenIssuer.new( uaa_url, client_id, client_secret, , ) @logger = logger end |
Instance Method Details
#auth_header ⇒ Object
59 60 61 62 63 64 65 66 67 |
# File 'lib/bosh/monitor/auth_provider.rb', line 59 def auth_header if @uaa_token && !expires_soon? return @uaa_token.auth_header end fetch @uaa_token ? @uaa_token.auth_header : nil end |