cf-uaac 2.0.1 → 2.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +3 -1
- data/cf-uaac.gemspec +2 -2
- data/lib/cli/client_reg.rb +10 -4
- data/lib/cli/version.rb +1 -1
- data/lib/stub/scim.rb +2 -1
- data/spec/curl_spec.rb +6 -0
- data/spec/group_spec.rb +4 -2
- data/spec/spec_helper.rb +6 -3
- data/spec/token_spec.rb +1 -1
- metadata +22 -22
data/README.md
CHANGED
@@ -1,5 +1,7 @@
|
|
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)
|
4
|
+
|
3
5
|
## Build the gem
|
4
6
|
|
5
7
|
$ bundle install
|
@@ -37,4 +39,4 @@ Run integration tests (on a server running on localhost:8080/uaa):
|
|
37
39
|
$ export UAA_CLIENT_ID="admin"
|
38
40
|
$ export UAA_CLIENT_SECRET="adminsecret"
|
39
41
|
$ export UAA_CLIENT_TARGET="http://localhost:8080/uaa"
|
40
|
-
$ bundle exec
|
42
|
+
$ bundle exec rake test
|
data/cf-uaac.gemspec
CHANGED
@@ -35,15 +35,15 @@ Gem::Specification.new do |s|
|
|
35
35
|
# dependencies
|
36
36
|
s.add_development_dependency "bundler"
|
37
37
|
s.add_development_dependency "rake"
|
38
|
-
s.add_development_dependency "rack"
|
39
38
|
s.add_development_dependency "rspec"
|
40
39
|
s.add_development_dependency "simplecov"
|
41
40
|
s.add_development_dependency "simplecov-rcov"
|
42
|
-
s.add_development_dependency "ci_reporter"
|
41
|
+
s.add_development_dependency "ci_reporter", "~> 1.9.2"
|
43
42
|
s.add_runtime_dependency "cf-uaa-lib", "~> 2.0.0"
|
44
43
|
s.add_runtime_dependency "highline"
|
45
44
|
s.add_runtime_dependency "eventmachine"
|
46
45
|
s.add_runtime_dependency "launchy"
|
47
46
|
s.add_runtime_dependency "em-http-request", ">= 1.0.0.beta.3"
|
48
47
|
s.add_runtime_dependency "json_pure"
|
48
|
+
s.add_runtime_dependency "rack"
|
49
49
|
end
|
data/lib/cli/client_reg.rb
CHANGED
@@ -19,10 +19,16 @@ class ClientCli < CommonCli
|
|
19
19
|
|
20
20
|
topic "Client Application Registrations", "reg"
|
21
21
|
|
22
|
-
CLIENT_SCHEMA = {
|
23
|
-
|
24
|
-
|
25
|
-
|
22
|
+
CLIENT_SCHEMA = {
|
23
|
+
:scope => "list",
|
24
|
+
:authorized_grant_types => "list",
|
25
|
+
:authorities => "list",
|
26
|
+
:access_token_validity => "seconds",
|
27
|
+
:refresh_token_validity => "seconds",
|
28
|
+
:redirect_uri => "list",
|
29
|
+
:autoapprove => "list",
|
30
|
+
:'signup_redirect_url' => "url"
|
31
|
+
}
|
26
32
|
CLIENT_SCHEMA.each { |k, v| define_option(k, "--#{k} <#{v}>") }
|
27
33
|
|
28
34
|
def client_info(defaults)
|
data/lib/cli/version.rb
CHANGED
data/lib/stub/scim.rb
CHANGED
@@ -59,7 +59,8 @@ class StubScim
|
|
59
59
|
:authorizations, :groups].to_set,
|
60
60
|
client: [*COMMON_ATTRS, :client_id, :client_secret, :authorities,
|
61
61
|
:authorized_grant_types, :scope, :autoapprove,
|
62
|
-
:access_token_validity, :refresh_token_validity, :redirect_uri
|
62
|
+
:access_token_validity, :refresh_token_validity, :redirect_uri,
|
63
|
+
:'signup_redirect_url'].to_set,
|
63
64
|
group: [*COMMON_ATTRS, :displayname, :members, :writers, :readers].to_set }
|
64
65
|
VISIBLE_ATTRS = {user: Set.new(LEGAL_ATTRS[:user] - HIDDEN_ATTRS),
|
65
66
|
client: Set.new(LEGAL_ATTRS[:client] - HIDDEN_ATTRS),
|
data/spec/curl_spec.rb
CHANGED
@@ -38,6 +38,8 @@ module CF::UAA
|
|
38
38
|
end
|
39
39
|
|
40
40
|
it "hits the URL on the UAA target" do
|
41
|
+
pending "Test not applicable in integration test runs" if ENV["UAA_CLIENT_TARGET"]
|
42
|
+
|
41
43
|
Cli.run("curl /my-fake-endpoint")
|
42
44
|
|
43
45
|
Cli.output.string.should include "GET #{@target}/my-fake-endpoint"
|
@@ -49,6 +51,8 @@ module CF::UAA
|
|
49
51
|
end
|
50
52
|
|
51
53
|
it "displays the correct response text when we include a body in the request" do
|
54
|
+
pending "Test not applicable in integration test runs" if ENV["UAA_CLIENT_TARGET"]
|
55
|
+
|
52
56
|
Cli.run("curl -X PUT -d '{\"fake\": true}' -H 'Accept: application/json' /another-fake-endpoint")
|
53
57
|
|
54
58
|
Cli.output.string.should include "PUT #{@target}/another-fake-endpoint"
|
@@ -61,6 +65,8 @@ module CF::UAA
|
|
61
65
|
end
|
62
66
|
|
63
67
|
it "uses headers passed from the command line" do
|
68
|
+
pending "Test not applicable in integration test runs" if ENV["UAA_CLIENT_TARGET"]
|
69
|
+
|
64
70
|
Cli.run("curl -H \"X-Something: non-standard header\" -H \"X-Another: something\" /my-fake-endpoint")
|
65
71
|
|
66
72
|
Cli.output.string.should include "GET #{@target}/my-fake-endpoint"
|
data/spec/group_spec.rb
CHANGED
@@ -118,7 +118,8 @@ describe GroupCli do
|
|
118
118
|
end
|
119
119
|
|
120
120
|
it "reads members as a reader" do
|
121
|
-
pending "
|
121
|
+
pending "Test not applicable in integration test runs" if ENV["UAA_CLIENT_TARGET"]
|
122
|
+
|
122
123
|
Cli.run("token owner get #{@test_client} -s #{@test_secret} #{@test_user}r -p #{@test_pwd}").should be
|
123
124
|
Cli.run("group get #{@test_group} -a memBers").should be
|
124
125
|
ids = Cli.output.string.scan(/.*value:\s+([^\s]+)/).flatten
|
@@ -126,13 +127,14 @@ describe GroupCli do
|
|
126
127
|
end
|
127
128
|
|
128
129
|
it "can't write members as a reader" do
|
129
|
-
pending "real uaa can't search for groups by name with scim.me/readers" unless @stub_uaa
|
130
130
|
Cli.run("token owner get #{@test_client} -s #{@test_secret} #{@test_user}r -p #{@test_pwd}").should be
|
131
131
|
Cli.run("member add #{@test_group} #{@test_user}z").should_not be
|
132
132
|
Cli.output.string.should include "access_denied"
|
133
133
|
end
|
134
134
|
|
135
135
|
it "adds a member as a writer" do
|
136
|
+
pending "Test not applicable in integration test runs" if ENV["UAA_CLIENT_TARGET"]
|
137
|
+
|
136
138
|
Cli.run "context #{@test_client}"
|
137
139
|
Cli.run("user add #{@test_user}z -p #{@test_pwd} --email sam@example.com").should be
|
138
140
|
@users << "#{@test_user}z"
|
data/spec/spec_helper.rb
CHANGED
@@ -52,7 +52,8 @@ module SpecHelper
|
|
52
52
|
opts = { authorities: "clients.read,scim.read,scim.write,uaa.resource",
|
53
53
|
grant_types: "client_credentials,password,refresh_token",
|
54
54
|
scope: "openid,password.write,scim.me,scim.read",
|
55
|
-
autoapprove: "openid,password.write,scim.me,scim.read"
|
55
|
+
autoapprove: "openid,password.write,scim.me,scim.read",
|
56
|
+
signup_redirect_url: "home"}.update(opts)
|
56
57
|
@admin_client = ENV["UAA_CLIENT_ID"] || "admin"
|
57
58
|
@admin_secret = ENV["UAA_CLIENT_SECRET"] || "adminsecret"
|
58
59
|
if ENV["UAA_CLIENT_TARGET"]
|
@@ -67,9 +68,11 @@ module SpecHelper
|
|
67
68
|
test_client = "test_client_#{Time.now.to_i}"
|
68
69
|
@test_secret = Shellwords.escape("+=tEsTsEcRet~!@--")
|
69
70
|
Cli.run("client add #{test_client} -s #{@test_secret} " +
|
70
|
-
"--authorities #{opts[:authorities]}
|
71
|
+
"--authorities #{opts[:authorities]} " +
|
72
|
+
"--scope #{opts[:scope]} " +
|
71
73
|
"--authorized_grant_types #{opts[:grant_types]} " +
|
72
|
-
"--autoapprove #{opts[:autoapprove]}"
|
74
|
+
"--autoapprove #{opts[:autoapprove]} " +
|
75
|
+
"--signup_redirect_url #{opts[:signup_redirect_url]}").should be
|
73
76
|
opts.each { |k, a| Util.arglist(a).each {|v| Cli.output.string.should include(v) }}
|
74
77
|
@test_client = test_client
|
75
78
|
end
|
data/spec/token_spec.rb
CHANGED
@@ -44,7 +44,7 @@ describe TokenCli do
|
|
44
44
|
Cli.run("token get #{@test_user} #{@test_pwd}").should be
|
45
45
|
Cli.output.string.should include("Successfully fetched token")
|
46
46
|
Cli.run("context")
|
47
|
-
Cli.output.string.should match /scope
|
47
|
+
Cli.output.string.should match /scope:.+password\.write openid.*$/
|
48
48
|
end
|
49
49
|
|
50
50
|
it "can request a specific scope" do
|
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: 2.0.
|
4
|
+
version: 2.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ authors:
|
|
13
13
|
autorequire:
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
|
-
date: 2014-07-
|
16
|
+
date: 2014-07-25 00:00:00.000000000 Z
|
17
17
|
dependencies:
|
18
18
|
- !ruby/object:Gem::Dependency
|
19
19
|
name: bundler
|
@@ -47,22 +47,6 @@ dependencies:
|
|
47
47
|
- - ! '>='
|
48
48
|
- !ruby/object:Gem::Version
|
49
49
|
version: '0'
|
50
|
-
- !ruby/object:Gem::Dependency
|
51
|
-
name: rack
|
52
|
-
requirement: !ruby/object:Gem::Requirement
|
53
|
-
none: false
|
54
|
-
requirements:
|
55
|
-
- - ! '>='
|
56
|
-
- !ruby/object:Gem::Version
|
57
|
-
version: '0'
|
58
|
-
type: :development
|
59
|
-
prerelease: false
|
60
|
-
version_requirements: !ruby/object:Gem::Requirement
|
61
|
-
none: false
|
62
|
-
requirements:
|
63
|
-
- - ! '>='
|
64
|
-
- !ruby/object:Gem::Version
|
65
|
-
version: '0'
|
66
50
|
- !ruby/object:Gem::Dependency
|
67
51
|
name: rspec
|
68
52
|
requirement: !ruby/object:Gem::Requirement
|
@@ -116,17 +100,17 @@ dependencies:
|
|
116
100
|
requirement: !ruby/object:Gem::Requirement
|
117
101
|
none: false
|
118
102
|
requirements:
|
119
|
-
- -
|
103
|
+
- - ~>
|
120
104
|
- !ruby/object:Gem::Version
|
121
|
-
version:
|
105
|
+
version: 1.9.2
|
122
106
|
type: :development
|
123
107
|
prerelease: false
|
124
108
|
version_requirements: !ruby/object:Gem::Requirement
|
125
109
|
none: false
|
126
110
|
requirements:
|
127
|
-
- -
|
111
|
+
- - ~>
|
128
112
|
- !ruby/object:Gem::Version
|
129
|
-
version:
|
113
|
+
version: 1.9.2
|
130
114
|
- !ruby/object:Gem::Dependency
|
131
115
|
name: cf-uaa-lib
|
132
116
|
requirement: !ruby/object:Gem::Requirement
|
@@ -223,6 +207,22 @@ dependencies:
|
|
223
207
|
- - ! '>='
|
224
208
|
- !ruby/object:Gem::Version
|
225
209
|
version: '0'
|
210
|
+
- !ruby/object:Gem::Dependency
|
211
|
+
name: rack
|
212
|
+
requirement: !ruby/object:Gem::Requirement
|
213
|
+
none: false
|
214
|
+
requirements:
|
215
|
+
- - ! '>='
|
216
|
+
- !ruby/object:Gem::Version
|
217
|
+
version: '0'
|
218
|
+
type: :runtime
|
219
|
+
prerelease: false
|
220
|
+
version_requirements: !ruby/object:Gem::Requirement
|
221
|
+
none: false
|
222
|
+
requirements:
|
223
|
+
- - ! '>='
|
224
|
+
- !ruby/object:Gem::Version
|
225
|
+
version: '0'
|
226
226
|
description: Client command line tools for interacting with the CloudFoundry User
|
227
227
|
Account and Authorization (UAA) server. The UAA is an OAuth2 Authorization Server
|
228
228
|
so it can be used by webapps and command line apps to obtain access tokens to act
|