cf-uaa-lib 3.0.0 → 3.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +4 -3
- data/NOTICE.TXT +6 -6
- data/Rakefile +4 -3
- data/cf-uaa-lib.gemspec +4 -4
- data/lib/uaa/http.rb +2 -2
- data/lib/uaa/info.rb +2 -2
- data/lib/uaa/proxy_options.rb +13 -0
- data/lib/uaa/scim.rb +20 -3
- data/lib/uaa/token_coder.rb +2 -2
- data/lib/uaa/token_issuer.rb +2 -2
- data/lib/uaa/util.rb +2 -2
- data/lib/uaa/version.rb +3 -3
- data/spec/info_spec.rb +2 -2
- data/spec/integration_spec.rb +2 -2
- data/spec/scim_spec.rb +70 -2
- data/spec/spec_helper.rb +2 -2
- data/spec/token_coder_spec.rb +2 -2
- data/spec/token_issuer_spec.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6b4d37f1fd550f4599f73272b8585b71000afb91
|
4
|
+
data.tar.gz: 857e2c137890ee3dc1dd0b699581c1e644935885
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a9ab7f79ec21ae03a11c40731395eaef4ac6239277b54c9270aabad6c44a203350a0337a4d320f4aa5cdf03f0b485ec562a3fe26c9214a02838e25ba3c79300f
|
7
|
+
data.tar.gz: 5c5127f173c8b05d6ec032783b40cb4c69c142e3368f2188375d1aa1448d8f71e4955cbe4eb8f1ee46100285c57e858a6bd042423142b2cfe8d68f99de26dc12
|
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/cf-uaa-lib.gemspec
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
|
-
|
3
|
-
# Cloud Foundry
|
4
|
-
# Copyright (c) [2009-
|
2
|
+
#--
|
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 "uaa/version"
|
data/lib/uaa/http.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/uaa/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/uaa/proxy_options.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
|
module CF::UAA
|
2
15
|
module ProxyOptions
|
3
16
|
def proxy_options_for(uri)
|
data/lib/uaa/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.
|
@@ -70,7 +70,7 @@ class Scim
|
|
70
70
|
# an attempt to hide some scim and uaa oddities
|
71
71
|
def type_info(type, elem)
|
72
72
|
scimfo = {:user => ["/Users", "userName"], :group => ["/Groups", "displayName"],
|
73
|
-
:client => ["/oauth/clients", 'client_id'], :user_id => ["/ids/Users", 'userName']}
|
73
|
+
:client => ["/oauth/clients", 'client_id'], :user_id => ["/ids/Users", 'userName'], :group_mapping => ["/Groups/External", "externalGroup"]}
|
74
74
|
unless elem == :path || elem == :name_attr
|
75
75
|
raise ArgumentError, "scim schema element must be :path or :name_attr"
|
76
76
|
end
|
@@ -307,6 +307,23 @@ class Scim
|
|
307
307
|
'authorization' => @auth_header))
|
308
308
|
end
|
309
309
|
|
310
|
+
def map_group(group, is_id, external_group)
|
311
|
+
key_name = is_id ? :groupId : :displayName
|
312
|
+
request = {key_name => group, :externalGroup => external_group, :schemas => ["urn:scim:schemas:core:1.0"] }
|
313
|
+
result = json_parse_reply(@key_style, *json_post(@target,
|
314
|
+
"#{type_info(:group_mapping, :path)}", request,
|
315
|
+
'authorization' => @auth_header))
|
316
|
+
result
|
317
|
+
end
|
318
|
+
|
319
|
+
def unmap_group(group_id, external_group)
|
320
|
+
http_delete(@target, "#{type_info(:group_mapping, :path)}/id/#{group_id}/#{external_group}",
|
321
|
+
@auth_header)
|
322
|
+
end
|
323
|
+
|
324
|
+
def list_group_mappings(start = nil, count = nil)
|
325
|
+
json_get(@target, "#{type_info(:group_mapping, :path)}/list?startIndex=#{start}&count=#{count}", @key_style, 'authorization' => @auth_header)
|
326
|
+
end
|
310
327
|
end
|
311
328
|
|
312
329
|
end
|
data/lib/uaa/token_coder.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/uaa/token_issuer.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/uaa/util.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/uaa/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
|
-
VERSION = "3.
|
17
|
+
VERSION = "3.1.0"
|
18
18
|
end
|
19
19
|
end
|
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.
|
data/spec/integration_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/scim_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,6 +13,8 @@
|
|
13
13
|
|
14
14
|
require 'spec_helper'
|
15
15
|
require 'uaa/scim'
|
16
|
+
require 'uri'
|
17
|
+
require 'cgi'
|
16
18
|
|
17
19
|
module CF::UAA
|
18
20
|
|
@@ -139,6 +141,72 @@ describe Scim do
|
|
139
141
|
result['id'].should == "id12345"
|
140
142
|
end
|
141
143
|
|
144
|
+
it "adds a mapping from uaa groups to external group" do
|
145
|
+
subject.set_request_handler do |url, method, body, headers|
|
146
|
+
url.should == "#{@target}/Groups/External"
|
147
|
+
method.should == :post
|
148
|
+
check_headers(headers, :json, :json)
|
149
|
+
body.should include('"displayName":"uaa-scope-name"', '"externalGroup":"external-group-name"', '"schemas":["urn:scim:schemas:core:1.0"]')
|
150
|
+
[201, '{"displayName":"uaa-scope-name", "externalGroup": "external-group-name"}', {"content-type" => "application/json"}]
|
151
|
+
end
|
152
|
+
result = subject.map_group("uaa-scope-name", false, "external-group-name")
|
153
|
+
result['displayname'].should == "uaa-scope-name"
|
154
|
+
result['externalgroup'].should == "external-group-name"
|
155
|
+
end
|
156
|
+
|
157
|
+
it "unmaps a uaa group from an external group" do
|
158
|
+
subject.set_request_handler do |url, method, body, headers|
|
159
|
+
url.should == "#{@target}/Groups/External/id/uaa-group-id/external-group-name"
|
160
|
+
method.should == :delete
|
161
|
+
check_headers(headers, nil, nil)
|
162
|
+
|
163
|
+
[200, '{"displayName":"uaa-scope-name", "groupId": "uaa-group-id", "externalGroup": "external-group-name"}', {"content-type" => "application/json"}]
|
164
|
+
end
|
165
|
+
subject.unmap_group("uaa-group-id", "external-group-name")
|
166
|
+
end
|
167
|
+
|
168
|
+
describe "#list_group_mappings" do
|
169
|
+
it "lists all the external group mappings with default pagination" do
|
170
|
+
subject.set_request_handler do |url, method, body, headers|
|
171
|
+
url.should start_with("#{@target}/Groups/External/list")
|
172
|
+
method.should == :get
|
173
|
+
check_headers(headers, nil, :json)
|
174
|
+
|
175
|
+
[
|
176
|
+
200,
|
177
|
+
'{"resources": [{"groupId": "group-id", "displayName": "group-name", "externalGroup": "external-group-name"}], "totalResults": 1 }',
|
178
|
+
{"content-type" => "application/json"}
|
179
|
+
]
|
180
|
+
end
|
181
|
+
|
182
|
+
result = subject.list_group_mappings
|
183
|
+
result['resources'].length.should == 1
|
184
|
+
result['totalresults'].should == 1
|
185
|
+
end
|
186
|
+
|
187
|
+
it "lists a page of external group mappings starting from an index" do
|
188
|
+
subject.set_request_handler do |url, method, body, headers|
|
189
|
+
url.should start_with("#{@target}/Groups/External/list")
|
190
|
+
method.should == :get
|
191
|
+
check_headers(headers, nil, :json)
|
192
|
+
|
193
|
+
query_params = CGI::parse(URI.parse(url).query)
|
194
|
+
start_index = query_params["startIndex"].first
|
195
|
+
count = query_params["count"].first
|
196
|
+
|
197
|
+
start_index.should == "3"
|
198
|
+
count.should == "10"
|
199
|
+
|
200
|
+
[
|
201
|
+
200,
|
202
|
+
'{"resources": [{"groupId": "group-id", "displayName": "group-name", "externalGroup": "external-group-name"}], "totalResults": 1 }',
|
203
|
+
{"content-type" => "application/json"}
|
204
|
+
]
|
205
|
+
end
|
206
|
+
|
207
|
+
subject.list_group_mappings(3, 10)
|
208
|
+
end
|
209
|
+
end
|
142
210
|
end
|
143
211
|
|
144
212
|
end
|
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.
|
data/spec/token_coder_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/token_issuer_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.
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cf-uaa-lib
|
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: multi_json
|