cf-uaa-lib 3.3.0 → 3.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 724dc6bfaa51c2bfcf8488c914581b4596a52fca
4
- data.tar.gz: a9c9f6d61094c2c5b0008f9b232540c17aad81ca
3
+ metadata.gz: f245d2cfe14edb44c63bc69fa6fe487f4ef64589
4
+ data.tar.gz: c0f530c759641e62bf5f0b38be7233233e058ed0
5
5
  SHA512:
6
- metadata.gz: a7ea32c489b18713ac195b8ef3819718d8f4c2767d823670a8efef03563176c4c8d9e1cf368134551323d7a6e2575cc3fec1c3efb3a1730e6d1013904b0c6cab
7
- data.tar.gz: 60714df4d646b641c90cefbb18957fb4da0074f11c9bd6fa54e346d55785c453f9c9545c9323143d1b957cb8be6a17f03fa5bb2f68a09586d3b41fb85731e30d
6
+ metadata.gz: 70bb9323f4c2955b266a8ad69f3b274ff3e1dda1c8aee11d15920b00fcbe5104281077cf3249cfdcbda0f260789ef9ff3ef9cd62b45376eecd86b38863975434
7
+ data.tar.gz: 4f0a349fdcc4635de8c7692783353d7c5fda26e974fa4423f73c3f8b968666a977071a56cb738a10ff6fa453913dd49e744739ecfd5d1232b6d58df0e09535df
data/lib/uaa/scim.rb CHANGED
@@ -315,17 +315,17 @@ class Scim
315
315
  "#{type_info(:client, :path)}/#{URI.encode(client_id)}/secret", req, headers))
316
316
  end
317
317
 
318
- def map_group(group, is_id, external_group)
318
+ def map_group(group, is_id, external_group, origin = "ldap")
319
319
  key_name = is_id ? :groupId : :displayName
320
- request = {key_name => group, :externalGroup => external_group, :schemas => ["urn:scim:schemas:core:1.0"] }
320
+ request = {key_name => group, :externalGroup => external_group, :schemas => ["urn:scim:schemas:core:1.0"], :origin => origin }
321
321
  result = json_parse_reply(@key_style, *json_post(@target,
322
322
  "#{type_info(:group_mapping, :path)}", request,
323
323
  headers))
324
324
  result
325
325
  end
326
326
 
327
- def unmap_group(group_id, external_group)
328
- http_delete(@target, "#{type_info(:group_mapping, :path)}/id/#{group_id}/#{URI.encode(external_group)}",
327
+ def unmap_group(group_id, external_group, origin = "ldap")
328
+ http_delete(@target, "#{type_info(:group_mapping, :path)}/groupId/#{group_id}/externalGroup/#{URI.encode(external_group)}/origin/#{origin}",
329
329
  @auth_header, @zone)
330
330
  end
331
331
 
data/lib/uaa/version.rb CHANGED
@@ -14,6 +14,6 @@
14
14
  # Cloud Foundry namespace
15
15
  module CF
16
16
  module UAA
17
- VERSION = "3.3.0"
17
+ VERSION = "3.4.0"
18
18
  end
19
19
  end
data/spec/scim_spec.rb CHANGED
@@ -157,7 +157,20 @@ describe Scim do
157
157
  url.should == "#{@target}/Groups/External"
158
158
  method.should == :post
159
159
  check_headers(headers, :json, :json, nil)
160
- body.should include('"displayName":"uaa-scope-name"', '"externalGroup":"external-group-name"', '"schemas":["urn:scim:schemas:core:1.0"]')
160
+ body.should include('"displayName":"uaa-scope-name"', '"externalGroup":"external-group-name"', '"schemas":["urn:scim:schemas:core:1.0"]', '"origin":"test-origin"')
161
+ [201, '{"displayName":"uaa-scope-name", "externalGroup": "external-group-name"}', {"content-type" => "application/json"}]
162
+ end
163
+ result = subject.map_group("uaa-scope-name", false, "external-group-name", "test-origin")
164
+ result['displayname'].should == "uaa-scope-name"
165
+ result['externalgroup'].should == "external-group-name"
166
+ end
167
+
168
+ it "defaults to ldap origin when mapping a uaa group from an external group" do
169
+ subject.set_request_handler do |url, method, body, headers|
170
+ url.should == "#{@target}/Groups/External"
171
+ method.should == :post
172
+ check_headers(headers, :json, :json, nil)
173
+ body.should include('"displayName":"uaa-scope-name"', '"externalGroup":"external-group-name"', '"schemas":["urn:scim:schemas:core:1.0"]', '"origin":"ldap"')
161
174
  [201, '{"displayName":"uaa-scope-name", "externalGroup": "external-group-name"}', {"content-type" => "application/json"}]
162
175
  end
163
176
  result = subject.map_group("uaa-scope-name", false, "external-group-name")
@@ -167,7 +180,18 @@ describe Scim do
167
180
 
168
181
  it "unmaps a uaa group from an external group" do
169
182
  subject.set_request_handler do |url, method, body, headers|
170
- url.should == "#{@target}/Groups/External/id/uaa-group-id/external%20group%20name"
183
+ url.should == "#{@target}/Groups/External/groupId/uaa-group-id/externalGroup/external%20group%20name/origin/test-origin"
184
+ method.should == :delete
185
+ check_headers(headers, nil, nil, nil)
186
+
187
+ [200, '{"displayName":"uaa-scope-name", "groupId": "uaa-group-id", "externalGroup": "external-group-name"}', {"content-type" => "application/json"}]
188
+ end
189
+ subject.unmap_group("uaa-group-id", "external group name", "test-origin")
190
+ end
191
+
192
+ it "defaults to ldap origin when unmapping a uaa group from an external group" do
193
+ subject.set_request_handler do |url, method, body, headers|
194
+ url.should == "#{@target}/Groups/External/groupId/uaa-group-id/externalGroup/external%20group%20name/origin/ldap"
171
195
  method.should == :delete
172
196
  check_headers(headers, nil, nil, nil)
173
197
 
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.3.0
4
+ version: 3.4.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: 2016-03-25 00:00:00.000000000 Z
15
+ date: 2016-03-31 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: multi_json
@@ -187,7 +187,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
187
187
  version: '0'
188
188
  requirements: []
189
189
  rubyforge_project: cf-uaa-lib
190
- rubygems_version: 2.2.3
190
+ rubygems_version: 2.2.2
191
191
  signing_key:
192
192
  specification_version: 4
193
193
  summary: Client library for CloudFoundry UAA