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

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

Instance Method Summary collapse

Constructor Details

#initialize(options, token_decoder) ⇒ PasswordTokenIssuer

Returns a new instance of PasswordTokenIssuer.



10
11
12
13
# File 'lib/cli/client/uaa/password_token_issuer.rb', line 10

def initialize(options, token_decoder)
  @token_issuer = CF::UAA::TokenIssuer.new(options.url, 'bosh_cli', nil, {ssl_ca_file: options.ssl_ca_file})
  @token_decoder = token_decoder
end

Instance Method Details

#access_info(prompt_responses) ⇒ Object



21
22
23
24
25
# File 'lib/cli/client/uaa/password_token_issuer.rb', line 21

def access_info(prompt_responses)
  credentials = prompt_responses.select { |_, c| !c.empty? }
  token = @token_issuer.owner_password_credentials_grant(credentials)
  PasswordAccessInfo.new(token, @token_decoder)
end

#promptsObject



15
16
17
18
19
# File 'lib/cli/client/uaa/password_token_issuer.rb', line 15

def prompts
  @token_issuer.prompts.map do |field, (type, display_text)|
    Prompt.new(field, type, display_text)
  end
end

#refresh(access_info) ⇒ Object



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

def refresh(access_info)
  token = @token_issuer.refresh_token_grant(access_info.refresh_token)
  PasswordAccessInfo.new(token, @token_decoder)
end