Class: CfRubyClient::Login

Inherits:
Base
  • Object
show all
Defined in:
lib/cf_ruby_client/login.rb

Instance Method Summary collapse

Methods inherited from Base

#api_endpoint, #cloud_foundry_config, #delete_entity, #fetch_entities, #logger, #patch_entity, #post_entity, #put_entity, #resource, #uaa_endpoint

Instance Method Details

#authorization_stringObject



4
5
6
# File 'lib/cf_ruby_client/login.rb', line 4

def authorization_string
  token.info["token_type"] + " " + token.info["access_token"]
end

#tokenObject



8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/cf_ruby_client/login.rb', line 8

def token
  @token ||= begin
    token_issuer = CF::UAA::TokenIssuer.new(
      uaa_endpoint,
      "cf",
      nil,
      skip_ssl_validation: cloud_foundry_config.skip_ssl_validation
    )
    token_issuer.owner_password_grant(
      username: cloud_foundry_config.username,
      password: cloud_foundry_config.password
    )
  end
end