cf-uaa-lib 4.0.3 → 4.0.4

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
  SHA256:
3
- metadata.gz: 9eebcd4d0b7e5068266fceab3b4686335b5446bb18a6bf4f0a68139ee958dcf6
4
- data.tar.gz: d010ba705cca4e1c78c87b782e17faab10f3c3f1008a5337ff2345634053e0bc
3
+ metadata.gz: ec18b7af2736542f939dab136eb1f7d2b728fa394a6c845423eb1e5c1a9c5b59
4
+ data.tar.gz: 1aaa66c33d5070d78b22e6e8f6ee4d31940182bd23918e8b8e4ff5203c271e68
5
5
  SHA512:
6
- metadata.gz: fedcc696e77cd58fb6a53b24d1eb24482c487e239bbf3e1c6470c66480f5e7f29fc8bd4ab178deb13c010cac2284a21a191c8025870961c4182ffcf212c03c03
7
- data.tar.gz: 10a6ca261845b1d773b941da11fc1abffa37ee910fe1175bc5fa9a716a213ab38c70056e44d3d73e2a891ce9c3747243f00342d0a8c3ff8076e373ebeceb3b42
6
+ metadata.gz: b4b3af6298e27f3941596509fc3cfcd90434d173d83ecc3d70094ca366ce550fdf9e78c54aaa29753d831cfb1cfae06cf077fb57c5bce8acd8109f4c2e35ae31
7
+ data.tar.gz: daaf82f350b34392b3cf2fef2748a9403ede4e311e8856e0ce6a4df48d1d70a294f506f15292e5f17762a1c327e46800a29acf48d5d13266f705d28f97be8535
data/lib/uaa/scim.rb CHANGED
@@ -369,6 +369,28 @@ class Scim
369
369
  "#{type_info(:client, :path)}/#{Addressable::URI.encode(client_id)}/secret", req, headers))
370
370
  end
371
371
 
372
+ # Change client jwt trust configuration.
373
+ # * For a client to change its jwt client trust, the token in @auth_header must contain
374
+ # "client.trust" scope.
375
+ # * For an admin to set a client secret, the token in @auth_header must contain
376
+ # "uaa.admin" scope.
377
+ # @see https://docs.cloudfoundry.org/api/uaa/index.html#change-client-jwt
378
+ # @param [String] client_id the {Scim} +id+ attribute of the client
379
+ # @param [String] jwks_uri the URI to token endpoint
380
+ # @param [String] jwks the JSON Web Key Set
381
+ # @param [String] kid If changeMode is DELETE provide the id of key
382
+ # @param [String] changeMode Change mode, possible is ADD, UPDATE, DELETE
383
+ # @return [Hash] success message from server
384
+ def change_clientjwt(client_id, jwks_uri = nil, jwks = nil, kid = nil, changeMode = nil)
385
+ req = {"client_id" => client_id }
386
+ req["jwks_uri"] = jwks_uri if jwks_uri
387
+ req["jwks"] = jwks if jwks
388
+ req["kid"] = kid if kid
389
+ req["changeMode"] = changeMode if changeMode
390
+ json_parse_reply(@key_style, *json_put(@target,
391
+ "#{type_info(:client, :path)}/#{Addressable::URI.encode(client_id)}/clientjwt", req, headers))
392
+ end
393
+
372
394
  def unlock_user(user_id)
373
395
  req = {"locked" => false}
374
396
  json_parse_reply(@key_style, *json_patch(@target,
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 = '4.0.3'
17
+ VERSION = '4.0.4'
18
18
  end
19
19
  end
data/spec/scim_spec.rb CHANGED
@@ -160,6 +160,30 @@ describe Scim do
160
160
  result['id'].should == 'id12345'
161
161
  end
162
162
 
163
+ it "add a client's jwt trust using jwks_uri" do
164
+ subject.set_request_handler do |url, method, body, headers|
165
+ url.should == "#{@target}/oauth/clients/id12345/clientjwt"
166
+ method.should == :put
167
+ check_headers(headers, :json, :json, nil)
168
+ body.should include('"jwks_uri":"http://localhost:8080/uaa/token_keys"')
169
+ [200, '{"id":"id12345"}', {'content-type' => 'application/json'}]
170
+ end
171
+ result = subject.change_clientjwt('id12345', 'http://localhost:8080/uaa/token_keys')
172
+ result['id'].should == 'id12345'
173
+ end
174
+
175
+ it "add a client's jwt trust using jwks" do
176
+ subject.set_request_handler do |url, method, body, headers|
177
+ url.should == "#{@target}/oauth/clients/id12345/clientjwt"
178
+ method.should == :put
179
+ check_headers(headers, :json, :json, nil)
180
+ body.should include('"jwks":"keys"')
181
+ [200, '{"id":"id12345"}', {'content-type' => 'application/json'}]
182
+ end
183
+ result = subject.change_clientjwt('id12345', nil, 'keys')
184
+ result['id'].should == 'id12345'
185
+ end
186
+
163
187
  it 'unlocks a user' do
164
188
  subject.set_request_handler do |url, method, body, headers|
165
189
  url.should == "#{@target}/Users/id12345/status"
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: 4.0.3
4
+ version: 4.0.4
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: 2023-09-08 00:00:00.000000000 Z
15
+ date: 2023-10-17 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: multi_json