cf-uaa-lib 3.10.0 → 3.11.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: 339b000b5ecc7622591dc843922a7d2b3aa03f86
4
- data.tar.gz: dd889d4ae8c9068e519957e6fef24cd3bd627e08
3
+ metadata.gz: a39c7cac1bfb08a869bf7550ad7cf6bbe12773fe
4
+ data.tar.gz: 1d0ddccaa0bc2e16233f5b97c869b49039be14df
5
5
  SHA512:
6
- metadata.gz: b214f9d0e6fee14b91350d280eda4e54af0075a67fe8f8bfb344b97540efd4b580c68c4fe36e3813a737d09a02247fee2e2a95f32c96f67772f182d20bc5832a
7
- data.tar.gz: '06719f1ede8310dc79b0fa3f33f89e21383af9c1c016a373ea37b8e61b122966d2a5f74bafca04dc4b942cc8c55b2c0ca4583fe2bd3abbdca1778ebfeb7bfb97'
6
+ metadata.gz: ed1db7f178ef9bdf94698575429be99920f52e298c10bd9617a0fa045457647244a58e41ca288aa8c9e7eac9703433bbfe5239dfcbbe8a8c83ba1fb317233e2b
7
+ data.tar.gz: 7bb052fa64c0473588d24aeda1c855e556215fc82f891fc56b2f7f15f7ae7fa3967cb0ac300ff95b285c30a3ed80cd1d0cc748280c78e48bd95181b46595ff17
@@ -5,5 +5,6 @@ before_install:
5
5
  - gem install bundler
6
6
 
7
7
  rvm:
8
- - 1.9.3
8
+ - 2.2.7
9
+ - 2.3.4
9
10
  - 2.4.1
@@ -42,16 +42,27 @@ class Scim
42
42
 
43
43
  def force_attr(k)
44
44
  kd = k.to_s.downcase
45
- kc = {"username" => "userName", "familyname" => "familyName",
46
- "givenname" => "givenName", "middlename" => "middleName",
47
- "honorificprefix" => "honorificPrefix",
48
- "honorificsuffix" => "honorificSuffix", "displayname" => "displayName",
49
- "nickname" => "nickName", "profileurl" => "profileUrl",
50
- "streetaddress" => "streetAddress", "postalcode" => "postalCode",
51
- "usertype" => "userType", "preferredlanguage" => "preferredLanguage",
52
- "x509certificates" => "x509Certificates", "lastmodified" => "lastModified",
53
- "externalid" => "externalId", "phonenumbers" => "phoneNumbers",
54
- "startindex" => "startIndex"}[kd]
45
+ kc = {
46
+ 'username' => 'userName',
47
+ 'familyname' => 'familyName',
48
+ 'givenname' => 'givenName',
49
+ 'middlename' => 'middleName',
50
+ 'honorificprefix' => 'honorificPrefix',
51
+ 'honorificsuffix' => 'honorificSuffix',
52
+ 'displayname' => 'displayName',
53
+ 'nickname' => 'nickName',
54
+ 'profileurl' => 'profileUrl',
55
+ 'streetaddress' => 'streetAddress',
56
+ 'postalcode' => 'postalCode',
57
+ 'usertype' => 'userType',
58
+ 'preferredlanguage' => 'preferredLanguage',
59
+ 'x509certificates' => 'x509Certificates',
60
+ 'lastmodified' => 'lastModified',
61
+ 'externalid' => 'externalId',
62
+ 'phonenumbers' => 'phoneNumbers',
63
+ 'startindex' => 'startIndex',
64
+ 'zoneid' => 'zoneId'
65
+ }[kd]
55
66
  kc || kd
56
67
  end
57
68
 
@@ -76,15 +87,46 @@ class Scim
76
87
 
77
88
  # an attempt to hide some scim and uaa oddities
78
89
  def type_info(type, elem)
79
- scimfo = {:user => ["/Users", "userName"], :group => ["/Groups", "displayName"],
80
- :client => ["/oauth/clients", 'client_id'], :user_id => ["/ids/Users", 'userName'], :group_mapping => ["/Groups/External", "externalGroup"]}
81
- unless elem == :path || elem == :name_attr
82
- raise ArgumentError, "scim schema element must be :path or :name_attr"
83
- end
84
- unless ary = scimfo[type]
90
+ scimfo = {
91
+ user: {
92
+ path: '/Users',
93
+ name_attr: 'userName',
94
+ origin_attr: 'origin'
95
+ },
96
+ group: {
97
+ path: '/Groups',
98
+ name_attr: 'displayName',
99
+ origin_attr: 'zoneid'
100
+ },
101
+ client: {
102
+ path: '/oauth/clients',
103
+ name_attr: 'client_id'
104
+ },
105
+ user_id: {
106
+ path: '/ids/Users',
107
+ name_attr: 'userName',
108
+ origin_attr: 'origin',
109
+ },
110
+ group_mapping: {
111
+ path: '/Groups/External',
112
+ name_attr: 'externalGroup',
113
+ origin_attr: 'origin'
114
+ }
115
+ }
116
+
117
+ type_info = scimfo[type]
118
+
119
+ unless type_info
85
120
  raise ArgumentError, "scim resource type must be one of #{scimfo.keys.inspect}"
86
121
  end
87
- ary[elem == :path ? 0 : 1]
122
+
123
+ value = type_info[elem]
124
+
125
+ unless value
126
+ raise ArgumentError, "scim schema element must be one of #{type_info.keys.inspect}"
127
+ end
128
+
129
+ value
88
130
  end
89
131
 
90
132
  def jkey(k) @key_style == :down ? k.to_s : k end
@@ -262,9 +304,16 @@ class Scim
262
304
  # @param type (see #add)
263
305
  # @return [Array] array of name/id hashes for each object found
264
306
  def ids(type, *names)
265
- na = type_info(type, :name_attr)
266
- filter = names.map { |n| "#{na} eq \"#{n}\""}
267
- all_pages(type, :attributes => "id,#{na}", :filter => filter.join(" or "))
307
+ name_attr = type_info(type, :name_attr)
308
+ origin_attr = type_info(type, :origin_attr)
309
+
310
+ filter = names.map do |n|
311
+ "#{name_attr} eq \"#{n}\""
312
+ end
313
+
314
+ attributes = ['id', name_attr, origin_attr]
315
+
316
+ all_pages(type, attributes: attributes.join(','), filter: filter.join(' or '))
268
317
  end
269
318
 
270
319
  # Convenience method to query for single object by name.
@@ -14,6 +14,6 @@
14
14
  # Cloud Foundry namespace
15
15
  module CF
16
16
  module UAA
17
- VERSION = '3.10.0'
17
+ VERSION = '3.11.0'
18
18
  end
19
19
  end
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.10.0
4
+ version: 3.11.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: 2017-07-10 00:00:00.000000000 Z
15
+ date: 2017-07-28 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: multi_json