cf-uaa-lib 4.0.3 → 4.0.5

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: 1265b1f30cfa697725fbdac34316f57c9bb202b84b28ca8a193e24747c223cc0
4
+ data.tar.gz: 442bdf0d2344510386518e92c27c05e19638bc64540315750d101c43d004bb5f
5
5
  SHA512:
6
- metadata.gz: fedcc696e77cd58fb6a53b24d1eb24482c487e239bbf3e1c6470c66480f5e7f29fc8bd4ab178deb13c010cac2284a21a191c8025870961c4182ffcf212c03c03
7
- data.tar.gz: 10a6ca261845b1d773b941da11fc1abffa37ee910fe1175bc5fa9a716a213ab38c70056e44d3d73e2a891ce9c3747243f00342d0a8c3ff8076e373ebeceb3b42
6
+ metadata.gz: 2105ab1ec2909280fc9298478faad438bf33a4822269d3d026c8a47b4ecbe52204e2b884ad688282eb852c500fd3c9cd3c00f14734dc73b4c73eca8f46fb414b
7
+ data.tar.gz: 570f8db56441c4bcb0082838e5c473a2759ffe08def98b4d766853fdc05772714871df92ea4f010461c7cc8e1d0fea6d07ef116cce568186ba1f5f71543f4f72
@@ -3,27 +3,22 @@ name: Ruby Gem
3
3
  on: workflow_dispatch
4
4
 
5
5
  jobs:
6
- build:
7
- name: Build + Publish
6
+ push:
7
+ name: Push gem to RubyGems.org
8
8
  runs-on: ubuntu-latest
9
+
9
10
  permissions:
10
- contents: read
11
- packages: write
11
+ id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
12
+ contents: write # IMPORTANT: this permission is required for `rake release` to push the release tag
12
13
 
13
14
  steps:
14
- - uses: actions/checkout@v4
15
- - name: Set up Ruby 2.6
16
- uses: ruby/setup-ruby@v1
17
- with:
18
- ruby-version: '2.6'
15
+ # Set up
16
+ - uses: actions/checkout@v4
17
+ - name: Set up Ruby
18
+ uses: ruby/setup-ruby@v1
19
+ with:
20
+ bundler-cache: true
21
+ ruby-version: ruby
19
22
 
20
- - name: Publish to RubyGems
21
- run: |
22
- mkdir -p $HOME/.gem
23
- touch $HOME/.gem/credentials
24
- chmod 0600 $HOME/.gem/credentials
25
- printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
26
- gem build *.gemspec
27
- gem push *.gem
28
- env:
29
- GEM_HOST_API_KEY: "${{ secrets.RUBYGEMS_AUTH_TOKEN }}"
23
+ # Release
24
+ - uses: rubygems/release-gem@v1
@@ -0,0 +1,24 @@
1
+ name: Ruby Gem
2
+
3
+ on: workflow_dispatch
4
+
5
+ jobs:
6
+ push:
7
+ name: Push gem to RubyGems.org
8
+ runs-on: ubuntu-latest
9
+
10
+ permissions:
11
+ id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
12
+ contents: write # IMPORTANT: this permission is required for `rake release` to push the release tag
13
+
14
+ steps:
15
+ # Set up
16
+ - uses: actions/checkout@v4
17
+ - name: Set up Ruby
18
+ uses: ruby/setup-ruby@v1
19
+ with:
20
+ bundler-cache: true
21
+ ruby-version: ruby
22
+
23
+ # Release
24
+ - uses: rubygems/release-gem@v1
data/cf-uaa-lib.gemspec CHANGED
@@ -31,7 +31,7 @@ Gem::Specification.new do |s|
31
31
  s.require_paths = ['lib']
32
32
 
33
33
  # dependencies
34
- s.add_dependency 'multi_json', '>= 1.12.1', '< 1.16'
34
+ s.add_dependency 'json_pure', '~>2.7'
35
35
  s.add_dependency 'httpclient', '~> 2.8', '>= 2.8.2.4'
36
36
  s.add_dependency 'addressable', '~> 2.8', '>= 2.8.0'
37
37
 
@@ -41,7 +41,7 @@ Gem::Specification.new do |s|
41
41
  s.add_development_dependency 'simplecov', '~> 0.22.0'
42
42
  s.add_development_dependency 'simplecov-rcov', '~> 0.3.0'
43
43
  s.add_development_dependency 'ci_reporter', '>= 1.9.2', '~> 2.0'
44
- s.add_development_dependency 'json_pure', '>= 1.8.1', '~> 2.5'
44
+ s.add_development_dependency 'json_pure', '~>2.7'
45
45
  s.add_development_dependency 'ci_reporter_rspec', '~> 1.0'
46
46
 
47
47
  end
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/util.rb CHANGED
@@ -11,7 +11,7 @@
11
11
  # subcomponent's license, as noted in the LICENSE file.
12
12
  #++
13
13
 
14
- require 'multi_json'
14
+ require 'json/pure'
15
15
  require "base64"
16
16
  require 'logger'
17
17
  require 'uri'
@@ -141,11 +141,11 @@ class Util
141
141
 
142
142
  # Converts +obj+ to JSON
143
143
  # @return [String] obj in JSON form.
144
- def self.json(obj) MultiJson.dump(obj) end
144
+ def self.json(obj) JSON.dump(obj) end
145
145
 
146
146
  # Converts +obj+ to nicely formatted JSON
147
147
  # @return [String] obj in formatted json
148
- def self.json_pretty(obj) MultiJson.dump(obj, pretty: true) end
148
+ def self.json_pretty(obj) JSON.pretty_generate(obj) end
149
149
 
150
150
  # Converts +obj+ to a URL-safe base 64 encoded string
151
151
  # @return [String]
@@ -182,8 +182,8 @@ class Util
182
182
  # @param style (see Util.hash_key)
183
183
  # @return [Hash] parsed data
184
184
  def self.json_parse(str, style = nil)
185
- hash_keys!(MultiJson.load(str), style) if str && !str.empty?
186
- rescue MultiJson::DecodeError
185
+ hash_keys!(JSON.parse(str), style) if str && !str.empty?
186
+ rescue Exception
187
187
  raise DecodeError, "json decoding error"
188
188
  end
189
189
 
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.5'
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.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dave Syer
@@ -12,28 +12,22 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2023-09-08 00:00:00.000000000 Z
15
+ date: 2024-10-31 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
- name: multi_json
18
+ name: json_pure
19
19
  requirement: !ruby/object:Gem::Requirement
20
20
  requirements:
21
- - - ">="
22
- - !ruby/object:Gem::Version
23
- version: 1.12.1
24
- - - "<"
21
+ - - "~>"
25
22
  - !ruby/object:Gem::Version
26
- version: '1.16'
23
+ version: '2.7'
27
24
  type: :runtime
28
25
  prerelease: false
29
26
  version_requirements: !ruby/object:Gem::Requirement
30
27
  requirements:
31
- - - ">="
32
- - !ruby/object:Gem::Version
33
- version: 1.12.1
34
- - - "<"
28
+ - - "~>"
35
29
  - !ruby/object:Gem::Version
36
- version: '1.16'
30
+ version: '2.7'
37
31
  - !ruby/object:Gem::Dependency
38
32
  name: httpclient
39
33
  requirement: !ruby/object:Gem::Requirement
@@ -58,22 +52,22 @@ dependencies:
58
52
  name: addressable
59
53
  requirement: !ruby/object:Gem::Requirement
60
54
  requirements:
61
- - - ">="
62
- - !ruby/object:Gem::Version
63
- version: 2.8.0
64
55
  - - "~>"
65
56
  - !ruby/object:Gem::Version
66
57
  version: '2.8'
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: 2.8.0
67
61
  type: :runtime
68
62
  prerelease: false
69
63
  version_requirements: !ruby/object:Gem::Requirement
70
64
  requirements:
71
- - - ">="
72
- - !ruby/object:Gem::Version
73
- version: 2.8.0
74
65
  - - "~>"
75
66
  - !ruby/object:Gem::Version
76
67
  version: '2.8'
68
+ - - ">="
69
+ - !ruby/object:Gem::Version
70
+ version: 2.8.0
77
71
  - !ruby/object:Gem::Dependency
78
72
  name: bundler
79
73
  requirement: !ruby/object:Gem::Requirement
@@ -180,22 +174,16 @@ dependencies:
180
174
  name: json_pure
181
175
  requirement: !ruby/object:Gem::Requirement
182
176
  requirements:
183
- - - ">="
184
- - !ruby/object:Gem::Version
185
- version: 1.8.1
186
177
  - - "~>"
187
178
  - !ruby/object:Gem::Version
188
- version: '2.5'
179
+ version: '2.7'
189
180
  type: :development
190
181
  prerelease: false
191
182
  version_requirements: !ruby/object:Gem::Requirement
192
183
  requirements:
193
- - - ">="
194
- - !ruby/object:Gem::Version
195
- version: 1.8.1
196
184
  - - "~>"
197
185
  - !ruby/object:Gem::Version
198
- version: '2.5'
186
+ version: '2.7'
199
187
  - !ruby/object:Gem::Dependency
200
188
  name: ci_reporter_rspec
201
189
  requirement: !ruby/object:Gem::Requirement
@@ -227,6 +215,7 @@ extra_rdoc_files: []
227
215
  files:
228
216
  - ".github/dependabot.yml"
229
217
  - ".github/workflows/gem-push.yml"
218
+ - ".github/workflows/push_gem.yml"
230
219
  - ".github/workflows/ruby.yml"
231
220
  - ".gitignore"
232
221
  - ".yardopts"
@@ -273,7 +262,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
273
262
  - !ruby/object:Gem::Version
274
263
  version: '0'
275
264
  requirements: []
276
- rubygems_version: 3.0.3.1
265
+ rubygems_version: 3.5.16
277
266
  signing_key:
278
267
  specification_version: 4
279
268
  summary: Client library for CloudFoundry UAA