Class: Bosh::Cli::Client::Uaa::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/cli/client/uaa/client.rb

Instance Method Summary collapse

Constructor Details

#initialize(target, auth_info, config) ⇒ Client

Returns a new instance of Client


12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/cli/client/uaa/client.rb', line 12

def initialize(target, auth_info, config)
  @target = target
  @auth_info = auth_info
  token_decoder = TokenDecoder.new
  if auth_info.client_auth?
    token_issuer = ClientTokenIssuer.new(auth_info, token_decoder)
  else
    token_issuer = PasswordTokenIssuer.new(auth_info, token_decoder)
  end
  @ssl_ca_file = auth_info.ssl_ca_file
  @token_issuer = token_issuer
  @config = config
end

Instance Method Details

#access_info(prompt_responses) ⇒ Object


33
34
35
36
37
38
39
# File 'lib/cli/client/uaa/client.rb', line 33

def access_info(prompt_responses)
  with_save { @token_issuer.access_info(prompt_responses) }
rescue CF::UAA::TargetError => e
  err("Failed to log in: #{e.info['error_description']}")
rescue CF::UAA::BadResponse
  nil
end

#promptsObject


26
27
28
29
30
31
# File 'lib/cli/client/uaa/client.rb', line 26

def prompts
  @token_issuer.prompts
rescue CF::UAA::SSLException => e
  raise e unless @ssl_ca_file.nil?
  err('Invalid SSL Cert. Use --ca-cert option when setting target to specify SSL certificate')
end

#refresh(access_info) ⇒ Object


41
42
43
44
45
# File 'lib/cli/client/uaa/client.rb', line 41

def refresh(access_info)
  @token_issuer.refresh(access_info)
rescue CF::UAA::TargetError
  nil
end