cf-uaa-lib 1.3.4 → 1.3.5

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.
Files changed (3) hide show
  1. data/lib/uaa/scim.rb +16 -5
  2. data/lib/uaa/version.rb +1 -1
  3. metadata +3 -8
data/lib/uaa/scim.rb CHANGED
@@ -101,6 +101,12 @@ class Scim
101
101
  @key_style = options[:symbolize_keys] ? :downsym : :down
102
102
  end
103
103
 
104
+ # Convenience method to get the naming attribute, e.g. userName for user,
105
+ # displayName for group, client_id for client.
106
+ # @param type (see #add)
107
+ # @return [String] naming attribute
108
+ def name_attr(type) type_info(type, :name_attr) end
109
+
104
110
  # Creates a SCIM resource.
105
111
  # @param [Symbol] type can be :user, :group, :client, :user_id.
106
112
  # @param [Hash] info converted to json and sent to the scim endpoint. For schema of
@@ -159,13 +165,18 @@ class Scim
159
165
  query['attributes'] = Util.strlist(attrs, ",")
160
166
  end
161
167
  qstr = query.empty?? '': "?#{Util.encode_form(query)}"
162
- info = json_get(@target, "#{type_info(type, :path)}#{qstr}", @key_style, 'authorization' => @auth_header)
168
+ info = json_get(@target, "#{type_info(type, :path)}#{qstr}",
169
+ @key_style, 'authorization' => @auth_header)
163
170
  unless info.is_a?(Hash) && info[rk = jkey(:resources)].is_a?(Array)
164
171
 
165
- # hide client endpoints that are not scim compatible
172
+ # hide client endpoints that are not yet scim compatible
166
173
  if type == :client && info.is_a?(Hash)
167
- info.each { |k, v| fake_client_id(v) }
168
- return {rk => info.values }
174
+ info = info.each{ |k, v| fake_client_id(v) }.values
175
+ if m = /^client_id\s+eq\s+"([^"]+)"$/i.match(query['filter'])
176
+ idk = jkey(:client_id)
177
+ info = info.select { |c| c[idk].casecmp(m[1]) == 0 }
178
+ end
179
+ return {rk => info}
169
180
  end
170
181
 
171
182
  raise BadResponse, "invalid reply to #{type} query of #{@target}"
@@ -260,7 +271,7 @@ class Scim
260
271
 
261
272
  # Change client secret.
262
273
  # * For a client to change its own secret, the token in @auth_header must contain
263
- # "uaa.admin,client.secret" scope and the correct +old_secret+ must be given.
274
+ # "client.secret" scope and the correct +old_secret+ must be given.
264
275
  # * For an admin to set a client secret, the token in @auth_header must contain
265
276
  # "uaa.admin" scope.
266
277
  # @see https://github.com/cloudfoundry/uaa/blob/master/docs/UAA-APIs.rst#change-client-secret-put-oauthclientsclient_idsecret
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 = "1.3.4"
17
+ VERSION = "1.3.5"
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: 1.3.4
4
+ version: 1.3.5
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: 2013-01-05 00:00:00.000000000 Z
16
+ date: 2013-01-22 00:00:00.000000000 Z
17
17
  dependencies:
18
18
  - !ruby/object:Gem::Dependency
19
19
  name: multi_json
@@ -193,18 +193,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
193
193
  - - ! '>='
194
194
  - !ruby/object:Gem::Version
195
195
  version: '0'
196
- segments:
197
- - 0
198
- hash: -2055415488226018803
199
196
  required_rubygems_version: !ruby/object:Gem::Requirement
200
197
  none: false
201
198
  requirements:
202
199
  - - ! '>='
203
200
  - !ruby/object:Gem::Version
204
201
  version: '0'
205
- segments:
206
- - 0
207
- hash: -2055415488226018803
208
202
  requirements: []
209
203
  rubyforge_project: cf-uaa-lib
210
204
  rubygems_version: 1.8.23
@@ -212,3 +206,4 @@ signing_key:
212
206
  specification_version: 3
213
207
  summary: Client library for CloudFoundry UAA
214
208
  test_files: []
209
+ has_rdoc: