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

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

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Client

Returns a new instance of Client.



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

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

Instance Method Details

#login(credentials) ⇒ Object



30
31
32
33
34
35
36
# File 'lib/cli/client/uaa.rb', line 30

def (credentials)
  @token_issuer.access_info(credentials)
rescue CF::UAA::TargetError => e
  err("Failed to log in: #{e.info['error_description']}") #FIXME: the uaa client shouldn't know about 'err'
rescue CF::UAA::BadResponse
  nil
end

#promptsObject



23
24
25
26
27
28
# File 'lib/cli/client/uaa.rb', line 23

def prompts
  @token_issuer.prompts
rescue CF::UAA::SSLException => e
  raise e unless @ssl_ca_file.nil?
  err('Invalid SSL Cert. Use --ca-cert to specify SSL certificate') #FIXME: the uaa client shouldn't know about 'err'
end