cf-uaac 4.4.0 → 4.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5166dc3408b2860dd74b3beae7c699a4da045d871f194f379949e8458d207cc5
4
- data.tar.gz: 0b4fc22bae413905c699f81590b482b5d74b1d6f480f428a02b839f34e60cd90
3
+ metadata.gz: 36488b9610f3cc86a06d229903f29beda0e6394d533894390199e89851e225de
4
+ data.tar.gz: 00b0ea7818b49c8871e78ebb1286982dcd569ac33decd42a96d9fa10cec0aea7
5
5
  SHA512:
6
- metadata.gz: b380a1b762644585a61a9218ff83edc4dd50b39e35b3dd15b8deb856edd0b741d82e714c61b5d3f88eb0eaecb650c206ca987c4fc48e95df98f03a703706ad6c
7
- data.tar.gz: 9d1c5a109a13dcc8642bb4b522d3ef7ee712f84341a98fd3f0f5c50eaf9beabd1bb74fd97eb9000c8a2f5b5d2e3a1ab13338d34c7cfcfa0961e9df80a6ac1c4a
6
+ metadata.gz: 349d0003eb1dba666f54fadc9017b644269d15cf89edb83cf210e22c5fac38b4faf70e0b12b07afeec378572c158ea8db77cb7242f998ad73d1258b75d285c4a
7
+ data.tar.gz: b669538c9b836c36ac8f493c3e0539303c0269c08fa3a6704e7f4f26140333016ec748e6e594b54932f04f993ecfaf259800c294e1f727c00b249dc060ff1476
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # CloudFoundry UAA Command Line Client
2
2
 
3
- [![Build Status](https://travis-ci.org/cloudfoundry/cf-uaac.svg?branch=master)](https://travis-ci.org/cloudfoundry/cf-uaac)
3
+ ![Build status](https://github.com/cloudfoundry/cf-uaac/actions/workflows/ruby.yml/badge.svg)
4
4
  [![Gem Version](https://badge.fury.io/rb/cf-uaac.png)](https://rubygems.org/gems/cf-uaac)
5
5
 
6
6
  ## Installation
@@ -67,4 +67,4 @@ export UAA_CLIENT_ID="admin"
67
67
  export UAA_CLIENT_SECRET="adminsecret"
68
68
  export UAA_CLIENT_TARGET="http://localhost:8080/uaa"
69
69
  bundle exec rake test
70
- ```
70
+ ```
data/cf-uaac.gemspec CHANGED
@@ -31,7 +31,7 @@ Gem::Specification.new do |s|
31
31
  s.require_paths = ['lib']
32
32
 
33
33
  # dependencies
34
- s.add_runtime_dependency 'cf-uaa-lib', '~> 3.14', '> 3.14.3'
34
+ s.add_runtime_dependency 'cf-uaa-lib', '~> 4.0'
35
35
  s.add_development_dependency 'rake', '>= 10.3.1', '~> 13.0'
36
36
  s.add_development_dependency 'rspec', '>= 2.14.1', '~> 3.9'
37
37
  s.add_development_dependency 'simplecov', '~> 0.21.2'
data/lib/uaa/cli/base.rb CHANGED
@@ -14,6 +14,7 @@
14
14
  require 'highline'
15
15
  require 'optparse'
16
16
  require 'json/pure'
17
+ require 'io/console'
17
18
 
18
19
  module CF; module UAA end end
19
20
 
@@ -65,7 +66,7 @@ class Topic
65
66
 
66
67
  def terminal_columns
67
68
  return @terminal_columns ||= 0 if @terminal_columns || !@output.tty?
68
- cols = HighLine::SystemExtensions.terminal_size.first rescue 0
69
+ cols = IO.console.winsize.last rescue 0 if $stdin.tty?
69
70
  @terminal_columns = !cols || cols < 40 ? 0 : cols
70
71
  end
71
72
 
@@ -28,6 +28,7 @@ class ClientCli < CommonCli
28
28
  :refresh_token_validity => 'seconds',
29
29
  :redirect_uri => 'list',
30
30
  :autoapprove => 'list',
31
+ :allowedproviders => 'list',
31
32
  :'signup_redirect_url' => 'url'
32
33
  }
33
34
  CLIENT_SCHEMA.each { |k, v| define_option(k, "--#{k} <#{v}>") }
@@ -51,6 +52,9 @@ class ClientCli < CommonCli
51
52
  info[k] = Util.arglist(info[k]) if p == 'list'
52
53
  info.delete(k) unless info[k]
53
54
  end
55
+ if opts.key?(k) && k == :allowedproviders && (info[k].join('') == 'all' || info[k].join('') == 'null' || info[k].join('') == 'nil')
56
+ info[:allowedproviders] = nil
57
+ end
54
58
  end
55
59
  end
56
60
 
@@ -31,7 +31,7 @@ class CommonCli < Topic
31
31
 
32
32
  def username(name); name || ask("User name") end
33
33
  def userpwd(pwd = opts[:password]); pwd || ask_pwd("Password") end
34
- def passcode(passcode = opts[:passcode]); passcode || ask("Passcode (from #{Config.target}/passcode)") end
34
+ def passcode(passcode = opts[:passcode]); passcode || ask("Passcode ( from #{Config.target}/passcode )") end
35
35
  def clientid(id = opts[:client]); id || ask("Client ID") end
36
36
  def clientsecret(secret = opts[:secret]); secret || ask_pwd("Client secret") end
37
37
  def clientname(name = opts[:name]); name end
@@ -186,7 +186,8 @@ class MiscCli < CommonCli
186
186
  define_option :ca_cert, "--ca-cert [file]", "use the given CA certificate to validate the target's SSL certificate"
187
187
  define_option :skip_ssl_validation, "--skip-ssl-validation", "do not attempt to validate ssl certificate"
188
188
  define_option :force, "--[no-]force", "-f", "set even if target does not respond"
189
- desc "target [uaa_url]", "Display current or set new target", :force, :ca_cert, :skip_ssl_validation do |uaa_url|
189
+ define_option :basic_auth, "--[no-]basic_auth", "set if you need basic or oauth2 (url encoded) client authentication"
190
+ desc "target [uaa_url]", "Display current or set new target", :force, :ca_cert, :skip_ssl_validation, :basic_auth do |uaa_url|
190
191
  msg, info = nil, {}
191
192
  if uaa_url
192
193
  if uaa_url.to_i.to_s == uaa_url
@@ -204,6 +205,8 @@ class MiscCli < CommonCli
204
205
  Config.target = url # we now have a canonical url set to https if possible
205
206
  Config.target_opts(skip_ssl_validation: true) if opts[:skip_ssl_validation]
206
207
  Config.target_opts(ca_cert: opts[:ca_cert])
208
+ Config.target_opts(basic_auth: true) if opts[:basic_auth] == true
209
+ Config.target_opts(basic_auth: false) if opts[:basic_auth] == false
207
210
  update_target_info(info) if info[:prompts]
208
211
  end
209
212
  return say "no target set" unless Config.target
data/lib/uaa/cli/info.rb CHANGED
@@ -47,10 +47,6 @@ class InfoCli < CommonCli
47
47
  pp info
48
48
  end
49
49
 
50
- desc "stats", "Show UAA's current usage statistics", :client, :secret do
51
- pp misc_request { @cli_class.uaa_info_client.varz(clientid, clientsecret) }
52
- end
53
-
54
50
  desc "password strength [password]", "calculate strength score of a password" do |pwd|
55
51
  pp misc_request { @cli_class.uaa_info_client.password_strength(userpwd(pwd)) }
56
52
  end
data/lib/uaa/cli/token.rb CHANGED
@@ -25,6 +25,7 @@ class TokenCatcher < Stub::Base
25
25
  secret = server.info.delete(:client_secret)
26
26
  ti = TokenIssuer.new(Config.target, server.info.delete(:client_id), secret,
27
27
  { token_target: Config.target_value(:token_target),
28
+ basic_auth: Config.target_value(:basic_auth),
28
29
  skip_ssl_validation: Config.target_value(:skip_ssl_validation)})
29
30
  tkn = secret ? ti.authcode_grant(server.info.delete(:uri), data) :
30
31
  ti.implicit_grant(server.info.delete(:uri), data)
@@ -88,8 +89,9 @@ class TokenCli < CommonCli
88
89
 
89
90
  def issuer_request(client_id, secret = nil)
90
91
  update_target_info
91
- yield TokenIssuer.new(Config.target.to_s, CGI.escape(client_id), CGI.escape(secret),
92
+ yield TokenIssuer.new(Config.target.to_s, client_id, secret,
92
93
  { token_target: Config.target_value(:token_endpoint),
94
+ basic_auth: Config.target_value(:basic_auth),
93
95
  skip_ssl_validation: Config.target_value(:skip_ssl_validation),
94
96
  ssl_ca_file: Config.target_value(:ca_cert) })
95
97
  rescue Exception => e
data/lib/uaa/cli/user.rb CHANGED
@@ -19,12 +19,12 @@ class UserCli < CommonCli
19
19
 
20
20
  topic 'User Accounts', 'account'
21
21
 
22
+ define_option :origin, '--origin <name>, select user to update by identity provider origin. Defaults to UAA'
22
23
  define_option :givenName, '--given_name <name>'
23
24
  define_option :familyName, '--family_name <name>'
24
25
  define_option :emails, '--emails <addresses>'
25
26
  define_option :phoneNumbers, '--phones <phone_numbers>'
26
- define_option :origin, '--origin <identity provider origin, defaults to UAA>'
27
- USER_INFO_OPTS = [:givenName, :familyName, :emails, :phoneNumbers, :origin]
27
+ USER_INFO_OPTS = [:origin, :givenName, :familyName, :emails, :phoneNumbers]
28
28
 
29
29
  def user_opts(info = {})
30
30
  [:emails, :phoneNumbers].each do |o|
data/lib/uaa/stub/scim.rb CHANGED
@@ -65,7 +65,7 @@ class StubScim
65
65
  :authorizations, :groups].to_set,
66
66
  client: [*COMMON_ATTRS, :client_id, :name, :client_secret, :authorities,
67
67
  :authorized_grant_types, :scope, :autoapprove,
68
- :access_token_validity, :refresh_token_validity, :redirect_uri,
68
+ :access_token_validity, :refresh_token_validity, :redirect_uri, :allowedproviders,
69
69
  :'signup_redirect_url'].to_set,
70
70
  group: [*COMMON_ATTRS, :displayname, :members, :writers, :readers, :external_groups].to_set }
71
71
  VISIBLE_ATTRS = {user: Set.new(LEGAL_ATTRS[:user] - HIDDEN_ATTRS),
@@ -59,7 +59,7 @@ describe ClientCli do
59
59
 
60
60
  it 'does not wrap the output of the access token in the terminal' do
61
61
  allow(@output).to receive(:tty?).and_return(true)
62
- allow(HighLine::Terminal).to receive(:terminal_size).and_return([80, 40])
62
+ allow(IO.console).to receive(:winsize).and_return([40, 80])
63
63
  Cli.run('context').should be
64
64
  Cli.output.string.should match /access_token: \S+?\s+token_type/m
65
65
  end
data/spec/common_spec.rb CHANGED
@@ -44,7 +44,7 @@ describe CommonCli do
44
44
 
45
45
  it "displays user help with -h has --origin option" do
46
46
  Cli.run("user -h")
47
- Cli.output.string.should include("--origin <identity provider origin, defaults to UAA>")
47
+ Cli.output.string.should include("--origin <name>, select user to update by identity provider origin. Defaults to UAA")
48
48
  end
49
49
 
50
50
  it "displays group help with -h has --origin option" do
data/spec/info_spec.rb CHANGED
@@ -53,11 +53,6 @@ describe InfoCli do
53
53
  Cli.output.string.should include "score", "requiredScore"
54
54
  end
55
55
 
56
- it "gets the server stats" do
57
- pending "no UAA_VARZ_SECRET environment variable set" unless @varz_secret
58
- Cli.run("stats -c varz -s #{@varz_secret}").should be
59
- Cli.output.string.should include 'type: UAA', 'mem:', 'version:'
60
- end
61
56
 
62
57
  it "sets multiple targets to be fully qualified in config and targets output" do
63
58
  Config.load("")
data/version.txt CHANGED
@@ -1 +1 @@
1
- 4.4.0
1
+ 4.5.0
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cf-uaac
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.4.0
4
+ version: 4.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dave Syer
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2022-01-14 00:00:00.000000000 Z
15
+ date: 2022-01-21 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: cf-uaa-lib
@@ -20,20 +20,14 @@ dependencies:
20
20
  requirements:
21
21
  - - "~>"
22
22
  - !ruby/object:Gem::Version
23
- version: '3.14'
24
- - - ">"
25
- - !ruby/object:Gem::Version
26
- version: 3.14.3
23
+ version: '4.0'
27
24
  type: :runtime
28
25
  prerelease: false
29
26
  version_requirements: !ruby/object:Gem::Requirement
30
27
  requirements:
31
28
  - - "~>"
32
29
  - !ruby/object:Gem::Version
33
- version: '3.14'
34
- - - ">"
35
- - !ruby/object:Gem::Version
36
- version: 3.14.3
30
+ version: '4.0'
37
31
  - !ruby/object:Gem::Dependency
38
32
  name: rake
39
33
  requirement: !ruby/object:Gem::Requirement