cf-uaac 3.0.0 → 3.1.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 +4 -4
- data/Gemfile +4 -3
- data/NOTICE.TXT +6 -6
- data/Rakefile +4 -3
- data/bin/completion-helper +13 -0
- data/bin/uaac +14 -1
- data/bin/uaac-completion.sh +14 -0
- data/bin/uaas +13 -0
- data/cf-uaac.gemspec +4 -4
- data/lib/cli/base.rb +2 -2
- data/lib/cli/client_reg.rb +2 -2
- data/lib/cli/common.rb +11 -5
- data/lib/cli/config.rb +2 -2
- data/lib/cli/curl.rb +13 -0
- data/lib/cli/group.rb +63 -2
- data/lib/cli/info.rb +2 -2
- data/lib/cli/runner.rb +2 -2
- data/lib/cli/token.rb +2 -2
- data/lib/cli/user.rb +2 -2
- data/lib/cli/version.rb +3 -3
- data/lib/stub/scim.rb +27 -3
- data/lib/stub/server.rb +2 -2
- data/lib/stub/uaa.rb +40 -2
- data/lib/{cli.rb → uaac_cli.rb} +2 -2
- data/spec/client_reg_spec.rb +3 -3
- data/spec/common_spec.rb +3 -3
- data/spec/curl_spec.rb +3 -3
- data/spec/group_spec.rb +102 -4
- data/spec/http_spec.rb +2 -2
- data/spec/info_spec.rb +3 -3
- data/spec/setup_helper.rb +3 -3
- data/spec/spec_helper.rb +2 -2
- data/spec/ssl_integration_spec.rb +3 -1
- data/spec/token_spec.rb +3 -3
- data/spec/user_spec.rb +41 -3
- metadata +5 -5
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f975b934d93193d3d23935f98683510bff81a468
|
|
4
|
+
data.tar.gz: 7b1b63c9a22b67fed10faa292668623ef960dcae
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4b2d1575c80cfb76cf72d151fc0765a327bbae04c4e617fe434732873b74055b285df2810aa9150df636e30a333aa29a0adf8edf17d2ced159793a2c62a27492
|
|
7
|
+
data.tar.gz: 0f4901450bff3c9b06d6e559376aa0dd8aeb54b8819f81670edbfa71aa4cb29d5e308d806dbfea0c3d0c392f6a039f69fa91b26f35ab4554d2cfb3be1cbc345e
|
data/Gemfile
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
#
|
|
1
|
+
#--
|
|
2
|
+
# Cloud Foundry
|
|
3
|
+
# Copyright (c) [2009-2014] Pivotal Software, Inc. All Rights Reserved.
|
|
3
4
|
#
|
|
4
5
|
# This product is licensed to you under the Apache License, Version 2.0 (the "License").
|
|
5
6
|
# You may not use this product except in compliance with the License.
|
|
@@ -8,7 +9,7 @@
|
|
|
8
9
|
# separate copyright notices and license terms. Your use of these
|
|
9
10
|
# subcomponents is subject to the terms and conditions of the
|
|
10
11
|
# subcomponent's license, as noted in the LICENSE file.
|
|
11
|
-
|
|
12
|
+
#++
|
|
12
13
|
|
|
13
14
|
source "http://rubygems.org"
|
|
14
15
|
|
data/NOTICE.TXT
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
Cloud Foundry
|
|
2
|
-
Copyright (c) [2009-
|
|
1
|
+
Cloud Foundry
|
|
2
|
+
Copyright (c) [2009-2014] Pivotal Software, Inc. All Rights Reserved.
|
|
3
3
|
|
|
4
|
-
This product is licensed to you under the Apache License, Version 2.0 (the "License").
|
|
5
|
-
You may not use this product except in compliance with the License.
|
|
4
|
+
This product is licensed to you under the Apache License, Version 2.0 (the "License").
|
|
5
|
+
You may not use this product except in compliance with the License.
|
|
6
6
|
|
|
7
7
|
This product includes a number of subcomponents with
|
|
8
8
|
separate copyright notices and license terms. Your use of these
|
|
9
|
-
subcomponents is subject to the terms and conditions of the
|
|
10
|
-
subcomponent's license, as noted in the LICENSE file.
|
|
9
|
+
subcomponents is subject to the terms and conditions of the
|
|
10
|
+
subcomponent's license, as noted in the LICENSE file.
|
data/Rakefile
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
#
|
|
1
|
+
#--
|
|
2
|
+
# Cloud Foundry
|
|
3
|
+
# Copyright (c) [2009-2014] Pivotal Software, Inc. All Rights Reserved.
|
|
3
4
|
#
|
|
4
5
|
# This product is licensed to you under the Apache License, Version 2.0 (the "License").
|
|
5
6
|
# You may not use this product except in compliance with the License.
|
|
@@ -8,7 +9,7 @@
|
|
|
8
9
|
# separate copyright notices and license terms. Your use of these
|
|
9
10
|
# subcomponents is subject to the terms and conditions of the
|
|
10
11
|
# subcomponent's license, as noted in the LICENSE file.
|
|
11
|
-
|
|
12
|
+
#++
|
|
12
13
|
|
|
13
14
|
require "rspec/core/rake_task"
|
|
14
15
|
require "bundler/gem_tasks" # only available in bundler >= 1.0.15
|
data/bin/completion-helper
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
#!/usr/bin/env ruby
|
|
2
2
|
|
|
3
|
+
#--
|
|
4
|
+
# Cloud Foundry
|
|
5
|
+
# Copyright (c) [2009-2014] Pivotal Software, Inc. All Rights Reserved.
|
|
6
|
+
#
|
|
7
|
+
# This product is licensed to you under the Apache License, Version 2.0 (the "License").
|
|
8
|
+
# You may not use this product except in compliance with the License.
|
|
9
|
+
#
|
|
10
|
+
# This product includes a number of subcomponents with
|
|
11
|
+
# separate copyright notices and license terms. Your use of these
|
|
12
|
+
# subcomponents is subject to the terms and conditions of the
|
|
13
|
+
# subcomponent's license, as noted in the LICENSE file.
|
|
14
|
+
#++
|
|
15
|
+
|
|
3
16
|
# given the indents, find sub-commands of a given command
|
|
4
17
|
def find_sub_commands (lines, indents, i)
|
|
5
18
|
result = Array.new
|
data/bin/uaac
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
#!/usr/bin/env ruby
|
|
2
2
|
|
|
3
|
+
#--
|
|
4
|
+
# Cloud Foundry
|
|
5
|
+
# Copyright (c) [2009-2014] Pivotal Software, Inc. All Rights Reserved.
|
|
6
|
+
#
|
|
7
|
+
# This product is licensed to you under the Apache License, Version 2.0 (the "License").
|
|
8
|
+
# You may not use this product except in compliance with the License.
|
|
9
|
+
#
|
|
10
|
+
# This product includes a number of subcomponents with
|
|
11
|
+
# separate copyright notices and license terms. Your use of these
|
|
12
|
+
# subcomponents is subject to the terms and conditions of the
|
|
13
|
+
# subcomponent's license, as noted in the LICENSE file.
|
|
14
|
+
#++
|
|
15
|
+
|
|
3
16
|
$:.unshift File.expand_path File.join __FILE__, '..', '..', 'lib'
|
|
4
|
-
require '
|
|
17
|
+
require 'uaac_cli'
|
|
5
18
|
exit CF::UAA::Cli.configure("#{ENV['HOME']}/.uaac.yml").run ? 0 : 1
|
data/bin/uaac-completion.sh
CHANGED
|
@@ -1,4 +1,18 @@
|
|
|
1
1
|
#! /bin/bash
|
|
2
|
+
|
|
3
|
+
#--
|
|
4
|
+
# Cloud Foundry
|
|
5
|
+
# Copyright (c) [2009-2014] Pivotal Software, Inc. All Rights Reserved.
|
|
6
|
+
#
|
|
7
|
+
# This product is licensed to you under the Apache License, Version 2.0 (the "License").
|
|
8
|
+
# You may not use this product except in compliance with the License.
|
|
9
|
+
#
|
|
10
|
+
# This product includes a number of subcomponents with
|
|
11
|
+
# separate copyright notices and license terms. Your use of these
|
|
12
|
+
# subcomponents is subject to the terms and conditions of the
|
|
13
|
+
# subcomponent's license, as noted in the LICENSE file.
|
|
14
|
+
#++
|
|
15
|
+
|
|
2
16
|
GLOBAL_OPTS="--help --no-help -h --version --no-version -v --debug --no-debug -d --trace --no-trace -t --config"
|
|
3
17
|
|
|
4
18
|
_debug() {
|
data/bin/uaas
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
#!/usr/bin/env ruby
|
|
2
2
|
|
|
3
|
+
#--
|
|
4
|
+
# Cloud Foundry
|
|
5
|
+
# Copyright (c) [2009-2014] Pivotal Software, Inc. All Rights Reserved.
|
|
6
|
+
#
|
|
7
|
+
# This product is licensed to you under the Apache License, Version 2.0 (the "License").
|
|
8
|
+
# You may not use this product except in compliance with the License.
|
|
9
|
+
#
|
|
10
|
+
# This product includes a number of subcomponents with
|
|
11
|
+
# separate copyright notices and license terms. Your use of these
|
|
12
|
+
# subcomponents is subject to the terms and conditions of the
|
|
13
|
+
# subcomponent's license, as noted in the LICENSE file.
|
|
14
|
+
#++
|
|
15
|
+
|
|
3
16
|
$:.unshift File.expand_path File.join __FILE__, '..', '..', 'lib'
|
|
4
17
|
require 'stub/uaa'
|
|
5
18
|
require 'cli/base'
|
data/cf-uaac.gemspec
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
|
2
2
|
#
|
|
3
|
-
# Cloud Foundry
|
|
4
|
-
# Copyright (c) [2009-
|
|
3
|
+
# Cloud Foundry
|
|
4
|
+
# Copyright (c) [2009-2014] Pivotal Software, Inc. All Rights Reserved.
|
|
5
5
|
#
|
|
6
6
|
# This product is licensed to you under the Apache License, Version 2.0 (the "License").
|
|
7
7
|
# You may not use this product except in compliance with the License.
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
# separate copyright notices and license terms. Your use of these
|
|
11
11
|
# subcomponents is subject to the terms and conditions of the
|
|
12
12
|
# subcomponent's license, as noted in the LICENSE file.
|
|
13
|
-
|
|
13
|
+
#++
|
|
14
14
|
|
|
15
15
|
$:.push File.expand_path("../lib", __FILE__)
|
|
16
16
|
require "cli/version"
|
|
@@ -39,7 +39,7 @@ Gem::Specification.new do |s|
|
|
|
39
39
|
s.add_development_dependency "simplecov", "~> 0.8.2"
|
|
40
40
|
s.add_development_dependency "simplecov-rcov", "~> 0.2.3"
|
|
41
41
|
s.add_development_dependency "ci_reporter", "~> 1.9.2"
|
|
42
|
-
s.add_runtime_dependency "cf-uaa-lib", "~> 3.
|
|
42
|
+
s.add_runtime_dependency "cf-uaa-lib", "~> 3.1.0"
|
|
43
43
|
s.add_runtime_dependency "highline", "~> 1.6.21"
|
|
44
44
|
s.add_runtime_dependency "eventmachine", "~> 1.0.3"
|
|
45
45
|
s.add_runtime_dependency "launchy", "~> 2.4.2"
|
data/lib/cli/base.rb
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#--
|
|
2
|
-
# Cloud Foundry
|
|
3
|
-
# Copyright (c) [2009-
|
|
2
|
+
# Cloud Foundry
|
|
3
|
+
# Copyright (c) [2009-2014] Pivotal Software, Inc. All Rights Reserved.
|
|
4
4
|
#
|
|
5
5
|
# This product is licensed to you under the Apache License, Version 2.0 (the "License").
|
|
6
6
|
# You may not use this product except in compliance with the License.
|
data/lib/cli/client_reg.rb
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#--
|
|
2
|
-
# Cloud Foundry
|
|
3
|
-
# Copyright (c) [2009-
|
|
2
|
+
# Cloud Foundry
|
|
3
|
+
# Copyright (c) [2009-2014] Pivotal Software, Inc. All Rights Reserved.
|
|
4
4
|
#
|
|
5
5
|
# This product is licensed to you under the Apache License, Version 2.0 (the "License").
|
|
6
6
|
# You may not use this product except in compliance with the License.
|
data/lib/cli/common.rb
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#--
|
|
2
|
-
# Cloud Foundry
|
|
3
|
-
# Copyright (c) [2009-
|
|
2
|
+
# Cloud Foundry
|
|
3
|
+
# Copyright (c) [2009-2014] Pivotal Software, Inc. All Rights Reserved.
|
|
4
4
|
#
|
|
5
5
|
# This product is licensed to you under the Apache License, Version 2.0 (the "License").
|
|
6
6
|
# You may not use this product except in compliance with the License.
|
|
@@ -83,9 +83,15 @@ class CommonCli < Topic
|
|
|
83
83
|
def scim_common_list(type, filter)
|
|
84
84
|
pp scim_request { |sr|
|
|
85
85
|
query = { attributes: opts[:attrs], filter: filter }
|
|
86
|
-
info =
|
|
87
|
-
|
|
88
|
-
sr.
|
|
86
|
+
info = nil
|
|
87
|
+
if type == :user
|
|
88
|
+
info = sr.query(type, query.merge!(startIndex: opts[:start], count: opts[:count]))
|
|
89
|
+
else
|
|
90
|
+
info = opts[:start] || opts[:count] ?
|
|
91
|
+
sr.query(type, query.merge!(startIndex: opts[:start], count: opts[:count])):
|
|
92
|
+
sr.all_pages(type, query)
|
|
93
|
+
end
|
|
94
|
+
|
|
89
95
|
nattr = sr.name_attr(type).downcase
|
|
90
96
|
info.is_a?(Array) && info.length > 0 && info[0][nattr] ?
|
|
91
97
|
info.each_with_object({}) { |v, h| h[v.delete(nattr)] = v } : info
|
data/lib/cli/config.rb
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#--
|
|
2
|
-
# Cloud Foundry
|
|
3
|
-
# Copyright (c) [2009-
|
|
2
|
+
# Cloud Foundry
|
|
3
|
+
# Copyright (c) [2009-2014] Pivotal Software, Inc. All Rights Reserved.
|
|
4
4
|
#
|
|
5
5
|
# This product is licensed to you under the Apache License, Version 2.0 (the "License").
|
|
6
6
|
# You may not use this product except in compliance with the License.
|
data/lib/cli/curl.rb
CHANGED
|
@@ -1,3 +1,16 @@
|
|
|
1
|
+
#--
|
|
2
|
+
# Cloud Foundry
|
|
3
|
+
# Copyright (c) [2009-2014] Pivotal Software, Inc. All Rights Reserved.
|
|
4
|
+
#
|
|
5
|
+
# This product is licensed to you under the Apache License, Version 2.0 (the "License").
|
|
6
|
+
# You may not use this product except in compliance with the License.
|
|
7
|
+
#
|
|
8
|
+
# This product includes a number of subcomponents with
|
|
9
|
+
# separate copyright notices and license terms. Your use of these
|
|
10
|
+
# subcomponents is subject to the terms and conditions of the
|
|
11
|
+
# subcomponent's license, as noted in the LICENSE file.
|
|
12
|
+
#++
|
|
13
|
+
|
|
1
14
|
require 'cli/common'
|
|
2
15
|
require 'rack'
|
|
3
16
|
require 'net/http'
|
data/lib/cli/group.rb
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#--
|
|
2
|
-
# Cloud Foundry
|
|
3
|
-
# Copyright (c) [2009-
|
|
2
|
+
# Cloud Foundry
|
|
3
|
+
# Copyright (c) [2009-2014] Pivotal Software, Inc. All Rights Reserved.
|
|
4
4
|
#
|
|
5
5
|
# This product is licensed to you under the Apache License, Version 2.0 (the "License").
|
|
6
6
|
# You may not use this product except in compliance with the License.
|
|
@@ -42,6 +42,57 @@ class GroupCli < CommonCli
|
|
|
42
42
|
}
|
|
43
43
|
end
|
|
44
44
|
|
|
45
|
+
define_option :start, "--start <start>", "show results starting at this index"
|
|
46
|
+
define_option :count, "--count <count>", "number of results to show"
|
|
47
|
+
desc "group mappings", "List all the mappings between uaa scopes and external groups", :start, :count do
|
|
48
|
+
start, count = opts[:start], opts[:count]
|
|
49
|
+
return gripe "Please enter a valid start index" if start unless is_integer?(start)
|
|
50
|
+
return gripe "Please enter a valid count" if count unless is_natural_number?(count)
|
|
51
|
+
|
|
52
|
+
response = scim_request { |scim| scim.list_group_mappings(start, count) }
|
|
53
|
+
|
|
54
|
+
if response
|
|
55
|
+
grouped_group_mappings = []
|
|
56
|
+
response["resources"].each do |resource|
|
|
57
|
+
grouped_group_mappings << {resource['displayname'] => resource['externalgroup']}
|
|
58
|
+
end
|
|
59
|
+
response["resources"] = grouped_group_mappings
|
|
60
|
+
pp response
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
define_option :id, "--id <id>", "map uaa group using group id"
|
|
65
|
+
define_option :name, "--name <name>", "map uaa scope using group name"
|
|
66
|
+
desc "group map [external_group]", "Map uaa groups to external groups", :id, :name do |external_group|
|
|
67
|
+
return gripe "Please provide a group name or id" unless opts[:id] || opts[:name]
|
|
68
|
+
return gripe "Please provide an external group" unless external_group
|
|
69
|
+
|
|
70
|
+
group = opts[:id] ? opts[:id] : opts[:name]
|
|
71
|
+
is_id = opts[:id] ? true : false
|
|
72
|
+
pp scim_request { |ua|
|
|
73
|
+
response = ua.map_group(group, is_id, external_group)
|
|
74
|
+
raise BadResponse, "no group id found in response of external group mapping" unless response["groupid"]
|
|
75
|
+
"Successfully mapped #{response["displayname"]} to #{external_group}"
|
|
76
|
+
}
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
desc "group unmap [group_name] [external_group]", "Unmaps an external group from a uaa group" do |group_name, external_group|
|
|
80
|
+
return gripe "Please provide a group name and external group" unless group_name && external_group
|
|
81
|
+
|
|
82
|
+
group_id = nil
|
|
83
|
+
response = Cli.run("group get #{group_name}")
|
|
84
|
+
if response
|
|
85
|
+
group_id = response['id']
|
|
86
|
+
else
|
|
87
|
+
return gripe "Group #{group_name} not found"
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
pp scim_request { |ua|
|
|
91
|
+
ua.unmap_group(group_id, external_group)
|
|
92
|
+
"Successfully unmapped #{external_group} from #{group_name}"
|
|
93
|
+
}
|
|
94
|
+
end
|
|
95
|
+
|
|
45
96
|
def id_set(objs)
|
|
46
97
|
objs.each_with_object(Set.new) {|o, s|
|
|
47
98
|
id = o.is_a?(String)? o: (o["id"] || o["value"] || o["memberid"])
|
|
@@ -92,6 +143,16 @@ class GroupCli < CommonCli
|
|
|
92
143
|
pp scim_request { |scim| update_members(scim, name, "writers", users, false) }
|
|
93
144
|
end
|
|
94
145
|
|
|
146
|
+
private
|
|
147
|
+
|
|
148
|
+
def is_natural_number?(input)
|
|
149
|
+
is_integer?(input) && input.to_i > -1
|
|
150
|
+
end
|
|
151
|
+
|
|
152
|
+
def is_integer?(input)
|
|
153
|
+
input && (input.to_i.to_s == input)
|
|
154
|
+
end
|
|
95
155
|
end
|
|
96
156
|
|
|
97
157
|
end
|
|
158
|
+
|
data/lib/cli/info.rb
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#--
|
|
2
|
-
# Cloud Foundry
|
|
3
|
-
# Copyright (c) [2009-
|
|
2
|
+
# Cloud Foundry
|
|
3
|
+
# Copyright (c) [2009-2014] Pivotal Software, Inc. All Rights Reserved.
|
|
4
4
|
#
|
|
5
5
|
# This product is licensed to you under the Apache License, Version 2.0 (the "License").
|
|
6
6
|
# You may not use this product except in compliance with the License.
|
data/lib/cli/runner.rb
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#--
|
|
2
|
-
# Cloud Foundry
|
|
3
|
-
# Copyright (c) [2009-
|
|
2
|
+
# Cloud Foundry
|
|
3
|
+
# Copyright (c) [2009-2014] Pivotal Software, Inc. All Rights Reserved.
|
|
4
4
|
#
|
|
5
5
|
# This product is licensed to you under the Apache License, Version 2.0 (the "License").
|
|
6
6
|
# You may not use this product except in compliance with the License.
|
data/lib/cli/token.rb
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#--
|
|
2
|
-
# Cloud Foundry
|
|
3
|
-
# Copyright (c) [2009-
|
|
2
|
+
# Cloud Foundry
|
|
3
|
+
# Copyright (c) [2009-2014] Pivotal Software, Inc. All Rights Reserved.
|
|
4
4
|
#
|
|
5
5
|
# This product is licensed to you under the Apache License, Version 2.0 (the "License").
|
|
6
6
|
# You may not use this product except in compliance with the License.
|
data/lib/cli/user.rb
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#--
|
|
2
|
-
# Cloud Foundry
|
|
3
|
-
# Copyright (c) [2009-
|
|
2
|
+
# Cloud Foundry
|
|
3
|
+
# Copyright (c) [2009-2014] Pivotal Software, Inc. All Rights Reserved.
|
|
4
4
|
#
|
|
5
5
|
# This product is licensed to you under the Apache License, Version 2.0 (the "License").
|
|
6
6
|
# You may not use this product except in compliance with the License.
|
data/lib/cli/version.rb
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#--
|
|
2
|
-
# Cloud Foundry
|
|
3
|
-
# Copyright (c) [2009-
|
|
2
|
+
# Cloud Foundry
|
|
3
|
+
# Copyright (c) [2009-2014] Pivotal Software, Inc. All Rights Reserved.
|
|
4
4
|
#
|
|
5
5
|
# This product is licensed to you under the Apache License, Version 2.0 (the "License").
|
|
6
6
|
# You may not use this product except in compliance with the License.
|
|
@@ -14,6 +14,6 @@
|
|
|
14
14
|
# Cloud Foundry namespace
|
|
15
15
|
module CF
|
|
16
16
|
module UAA
|
|
17
|
-
CLI_VERSION = "3.
|
|
17
|
+
CLI_VERSION = "3.1.0"
|
|
18
18
|
end
|
|
19
19
|
end
|
data/lib/stub/scim.rb
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#--
|
|
2
|
-
# Cloud Foundry
|
|
3
|
-
# Copyright (c) [2009-
|
|
2
|
+
# Cloud Foundry
|
|
3
|
+
# Copyright (c) [2009-2014] Pivotal Software, Inc. All Rights Reserved.
|
|
4
4
|
#
|
|
5
5
|
# This product is licensed to you under the Apache License, Version 2.0 (the "License").
|
|
6
6
|
# You may not use this product except in compliance with the License.
|
|
@@ -61,7 +61,7 @@ class StubScim
|
|
|
61
61
|
:authorized_grant_types, :scope, :autoapprove,
|
|
62
62
|
:access_token_validity, :refresh_token_validity, :redirect_uri,
|
|
63
63
|
:'signup_redirect_url'].to_set,
|
|
64
|
-
group: [*COMMON_ATTRS, :displayname, :members, :writers, :readers].to_set }
|
|
64
|
+
group: [*COMMON_ATTRS, :displayname, :members, :writers, :readers, :external_groups].to_set }
|
|
65
65
|
VISIBLE_ATTRS = {user: Set.new(LEGAL_ATTRS[:user] - HIDDEN_ATTRS),
|
|
66
66
|
client: Set.new(LEGAL_ATTRS[:client] - HIDDEN_ATTRS),
|
|
67
67
|
group: Set.new(LEGAL_ATTRS[:group] - HIDDEN_ATTRS)}
|
|
@@ -279,6 +279,30 @@ class StubScim
|
|
|
279
279
|
[objs, total]
|
|
280
280
|
end
|
|
281
281
|
|
|
282
|
+
def add_group_mapping(external_group, group_id, group_name)
|
|
283
|
+
group = group_id ? ref_by_id(group_id, :group) : ref_by_name(group_name, :group)
|
|
284
|
+
return unless group
|
|
285
|
+
(group[:external_groups] ||= Set.new) << external_group
|
|
286
|
+
group
|
|
287
|
+
end
|
|
288
|
+
|
|
289
|
+
def delete_group_mapping(group_id, external_group)
|
|
290
|
+
raise NotFound unless group = ref_by_id(group_id, :group)
|
|
291
|
+
raise NotFound unless group[:external_groups] && group[:external_groups].include?(external_group)
|
|
292
|
+
group[:external_groups].delete(external_group)
|
|
293
|
+
end
|
|
294
|
+
|
|
295
|
+
def get_group_mappings
|
|
296
|
+
group_mappings = []
|
|
297
|
+
@things_by_id.each do |id, thing|
|
|
298
|
+
if thing[:rtype] == :group
|
|
299
|
+
thing[:external_groups].each do |external_group|
|
|
300
|
+
group_mappings << { groupid: thing[:id], displayname: thing[:displayname], externalgroup: external_group }
|
|
301
|
+
end if thing[:external_groups]
|
|
302
|
+
end
|
|
303
|
+
end unless @things_by_id.empty?
|
|
304
|
+
group_mappings
|
|
305
|
+
end
|
|
282
306
|
end
|
|
283
307
|
|
|
284
308
|
class ScimFilter
|
data/lib/stub/server.rb
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#--
|
|
2
|
-
# Cloud Foundry
|
|
3
|
-
# Copyright (c) [2009-
|
|
2
|
+
# Cloud Foundry
|
|
3
|
+
# Copyright (c) [2009-2014] Pivotal Software, Inc. All Rights Reserved.
|
|
4
4
|
#
|
|
5
5
|
# This product is licensed to you under the Apache License, Version 2.0 (the "License").
|
|
6
6
|
# You may not use this product except in compliance with the License.
|
data/lib/stub/uaa.rb
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#--
|
|
2
|
-
# Cloud Foundry
|
|
3
|
-
# Copyright (c) [2009-
|
|
2
|
+
# Cloud Foundry
|
|
3
|
+
# Copyright (c) [2009-2014] Pivotal Software, Inc. All Rights Reserved.
|
|
4
4
|
#
|
|
5
5
|
# This product is licensed to you under the Apache License, Version 2.0 (the "License").
|
|
6
6
|
# You may not use this product except in compliance with the License.
|
|
@@ -424,6 +424,44 @@ class StubUAAConn < Stub::Base
|
|
|
424
424
|
end
|
|
425
425
|
end
|
|
426
426
|
|
|
427
|
+
route :post, %r{^/Groups/External$}, "content-type" => %r{application/json} do
|
|
428
|
+
json = Util.json_parse(request.body, :down)
|
|
429
|
+
external_group = json["externalgroup"]
|
|
430
|
+
group_name = json["displayname"]
|
|
431
|
+
group_id = json["groupid"]
|
|
432
|
+
group = server.scim.add_group_mapping(external_group, group_id, group_name)
|
|
433
|
+
reply_in_kind(displayName: group[:displayname], externalGroup: external_group, groupId: group[:id])
|
|
434
|
+
end
|
|
435
|
+
|
|
436
|
+
route :get, %r{^/Groups/External/list(\?|$)(.*)} do
|
|
437
|
+
return unless valid_token("scim.read")
|
|
438
|
+
|
|
439
|
+
query_params = CGI::parse(match[2])
|
|
440
|
+
|
|
441
|
+
start_index_param = query_params["startIndex"].first
|
|
442
|
+
start_index = start_index_param.empty? ? 1 : start_index_param.to_i
|
|
443
|
+
|
|
444
|
+
count_param = query_params["count"].first
|
|
445
|
+
count = count_param.empty? ? 100 : count_param.to_i
|
|
446
|
+
|
|
447
|
+
group_mappings = server.scim.get_group_mappings
|
|
448
|
+
paginated_group_mappings = group_mappings.slice([start_index,1].max - 1, count)
|
|
449
|
+
|
|
450
|
+
reply_in_kind(resources: paginated_group_mappings, itemsPerPage: count, startIndex: start_index, totalResults: group_mappings.length)
|
|
451
|
+
end
|
|
452
|
+
|
|
453
|
+
route :delete, %r{^/Groups/External/id/([^/]+)/([^/]+)$} do
|
|
454
|
+
return unless valid_token("scim.write")
|
|
455
|
+
|
|
456
|
+
group_id = match[1]
|
|
457
|
+
external_group = match[2]
|
|
458
|
+
begin
|
|
459
|
+
server.scim.delete_group_mapping(group_id, external_group)
|
|
460
|
+
rescue NotFound
|
|
461
|
+
not_found("Mapping for group ID #{match[1]} and external group #{match[2]}")
|
|
462
|
+
end
|
|
463
|
+
end
|
|
464
|
+
|
|
427
465
|
def sanitize_int(arg, default, min, max = nil)
|
|
428
466
|
return default if arg.nil?
|
|
429
467
|
return unless arg.to_i.to_s == arg && (i = arg.to_i) >= min
|
data/lib/{cli.rb → uaac_cli.rb}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#--
|
|
2
|
-
# Cloud Foundry
|
|
3
|
-
# Copyright (c) [2009-
|
|
2
|
+
# Cloud Foundry
|
|
3
|
+
# Copyright (c) [2009-2014] Pivotal Software, Inc. All Rights Reserved.
|
|
4
4
|
#
|
|
5
5
|
# This product is licensed to you under the Apache License, Version 2.0 (the "License").
|
|
6
6
|
# You may not use this product except in compliance with the License.
|
data/spec/client_reg_spec.rb
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#--
|
|
2
|
-
# Cloud Foundry
|
|
3
|
-
# Copyright (c) [2009-
|
|
2
|
+
# Cloud Foundry
|
|
3
|
+
# Copyright (c) [2009-2014] Pivotal Software, Inc. All Rights Reserved.
|
|
4
4
|
#
|
|
5
5
|
# This product is licensed to you under the Apache License, Version 2.0 (the "License").
|
|
6
6
|
# You may not use this product except in compliance with the License.
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
#++
|
|
13
13
|
|
|
14
14
|
require 'spec_helper'
|
|
15
|
-
require '
|
|
15
|
+
require 'uaac_cli'
|
|
16
16
|
|
|
17
17
|
module CF::UAA
|
|
18
18
|
|
data/spec/common_spec.rb
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#--
|
|
2
|
-
# Cloud Foundry
|
|
3
|
-
# Copyright (c) [2009-
|
|
2
|
+
# Cloud Foundry
|
|
3
|
+
# Copyright (c) [2009-2014] Pivotal Software, Inc. All Rights Reserved.
|
|
4
4
|
#
|
|
5
5
|
# This product is licensed to you under the Apache License, Version 2.0 (the "License").
|
|
6
6
|
# You may not use this product except in compliance with the License.
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
|
|
14
14
|
require 'spec_helper'
|
|
15
15
|
require 'stringio'
|
|
16
|
-
require '
|
|
16
|
+
require 'uaac_cli'
|
|
17
17
|
|
|
18
18
|
module CF::UAA
|
|
19
19
|
|
data/spec/curl_spec.rb
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#--
|
|
2
|
-
# Cloud Foundry
|
|
3
|
-
# Copyright (c) [2009-
|
|
2
|
+
# Cloud Foundry
|
|
3
|
+
# Copyright (c) [2009-2014] Pivotal Software, Inc. All Rights Reserved.
|
|
4
4
|
#
|
|
5
5
|
# This product is licensed to you under the Apache License, Version 2.0 (the "License").
|
|
6
6
|
# You may not use this product except in compliance with the License.
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
#++
|
|
13
13
|
|
|
14
14
|
require 'spec_helper'
|
|
15
|
-
require '
|
|
15
|
+
require 'uaac_cli'
|
|
16
16
|
|
|
17
17
|
module CF::UAA
|
|
18
18
|
describe CurlCli do
|
data/spec/group_spec.rb
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#--
|
|
2
|
-
# Cloud Foundry
|
|
3
|
-
# Copyright (c) [2009-
|
|
2
|
+
# Cloud Foundry
|
|
3
|
+
# Copyright (c) [2009-2014] Pivotal Software, Inc. All Rights Reserved.
|
|
4
4
|
#
|
|
5
5
|
# This product is licensed to you under the Apache License, Version 2.0 (the "License").
|
|
6
6
|
# You may not use this product except in compliance with the License.
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
#++
|
|
13
13
|
|
|
14
14
|
require 'spec_helper'
|
|
15
|
-
require '
|
|
15
|
+
require 'uaac_cli'
|
|
16
16
|
|
|
17
17
|
module CF::UAA
|
|
18
18
|
|
|
@@ -114,7 +114,6 @@ describe GroupCli do
|
|
|
114
114
|
it "gets readers and writers in the group" do
|
|
115
115
|
Cli.run("group get #{@test_group}").should be
|
|
116
116
|
Cli.output.string.should be
|
|
117
|
-
#puts Cli.output.string
|
|
118
117
|
end
|
|
119
118
|
|
|
120
119
|
it "reads members as a reader" do
|
|
@@ -163,6 +162,105 @@ describe GroupCli do
|
|
|
163
162
|
Cli.output.string.should_not match /members/i # they should really be gone
|
|
164
163
|
end
|
|
165
164
|
|
|
165
|
+
it "does not blow up if scope is invalid" do
|
|
166
|
+
Cli.run("token owner get #{@test_client} -s #{@test_secret} #{@test_user}m -p #{@test_pwd}").should be
|
|
167
|
+
Cli.run "group map ldap-id --name #{@test_group}"
|
|
168
|
+
Cli.run "group mappings"
|
|
169
|
+
Cli.output.string.should_not include "NoMethodError"
|
|
170
|
+
end
|
|
171
|
+
|
|
172
|
+
it "lists all the mappings between uaa scopes and external groups" do
|
|
173
|
+
Cli.run "context #{@test_client}"
|
|
174
|
+
Cli.run "group map ldap-id --name #{@test_group}"
|
|
175
|
+
Cli.output.string.should include "Successfully mapped #{@test_group} to ldap-id"
|
|
176
|
+
|
|
177
|
+
Cli.run "group mappings"
|
|
178
|
+
Cli.output.string.should include("#{@test_group}: ldap-id")
|
|
179
|
+
end
|
|
180
|
+
|
|
181
|
+
it "lists mappings between uaa scopes and external groups with pagination" do
|
|
182
|
+
Cli.run "context #{@test_client}"
|
|
183
|
+
Cli.run("group add new-group")
|
|
184
|
+
|
|
185
|
+
Cli.run "group map ldap-id --name #{@test_group}"
|
|
186
|
+
Cli.run "group map ldap-id-2 --name #{@test_group}"
|
|
187
|
+
Cli.run "group map ldap-id --name new-group"
|
|
188
|
+
Cli.run "group map ldap-id-3 --name #{@test_group}"
|
|
189
|
+
Cli.run "group map ldap-id-3 --name new-group"
|
|
190
|
+
Cli.run "group map ldap-id-4 --name #{@test_group}"
|
|
191
|
+
|
|
192
|
+
Cli.output.string.should include "Successfully mapped #{@test_group} to ldap-id"
|
|
193
|
+
|
|
194
|
+
Cli.run "group mappings"
|
|
195
|
+
Cli.output.string.should include("#{@test_group}: ldap-id", "#{@test_group}: ldap-id-2", "#{@test_group}: ldap-id-3", "#{@test_group}: ldap-id-4")
|
|
196
|
+
|
|
197
|
+
Cli.run "group mappings --start 1 --count 3"
|
|
198
|
+
Cli.output.string.should include("#{@test_group}: ldap-id", "#{@test_group}: ldap-id-2", "#{@test_group}: ldap-id-3")
|
|
199
|
+
Cli.output.string.should_not include("ldap-id-4")
|
|
200
|
+
|
|
201
|
+
Cli.run "group mappings --start 1 --count -3"
|
|
202
|
+
Cli.output.string.should_not include("ldap-id", "ldap-id-2", "ldap-id-3")
|
|
203
|
+
Cli.output.string.should include("Please enter a valid count")
|
|
204
|
+
|
|
205
|
+
Cli.run "group mappings --start 1 --count a"
|
|
206
|
+
Cli.output.string.should_not include("ldap-id", "ldap-id-2", "ldap-id-3")
|
|
207
|
+
Cli.output.string.should include("Please enter a valid count")
|
|
208
|
+
|
|
209
|
+
Cli.run "group mappings --start -1 --count 5"
|
|
210
|
+
Cli.output.string.should include("#{@test_group}: ldap-id", "#{@test_group}: ldap-id-2", "#{@test_group}: ldap-id-3")
|
|
211
|
+
|
|
212
|
+
Cli.run "group mappings --start a --count 1"
|
|
213
|
+
Cli.output.string.should_not include("ldap-id", "ldap-id-2", "ldap-id-3")
|
|
214
|
+
Cli.output.string.should include("Please enter a valid start index")
|
|
215
|
+
|
|
216
|
+
Cli.run "group mappings --start 2"
|
|
217
|
+
Cli.output.string.should include("#{@test_group}: ldap-id-2", "#{@test_group}: ldap-id-3", "#{@test_group}: ldap-id-4")
|
|
218
|
+
|
|
219
|
+
Cli.run "group mappings --count 2"
|
|
220
|
+
Cli.output.string.should include("#{@test_group}: ldap-id", "#{@test_group}: ldap-id-2")
|
|
221
|
+
end
|
|
222
|
+
|
|
223
|
+
it "maps a uaa scope to an external group" do
|
|
224
|
+
Cli.run "context #{@test_client}"
|
|
225
|
+
|
|
226
|
+
Cli.run "group map ldap-id"
|
|
227
|
+
Cli.output.string.should include "Please provide a group name or id"
|
|
228
|
+
|
|
229
|
+
Cli.run "group map --name #{@test_group}"
|
|
230
|
+
Cli.output.string.should include "Please provide an external group"
|
|
231
|
+
|
|
232
|
+
Cli.run "group map ldap-id --name #{@test_group}"
|
|
233
|
+
Cli.output.string.should include "Successfully mapped #{@test_group} to ldap-id"
|
|
234
|
+
|
|
235
|
+
Cli.run("group get #{@test_group}")
|
|
236
|
+
test_group_id = Cli.output.string.match(/id: ([\S]+)/)[1]
|
|
237
|
+
Cli.run "group map ldap-id --id #{test_group_id}"
|
|
238
|
+
Cli.output.string.should include "Successfully mapped #{@test_group} to ldap-id"
|
|
239
|
+
end
|
|
240
|
+
|
|
241
|
+
it "unmaps a uaa scope from an external group" do
|
|
242
|
+
Cli.run "context #{@test_client}"
|
|
243
|
+
|
|
244
|
+
Cli.run "group map ldap-id --name #{@test_group}"
|
|
245
|
+
Cli.output.string.should include "Successfully mapped #{@test_group} to ldap-id"
|
|
246
|
+
|
|
247
|
+
Cli.run("group get #{@test_group}")
|
|
248
|
+
|
|
249
|
+
Cli.run "group unmap"
|
|
250
|
+
Cli.output.string.should include "Please provide a group name and external group"
|
|
251
|
+
|
|
252
|
+
Cli.run "group unmap #{@test_group}"
|
|
253
|
+
Cli.output.string.should include "Please provide a group name and external group"
|
|
254
|
+
|
|
255
|
+
Cli.run "group unmap #{@test_group} ldap-id"
|
|
256
|
+
Cli.output.string.should include "Successfully unmapped ldap-id from #{@test_group}"
|
|
257
|
+
|
|
258
|
+
Cli.run "group unmap nonexistent_group unmapped_ldap-id"
|
|
259
|
+
Cli.output.string.should include "Group nonexistent_group not found"
|
|
260
|
+
|
|
261
|
+
Cli.run "group unmap #{@test_group} unmapped_ldap-id"
|
|
262
|
+
Cli.output.string.should include "NotFound"
|
|
263
|
+
end
|
|
166
264
|
end
|
|
167
265
|
|
|
168
266
|
end
|
data/spec/http_spec.rb
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#--
|
|
2
|
-
# Cloud Foundry
|
|
3
|
-
# Copyright (c) [2009-
|
|
2
|
+
# Cloud Foundry
|
|
3
|
+
# Copyright (c) [2009-2014] Pivotal Software, Inc. All Rights Reserved.
|
|
4
4
|
#
|
|
5
5
|
# This product is licensed to you under the Apache License, Version 2.0 (the "License").
|
|
6
6
|
# You may not use this product except in compliance with the License.
|
data/spec/info_spec.rb
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#--
|
|
2
|
-
# Cloud Foundry
|
|
3
|
-
# Copyright (c) [2009-
|
|
2
|
+
# Cloud Foundry
|
|
3
|
+
# Copyright (c) [2009-2014] Pivotal Software, Inc. All Rights Reserved.
|
|
4
4
|
#
|
|
5
5
|
# This product is licensed to you under the Apache License, Version 2.0 (the "License").
|
|
6
6
|
# You may not use this product except in compliance with the License.
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
#++
|
|
13
13
|
|
|
14
14
|
require 'spec_helper'
|
|
15
|
-
require '
|
|
15
|
+
require 'uaac_cli'
|
|
16
16
|
require 'stub/uaa'
|
|
17
17
|
|
|
18
18
|
module CF::UAA
|
data/spec/setup_helper.rb
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env ruby
|
|
2
2
|
|
|
3
3
|
#--
|
|
4
|
-
# Cloud Foundry
|
|
5
|
-
# Copyright (c) [2009-
|
|
4
|
+
# Cloud Foundry
|
|
5
|
+
# Copyright (c) [2009-2014] Pivotal Software, Inc. All Rights Reserved.
|
|
6
6
|
#
|
|
7
7
|
# This product is licensed to you under the Apache License, Version 2.0 (the "License").
|
|
8
8
|
# You may not use this product except in compliance with the License.
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
#++
|
|
15
15
|
|
|
16
16
|
$:.unshift File.expand_path File.join __FILE__, '..', '..', 'lib'
|
|
17
|
-
require '
|
|
17
|
+
require 'uaac_cli'
|
|
18
18
|
|
|
19
19
|
client = ENV["UAA_CLIENT_ID"] || "admin"
|
|
20
20
|
secret = ENV["UAA_CLIENT_SECRET"] || "adminsecret"
|
data/spec/spec_helper.rb
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#--
|
|
2
|
-
# Cloud Foundry
|
|
3
|
-
# Copyright (c) [2009-
|
|
2
|
+
# Cloud Foundry
|
|
3
|
+
# Copyright (c) [2009-2014] Pivotal Software, Inc. All Rights Reserved.
|
|
4
4
|
#
|
|
5
5
|
# This product is licensed to you under the Apache License, Version 2.0 (the "License").
|
|
6
6
|
# You may not use this product except in compliance with the License.
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
#--
|
|
1
2
|
# Cloud Foundry
|
|
2
3
|
# Copyright (c) [2009-2014] Pivotal Software, Inc. All Rights Reserved.
|
|
3
4
|
#
|
|
@@ -8,11 +9,12 @@
|
|
|
8
9
|
# separate copyright notices and license terms. Your use of these
|
|
9
10
|
# subcomponents is subject to the terms and conditions of the
|
|
10
11
|
# subcomponent's license, as noted in the LICENSE file.
|
|
12
|
+
#++
|
|
11
13
|
|
|
12
14
|
require 'spec_helper'
|
|
13
15
|
require 'fiber'
|
|
14
16
|
require 'em-http'
|
|
15
|
-
require '
|
|
17
|
+
require 'uaac_cli'
|
|
16
18
|
require 'stub/server'
|
|
17
19
|
|
|
18
20
|
module CF::UAA
|
data/spec/token_spec.rb
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#--
|
|
2
|
-
# Cloud Foundry
|
|
3
|
-
# Copyright (c) [2009-
|
|
2
|
+
# Cloud Foundry
|
|
3
|
+
# Copyright (c) [2009-2014] Pivotal Software, Inc. All Rights Reserved.
|
|
4
4
|
#
|
|
5
5
|
# This product is licensed to you under the Apache License, Version 2.0 (the "License").
|
|
6
6
|
# You may not use this product except in compliance with the License.
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
#++
|
|
13
13
|
|
|
14
14
|
require 'spec_helper'
|
|
15
|
-
require '
|
|
15
|
+
require 'uaac_cli'
|
|
16
16
|
|
|
17
17
|
module CF::UAA
|
|
18
18
|
|
data/spec/user_spec.rb
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#--
|
|
2
|
-
# Cloud Foundry
|
|
3
|
-
# Copyright (c) [2009-
|
|
2
|
+
# Cloud Foundry
|
|
3
|
+
# Copyright (c) [2009-2014] Pivotal Software, Inc. All Rights Reserved.
|
|
4
4
|
#
|
|
5
5
|
# This product is licensed to you under the Apache License, Version 2.0 (the "License").
|
|
6
6
|
# You may not use this product except in compliance with the License.
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
#++
|
|
13
13
|
|
|
14
14
|
require 'spec_helper'
|
|
15
|
-
require '
|
|
15
|
+
require 'uaac_cli'
|
|
16
16
|
|
|
17
17
|
module CF::UAA
|
|
18
18
|
|
|
@@ -61,6 +61,44 @@ describe UserCli do
|
|
|
61
61
|
Cli.output.string.should =~ /#{@test_user}/
|
|
62
62
|
end
|
|
63
63
|
|
|
64
|
+
describe "get list of users" do
|
|
65
|
+
before :all do
|
|
66
|
+
i = 1
|
|
67
|
+
count = 15
|
|
68
|
+
while i < count do
|
|
69
|
+
Cli.run("user add user-#{i} -p password-#{i} " +
|
|
70
|
+
"--emails user-#{i}@example.com --given_name user#{i} " +
|
|
71
|
+
"--phones 801-555-243#{i} --family_name jonES")
|
|
72
|
+
i +=1
|
|
73
|
+
end
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
after :all do
|
|
77
|
+
i = 1
|
|
78
|
+
count = 15
|
|
79
|
+
while i < count do
|
|
80
|
+
Cli.run("user delete user-#{i}")
|
|
81
|
+
i +=1
|
|
82
|
+
end
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
it "gets users with default pagination" do
|
|
86
|
+
Cli.run("users")
|
|
87
|
+
Cli.output.string.should include "user-1"
|
|
88
|
+
Cli.output.string.should include "user-2"
|
|
89
|
+
Cli.output.string.should include "user-14"
|
|
90
|
+
# Default page size for stub uaa is 15
|
|
91
|
+
Cli.output.string.should_not include "user-15"
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
it "gets count users with pagination" do
|
|
95
|
+
Cli.run("users --start 1 --count 3")
|
|
96
|
+
Cli.output.string.should include "user-1"
|
|
97
|
+
Cli.output.string.should include "user-2"
|
|
98
|
+
Cli.output.string.should_not include "user-3"
|
|
99
|
+
end
|
|
100
|
+
end
|
|
101
|
+
|
|
64
102
|
end
|
|
65
103
|
|
|
66
104
|
end
|
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: 3.
|
|
4
|
+
version: 3.1.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: 2014-08-
|
|
15
|
+
date: 2014-08-26 00:00:00.000000000 Z
|
|
16
16
|
dependencies:
|
|
17
17
|
- !ruby/object:Gem::Dependency
|
|
18
18
|
name: bundler
|
|
@@ -104,14 +104,14 @@ dependencies:
|
|
|
104
104
|
requirements:
|
|
105
105
|
- - "~>"
|
|
106
106
|
- !ruby/object:Gem::Version
|
|
107
|
-
version: 3.
|
|
107
|
+
version: 3.1.0
|
|
108
108
|
type: :runtime
|
|
109
109
|
prerelease: false
|
|
110
110
|
version_requirements: !ruby/object:Gem::Requirement
|
|
111
111
|
requirements:
|
|
112
112
|
- - "~>"
|
|
113
113
|
- !ruby/object:Gem::Version
|
|
114
|
-
version: 3.
|
|
114
|
+
version: 3.1.0
|
|
115
115
|
- !ruby/object:Gem::Dependency
|
|
116
116
|
name: highline
|
|
117
117
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -229,7 +229,6 @@ files:
|
|
|
229
229
|
- bin/uaac-completion.sh
|
|
230
230
|
- bin/uaas
|
|
231
231
|
- cf-uaac.gemspec
|
|
232
|
-
- lib/cli.rb
|
|
233
232
|
- lib/cli/base.rb
|
|
234
233
|
- lib/cli/client_reg.rb
|
|
235
234
|
- lib/cli/common.rb
|
|
@@ -245,6 +244,7 @@ files:
|
|
|
245
244
|
- lib/stub/scim.rb
|
|
246
245
|
- lib/stub/server.rb
|
|
247
246
|
- lib/stub/uaa.rb
|
|
247
|
+
- lib/uaac_cli.rb
|
|
248
248
|
- spec/client_reg_spec.rb
|
|
249
249
|
- spec/common_spec.rb
|
|
250
250
|
- spec/curl_spec.rb
|