auth0 5.14.2 → 5.16.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 97ee62870b22963b87275a7a9b6cb691f2353a3f10820d0b3a7f24300a538fec
4
- data.tar.gz: dd9812af9eb9ab13724912ecec01497c9cdc204f462ef9c8a954abc0c54a2a97
3
+ metadata.gz: '0978f1fb53fb4cf3047f12b60ae15d131a47e225f124bb74b26a508ba51c1548'
4
+ data.tar.gz: 37dedc6fe3b8c9cf4a8fe795d0011a73c66a7c79f4485bb72c4f722772bf2644
5
5
  SHA512:
6
- metadata.gz: aa6947cfb14277b47a255ca71b2ae7d560f6fe1e3f4d85007431024af96a38d880855a2e6a56b5807551838d9413ac90403c736601ff1e74531e64f92728c45c
7
- data.tar.gz: cf0cee02c1fd5964d2a84e35de0264ec966e9b512f2dd613e94dafd349f5b062e8e4c5cf02396dffc969ad74e472b1d908803a2a586089d0d2ee7b7cdfde1481
6
+ metadata.gz: 1f5c2df075fd3dea61c55467c3818561f763d459aaeb66c9147849f46c0ed366777e59982438d9479f197f16770e4615bedb3872326775f0ba3782d312a5ad84
7
+ data.tar.gz: d65412c6bc0a4a1806eb1ff08b92503ea3c60c3e44e359b4c45cde37c715109ced81bd2aa78f726784fc1c82c45a3482aacaacbdcdf3abf58ecf070b505d3de4
@@ -11,7 +11,7 @@ on:
11
11
  branches:
12
12
  - master
13
13
  schedule:
14
- - cron: '30 0 1,15 * *'
14
+ - cron: "30 0 1,15 * *"
15
15
 
16
16
  permissions:
17
17
  contents: read
@@ -42,6 +42,8 @@ jobs:
42
42
  with:
43
43
  ref: ${{ github.event.pull_request.head.sha || github.ref }}
44
44
 
45
- - uses: snyk/actions/php@b98d498629f1c368650224d6d212bf7dfa89e4bf # pin@0.4.0
45
+ - run: npm install -g snyk
46
+
47
+ - run: snyk test
46
48
  env:
47
49
  SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
@@ -14,7 +14,7 @@ permissions:
14
14
  contents: read
15
15
 
16
16
  concurrency:
17
- group: ${{ github.workflow }}-${{ github.ref }}
17
+ group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
18
18
  cancel-in-progress: ${{ github.ref != 'refs/heads/master' }}
19
19
 
20
20
  env:
data/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # Change Log
2
2
 
3
+ ## [v5.16.0](https://github.com/auth0/ruby-auth0/tree/v5.16.0) (2023-11-13)
4
+ [Full Changelog](https://github.com/auth0/ruby-auth0/compare/v5.15.0...v5.16.0)
5
+
6
+ **Added**
7
+ - [SDK-4546] Add orgs in client credentials support [\#540](https://github.com/auth0/ruby-auth0/pull/540) ([adamjmcgrath](https://github.com/adamjmcgrath))
8
+
9
+ ## [v5.15.0](https://github.com/auth0/ruby-auth0/tree/v5.15.0) (2023-10-30)
10
+ [Full Changelog](https://github.com/auth0/ruby-auth0/compare/v5.14.2...v5.15.0)
11
+
12
+ **Added**
13
+ - [SDK-4659] Add fields to get_organizations_members [\#532](https://github.com/auth0/ruby-auth0/pull/532) ([adamjmcgrath](https://github.com/adamjmcgrath))
14
+
3
15
  ## [v5.14.2](https://github.com/auth0/ruby-auth0/tree/v5.14.2) (2023-10-03)
4
16
 
5
17
  [Full Changelog](https://github.com/auth0/ruby-auth0/compare/v5.14.1...v5.14.2)
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- auth0 (5.14.2)
4
+ auth0 (5.16.0)
5
5
  addressable (~> 2.8)
6
6
  jwt (~> 2.7)
7
7
  rest-client (~> 2.1)
@@ -11,31 +11,41 @@ PATH
11
11
  GEM
12
12
  remote: https://rubygems.org/
13
13
  specs:
14
- actionpack (7.0.8)
15
- actionview (= 7.0.8)
16
- activesupport (= 7.0.8)
17
- rack (~> 2.0, >= 2.2.4)
14
+ actionpack (7.1.2)
15
+ actionview (= 7.1.2)
16
+ activesupport (= 7.1.2)
17
+ nokogiri (>= 1.8.5)
18
+ racc
19
+ rack (>= 2.2.4)
20
+ rack-session (>= 1.0.1)
18
21
  rack-test (>= 0.6.3)
19
- rails-dom-testing (~> 2.0)
20
- rails-html-sanitizer (~> 1.0, >= 1.2.0)
21
- actionview (7.0.8)
22
- activesupport (= 7.0.8)
22
+ rails-dom-testing (~> 2.2)
23
+ rails-html-sanitizer (~> 1.6)
24
+ actionview (7.1.2)
25
+ activesupport (= 7.1.2)
23
26
  builder (~> 3.1)
24
- erubi (~> 1.4)
25
- rails-dom-testing (~> 2.0)
26
- rails-html-sanitizer (~> 1.1, >= 1.2.0)
27
- activesupport (7.0.8)
27
+ erubi (~> 1.11)
28
+ rails-dom-testing (~> 2.2)
29
+ rails-html-sanitizer (~> 1.6)
30
+ activesupport (7.1.2)
31
+ base64
32
+ bigdecimal
28
33
  concurrent-ruby (~> 1.0, >= 1.0.2)
34
+ connection_pool (>= 2.2.5)
35
+ drb
29
36
  i18n (>= 1.6, < 2)
30
37
  minitest (>= 5.1)
38
+ mutex_m
31
39
  tzinfo (~> 2.0)
32
40
  addressable (2.8.5)
33
41
  public_suffix (>= 2.0.2, < 6.0)
34
42
  ast (2.4.2)
35
- base64 (0.1.1)
43
+ base64 (0.2.0)
44
+ bigdecimal (3.1.4)
36
45
  builder (3.2.4)
37
46
  coderay (1.1.3)
38
47
  concurrent-ruby (1.2.2)
48
+ connection_pool (2.4.1)
39
49
  coveralls (0.7.1)
40
50
  multi_json (~> 1.3)
41
51
  rest-client
@@ -53,10 +63,12 @@ GEM
53
63
  dotenv-rails (2.8.1)
54
64
  dotenv (= 2.8.1)
55
65
  railties (>= 3.2)
66
+ drb (2.2.0)
67
+ ruby2_keywords
56
68
  erubi (1.12.0)
57
69
  faker (2.23.0)
58
70
  i18n (>= 1.8.11, < 2)
59
- ffi (1.16.2)
71
+ ffi (1.16.3)
60
72
  formatador (1.1.0)
61
73
  fuubar (2.5.1)
62
74
  rspec-core (~> 3.0)
@@ -82,7 +94,7 @@ GEM
82
94
  i18n (1.14.1)
83
95
  concurrent-ruby (~> 1.0)
84
96
  io-console (0.6.0)
85
- irb (1.8.1)
97
+ irb (1.9.0)
86
98
  rdoc
87
99
  reline (>= 0.3.8)
88
100
  json (2.6.3)
@@ -91,16 +103,17 @@ GEM
91
103
  listen (3.8.0)
92
104
  rb-fsevent (~> 0.10, >= 0.10.3)
93
105
  rb-inotify (~> 0.9, >= 0.9.10)
94
- loofah (2.21.3)
106
+ loofah (2.21.4)
95
107
  crass (~> 1.0.2)
96
108
  nokogiri (>= 1.12.0)
97
109
  lumberjack (1.2.9)
98
110
  method_source (1.0.0)
99
111
  mime-types (3.5.1)
100
112
  mime-types-data (~> 3.2015)
101
- mime-types-data (3.2023.0808)
113
+ mime-types-data (3.2023.1003)
102
114
  minitest (5.20.0)
103
115
  multi_json (1.15.0)
116
+ mutex_m (0.2.0)
104
117
  nenv (0.3.0)
105
118
  netrc (0.11.0)
106
119
  nokogiri (1.15.4-aarch64-linux)
@@ -115,22 +128,27 @@ GEM
115
128
  nenv (~> 0.1)
116
129
  shellany (~> 0.0)
117
130
  parallel (1.23.0)
118
- parser (3.2.2.3)
131
+ parser (3.2.2.4)
119
132
  ast (~> 2.4.1)
120
133
  racc
121
- pp (0.4.0)
134
+ pp (0.5.0)
122
135
  prettyprint
123
- prettyprint (0.1.1)
136
+ prettyprint (0.2.0)
124
137
  pry (0.14.2)
125
138
  coderay (~> 1.1)
126
139
  method_source (~> 1.0)
127
- psych (5.1.0)
140
+ psych (5.1.1.1)
128
141
  stringio
129
142
  public_suffix (5.0.3)
130
- racc (1.7.1)
131
- rack (2.2.8)
143
+ racc (1.7.3)
144
+ rack (3.0.8)
145
+ rack-session (2.0.0)
146
+ rack (>= 3.0.0)
132
147
  rack-test (2.1.0)
133
148
  rack (>= 1.3)
149
+ rackup (2.1.0)
150
+ rack (>= 3)
151
+ webrick (~> 1.8)
134
152
  rails-dom-testing (2.2.0)
135
153
  activesupport (>= 5.0.0)
136
154
  minitest
@@ -138,22 +156,23 @@ GEM
138
156
  rails-html-sanitizer (1.6.0)
139
157
  loofah (~> 2.21)
140
158
  nokogiri (~> 1.14)
141
- railties (7.0.8)
142
- actionpack (= 7.0.8)
143
- activesupport (= 7.0.8)
144
- method_source
159
+ railties (7.1.2)
160
+ actionpack (= 7.1.2)
161
+ activesupport (= 7.1.2)
162
+ irb
163
+ rackup (>= 1.0.0)
145
164
  rake (>= 12.2)
146
- thor (~> 1.0)
147
- zeitwerk (~> 2.5)
165
+ thor (~> 1.0, >= 1.2.2)
166
+ zeitwerk (~> 2.6)
148
167
  rainbow (3.1.1)
149
- rake (13.0.6)
168
+ rake (13.1.0)
150
169
  rb-fsevent (0.11.2)
151
170
  rb-inotify (0.10.1)
152
171
  ffi (~> 1.0)
153
- rdoc (6.5.0)
172
+ rdoc (6.6.0)
154
173
  psych (>= 4.0.0)
155
- regexp_parser (2.8.1)
156
- reline (0.3.8)
174
+ regexp_parser (2.8.2)
175
+ reline (0.4.0)
157
176
  io-console (~> 0.5)
158
177
  rest-client (2.1.0)
159
178
  http-accept (>= 1.7.0, < 2.0)
@@ -175,25 +194,25 @@ GEM
175
194
  diff-lcs (>= 1.2.0, < 2.0)
176
195
  rspec-support (~> 3.12.0)
177
196
  rspec-support (3.12.1)
178
- rubocop (1.56.4)
179
- base64 (~> 0.1.1)
197
+ rubocop (1.57.2)
180
198
  json (~> 2.3)
181
199
  language_server-protocol (>= 3.17.0)
182
200
  parallel (~> 1.10)
183
- parser (>= 3.2.2.3)
201
+ parser (>= 3.2.2.4)
184
202
  rainbow (>= 2.2.2, < 4.0)
185
203
  regexp_parser (>= 1.8, < 3.0)
186
204
  rexml (>= 3.2.5, < 4.0)
187
205
  rubocop-ast (>= 1.28.1, < 2.0)
188
206
  ruby-progressbar (~> 1.7)
189
207
  unicode-display_width (>= 2.4.0, < 3.0)
190
- rubocop-ast (1.29.0)
208
+ rubocop-ast (1.30.0)
191
209
  parser (>= 3.2.1.0)
192
- rubocop-rails (2.21.2)
210
+ rubocop-rails (2.22.1)
193
211
  activesupport (>= 4.2.0)
194
212
  rack (>= 1.1)
195
213
  rubocop (>= 1.33.0, < 2.0)
196
214
  ruby-progressbar (1.13.0)
215
+ ruby2_keywords (0.0.5)
197
216
  shellany (0.0.1)
198
217
  simplecov (0.22.0)
199
218
  docile (~> 1.1)
@@ -204,12 +223,12 @@ GEM
204
223
  simplecov (~> 0.19)
205
224
  simplecov-html (0.12.3)
206
225
  simplecov_json_formatter (0.1.4)
207
- stringio (3.0.8)
226
+ stringio (3.0.9)
208
227
  sync (0.5.0)
209
228
  term-ansicolor (1.7.1)
210
229
  tins (~> 1.0)
211
230
  terminal-notifier-guard (1.7.0)
212
- thor (1.2.2)
231
+ thor (1.3.0)
213
232
  timecop (0.9.8)
214
233
  tins (1.32.1)
215
234
  sync
@@ -217,13 +236,14 @@ GEM
217
236
  concurrent-ruby (~> 1.0)
218
237
  unf (0.1.4)
219
238
  unf_ext
220
- unf_ext (0.0.8.2)
239
+ unf_ext (0.0.9)
221
240
  unicode-display_width (2.5.0)
222
241
  vcr (6.2.0)
223
242
  webmock (3.19.1)
224
243
  addressable (>= 2.8.0)
225
244
  crack (>= 0.3.2)
226
245
  hashdiff (>= 0.4.0, < 2.0.0)
246
+ webrick (1.8.1)
227
247
  zache (0.13.1)
228
248
  zeitwerk (2.6.12)
229
249
 
@@ -31,7 +31,8 @@ module Auth0
31
31
  request_params = {
32
32
  grant_type: 'client_credentials',
33
33
  client_id: client_id,
34
- audience: audience
34
+ audience: audience,
35
+ organization: organization
35
36
  }
36
37
 
37
38
  populate_client_assertion_or_secret(request_params, client_id: client_id, client_secret: client_secret)
@@ -11,13 +11,15 @@ module Auth0
11
11
  # @param audience [string] The audience of the client grant to retrieve.
12
12
  # @param page [int] Page number to get, 0-based.
13
13
  # @param per_page [int] Results per page if also passing a page number.
14
+ # @param allow_any_organization [bool] Optional filter on allow_any_organization.
14
15
  # @return [json] Returns the client grants.
15
- def client_grants (client_id: nil, audience: nil, page: nil, per_page: nil)
16
+ def client_grants (client_id: nil, audience: nil, page: nil, per_page: nil, allow_any_organization: nil)
16
17
  request_params = {
17
18
  client_id: client_id,
18
19
  audience: audience,
19
20
  page: page,
20
- per_page: per_page
21
+ per_page: per_page,
22
+ allow_any_organization: allow_any_organization
21
23
  }
22
24
  get(client_grants_path, request_params)
23
25
  end
@@ -54,6 +56,29 @@ module Auth0
54
56
  end
55
57
  alias update_client_grant patch_client_grant
56
58
 
59
+
60
+ # Get the organizations associated to a client grant.
61
+ # @param id [string] The client_grant_id of the client grant.
62
+ # @param options [hash] The Hash options used to define the paging of results
63
+ # * :per_page [integer] The amount of entries per page. Default: 50. Max value: 100.
64
+ # * :page [integer] The page number. Zero based.
65
+ # * :from [string] For checkpoint pagination, the ID from which to start selection from.
66
+ # * :take [integer] For checkpoint pagination, the number of entries to retrieve. Default is 50.
67
+ # * :include_totals [boolean] True to include query summary in the result, false or nil otherwise.
68
+ # @return [json] Returns the organizations.
69
+ def get_client_grants_organizations(client_grant_id, options = {})
70
+ raise Auth0::InvalidParameter, 'Must specify a client grant id' if client_grant_id.to_s.empty?
71
+ request_params = {
72
+ per_page: options.fetch(:per_page, nil),
73
+ page: options.fetch(:page, nil),
74
+ from: options.fetch(:from, nil),
75
+ take: options.fetch(:take, nil),
76
+ include_totals: options.fetch(:include_totals, nil)
77
+ }
78
+ path = "#{client_grants_path}/#{client_grant_id}/organizations"
79
+ get(path, request_params)
80
+ end
81
+
57
82
  private
58
83
 
59
84
  # Client Grants API path
@@ -214,6 +214,8 @@ module Auth0
214
214
  ### Organization Member
215
215
 
216
216
  # Get Members in a Organization
217
+ # Member roles are not sent by default. Use `fields=roles` to retrieve the roles assigned to each listed member.
218
+ # To use this parameter, you must include the `read:organization_member_roles scope` in the token.
217
219
  # @see https://auth0.com/docs/api/management/v2/#!/Organizations/get_members
218
220
  # @param organization_id [string] The Organization ID
219
221
  # @param options [hash] The Hash options used to define the paging of rersults
@@ -222,6 +224,8 @@ module Auth0
222
224
  # * :from [string] For checkpoint pagination, the ID from which to start selection from.
223
225
  # * :take [integer] For checkpoint pagination, the number of entries to retrieve. Default is 50.
224
226
  # * :include_totals [boolean] True to include query summary in the result, false or nil otherwise.
227
+ # * :fields [string] A comma separated list of fields to include or exclude from the result. If fields is left blank, all fields (except roles) are returned.
228
+ # * :include_fields [boolean] True if the fields specified are to be included in the result, false otherwise.
225
229
  #
226
230
  # @return [json] Returns the members for the given organization
227
231
  def get_organizations_members(organization_id, options = {})
@@ -231,7 +235,9 @@ module Auth0
231
235
  page: options.fetch(:page, nil),
232
236
  from: options.fetch(:from, nil),
233
237
  take: options.fetch(:take, nil),
234
- include_totals: options.fetch(:include_totals, nil)
238
+ include_totals: options.fetch(:include_totals, nil),
239
+ fields: options.fetch(:fields, nil),
240
+ include_fields: options.fetch(:include_fields, nil)
235
241
  }
236
242
  path = "#{organizations_members_path(organization_id)}"
237
243
  get(path, request_params)
@@ -324,6 +330,52 @@ module Auth0
324
330
  end
325
331
  alias remove_organizations_member_roles delete_organizations_member_roles
326
332
 
333
+ # Get client grants associated to an organization
334
+ # @param organization_id [string] The Organization ID
335
+ # @param options [hash] The Hash options used to define the paging of results
336
+ # * :client_id [string] The client_id of the client grant to retrieve.
337
+ # * :audience [string] The audience of the client grant to retrieve.
338
+ # * :per_page [integer] The amount of entries per page. Default: 50. Max value: 100.
339
+ # * :page [integer] The page number. Zero based.
340
+ # * :include_totals [boolean] True to include query summary in the result, false or nil otherwise.
341
+ def get_organizations_client_grants(organization_id, options= {})
342
+ raise Auth0::MissingOrganizationId, 'Must supply a valid organization_id' if organization_id.to_s.empty?
343
+ request_params = {
344
+ client_id: options.fetch(:client_id, nil),
345
+ audience: options.fetch(:audience, nil),
346
+ per_page: options.fetch(:per_page, nil),
347
+ page: options.fetch(:page, nil),
348
+ include_totals: options.fetch(:include_totals, nil)
349
+ }
350
+ path = "#{organizations_client_grants_path(organization_id)}"
351
+ get(path, request_params)
352
+ end
353
+
354
+ # Associate a client grant with an organization
355
+ # @param organization_id [string] The Organization ID
356
+ # @param grant_id [string] The Client Grant ID you want to associate to the Organization.
357
+ def create_organizations_client_grant(organization_id, grant_id)
358
+ raise Auth0::MissingOrganizationId, 'Must supply a valid organization_id' if organization_id.to_s.empty?
359
+ raise Auth0::InvalidParameter, 'Must supply a valid grant_id' if grant_id.to_s.empty?
360
+
361
+ body = {}
362
+ body[:grant_id] = grant_id
363
+
364
+ path = "#{organizations_client_grants_path(organization_id)}"
365
+ post(path, body)
366
+ end
367
+
368
+ # Remove a client grant from an organization
369
+ # @param organization_id [string] The Organization ID
370
+ # @param grant_id [string] The Client Grant ID you want to remove from the Organization.
371
+ def delete_organizations_client_grant(organization_id, grant_id)
372
+ raise Auth0::MissingOrganizationId, 'Must supply a valid organization_id' if organization_id.to_s.empty?
373
+ raise Auth0::InvalidParameter, 'Must supply a valid grant_id' if grant_id.to_s.empty?
374
+
375
+ path = "#{organizations_path}/#{organization_id}/client-grants/#{grant_id}"
376
+ delete(path)
377
+ end
378
+
327
379
  private
328
380
  # Organizations API path
329
381
  def organizations_path
@@ -345,6 +397,10 @@ module Auth0
345
397
  def organizations_invitations_path(org_id)
346
398
  "#{organizations_path}/#{org_id}/invitations"
347
399
  end
400
+
401
+ def organizations_client_grants_path(org_id)
402
+ "#{organizations_path}/#{org_id}/client-grants"
403
+ end
348
404
  end
349
405
  end
350
406
  end
data/lib/auth0/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  # current version of gem
2
2
  module Auth0
3
- VERSION = '5.14.2'.freeze
3
+ VERSION = '5.16.0'.freeze
4
4
  end
@@ -56,6 +56,7 @@ describe Auth0::Api::AuthenticationEndpoints do
56
56
  grant_type: 'client_credentials',
57
57
  client_id: client_id,
58
58
  audience: api_identifier,
59
+ organization: nil,
59
60
  client_secret: client_secret
60
61
  }.to_json
61
62
  ))
@@ -74,6 +75,33 @@ describe Auth0::Api::AuthenticationEndpoints do
74
75
  expect(result.expires_in).not_to be_nil
75
76
  end
76
77
 
78
+ it 'requests a new token using organization' do
79
+ expect(RestClient::Request).to receive(:execute).with(hash_including(
80
+ method: :post,
81
+ url: 'https://samples.auth0.com/oauth/token',
82
+ payload: {
83
+ grant_type: 'client_credentials',
84
+ client_id: client_id,
85
+ audience: api_identifier,
86
+ organization: 'foo',
87
+ client_secret: client_secret
88
+ }.to_json
89
+ ))
90
+ .and_return(StubResponse.new({
91
+ "access_token" => "test_response",
92
+ "expires_in" => 86400,
93
+ "scope" => "scope"},
94
+ true,
95
+ 200))
96
+
97
+ result = client_secret_instance.send :api_token, audience: api_identifier, organization: 'foo'
98
+
99
+ expect(result).to be_a_kind_of(Auth0::ApiToken)
100
+ expect(result.access_token).not_to be_nil
101
+ expect(result.scope).not_to be_nil
102
+ expect(result.expires_in).not_to be_nil
103
+ end
104
+
77
105
  it 'requests a new token using client_assertion' do
78
106
  expect(RestClient::Request).to receive(:execute) do |arg|
79
107
  expect(arg).to match(
@@ -14,6 +14,7 @@ describe Auth0::Api::V2::ClientGrants do
14
14
  expect(@instance).to receive(:get).with(
15
15
  '/api/v2/client-grants', {
16
16
  client_id: nil,
17
+ allow_any_organization: nil,
17
18
  audience: nil,
18
19
  page: nil,
19
20
  per_page: nil
@@ -27,6 +28,7 @@ describe Auth0::Api::V2::ClientGrants do
27
28
  expect(@instance).to receive(:get).with(
28
29
  '/api/v2/client-grants', {
29
30
  client_id: '1',
31
+ allow_any_organization: nil,
30
32
  audience: audience,
31
33
  page: nil,
32
34
  per_page: nil
@@ -38,12 +40,25 @@ describe Auth0::Api::V2::ClientGrants do
38
40
  expect(@instance).to receive(:get).with(
39
41
  '/api/v2/client-grants', {
40
42
  client_id: nil,
43
+ allow_any_organization: nil,
41
44
  audience: nil,
42
45
  page: 1,
43
46
  per_page: 2
44
47
  })
45
48
  expect { @instance.client_grants(page: 1, per_page: 2) }.not_to raise_error
46
49
  end
50
+
51
+ it 'is expected to send get /api/v2/client-grants/ with allow_any_organization' do
52
+ expect(@instance).to receive(:get).with(
53
+ '/api/v2/client-grants', {
54
+ client_id: nil,
55
+ allow_any_organization: true,
56
+ audience: nil,
57
+ page: nil,
58
+ per_page: nil
59
+ })
60
+ expect { @instance.client_grants(allow_any_organization: true) }.not_to raise_error
61
+ end
47
62
  end
48
63
 
49
64
  context '.create_client_grant' do
@@ -73,4 +88,19 @@ describe Auth0::Api::V2::ClientGrants do
73
88
  it { expect { @instance.patch_client_grant('', nil) }.to raise_error 'Must specify a client grant id' }
74
89
  it { expect { @instance.patch_client_grant('some', nil) }.to raise_error 'Must specify a valid body' }
75
90
  end
91
+
92
+ context '.get_client_grants_organizations' do
93
+ it { expect(@instance).to respond_to(:get_client_grants_organizations) }
94
+ it 'is expected to send get to /api/v2/client-grants/organizations' do
95
+ expect(@instance).to receive(:get).with('/api/v2/client-grants/1/organizations', {
96
+ per_page: nil,
97
+ page: nil,
98
+ from: nil,
99
+ take: nil,
100
+ include_totals: nil
101
+ })
102
+ expect { @instance.get_client_grants_organizations('1') }.not_to raise_error
103
+ end
104
+ it { expect { @instance.get_client_grants_organizations('') }.to raise_error 'Must specify a client grant id' }
105
+ end
76
106
  end
@@ -451,7 +451,9 @@ describe Auth0::Api::V2::Organizations do
451
451
  page: nil,
452
452
  from: nil,
453
453
  take: nil,
454
- include_totals: nil
454
+ include_totals: nil,
455
+ fields: nil,
456
+ include_fields: nil
455
457
  })
456
458
  expect do
457
459
  @instance.get_organizations_members('org_id')
@@ -465,7 +467,9 @@ describe Auth0::Api::V2::Organizations do
465
467
  page: 1,
466
468
  from: 'org_id',
467
469
  take: 50,
468
- include_totals: true
470
+ include_totals: true,
471
+ fields: nil,
472
+ include_fields: nil
469
473
  })
470
474
  expect do
471
475
  @instance.get_organizations_members(
@@ -478,6 +482,26 @@ describe Auth0::Api::V2::Organizations do
478
482
  )
479
483
  end.not_to raise_error
480
484
  end
485
+
486
+ it 'is expected to get /api/v2/organizations with custom fields' do
487
+ expect(@instance).to receive(:get).with(
488
+ '/api/v2/organizations/org_id/members', {
489
+ per_page: nil,
490
+ page: nil,
491
+ from: nil,
492
+ take: nil,
493
+ include_totals: nil,
494
+ fields: 'foo,bar',
495
+ include_fields: false
496
+ })
497
+ expect do
498
+ @instance.get_organizations_members(
499
+ 'org_id',
500
+ fields: 'foo,bar',
501
+ include_fields: false
502
+ )
503
+ end.not_to raise_error
504
+ end
481
505
  end
482
506
 
483
507
  context '.create_organizations_members' do
@@ -615,4 +639,70 @@ describe Auth0::Api::V2::Organizations do
615
639
  expect { @instance.delete_organizations_member_roles('org_id', 'user_id') }.to raise_error 'Must supply an array of role ids'
616
640
  end
617
641
  end
642
+
643
+ context '.get_organizations_client_grants' do
644
+ it 'is expected to respond to a get_organizations_client_grants method' do
645
+ expect(@instance).to respond_to(:get_organizations_client_grants)
646
+ end
647
+
648
+ it 'is expected to get /api/v2/organizations/org_id/client-grants' do
649
+ expect(@instance).to receive(:get).with(
650
+ '/api/v2/organizations/org_id/client-grants', {
651
+ per_page: nil,
652
+ page: nil,
653
+ client_id: nil,
654
+ audience: nil,
655
+ include_totals: nil
656
+ })
657
+ expect { @instance.get_organizations_client_grants('org_id') }.not_to raise_error
658
+ end
659
+
660
+ it 'is expected to get /api/v2/organizations/org_id/client-grants with custom parameters' do
661
+ expect(@instance).to receive(:get).with(
662
+ '/api/v2/organizations/org_id/client-grants', {
663
+ per_page: 10,
664
+ page: 1,
665
+ client_id: 'client_id',
666
+ audience: 'api',
667
+ include_totals: true
668
+ })
669
+ expect do
670
+ @instance.get_organizations_client_grants(
671
+ 'org_id',
672
+ per_page: 10,
673
+ page: 1,
674
+ client_id: 'client_id',
675
+ audience: 'api',
676
+ include_totals: true
677
+ )
678
+ end.not_to raise_error
679
+ end
680
+ end
681
+
682
+ context '.create_organizations_client_grants' do
683
+ it 'is expected to respond to a create_organizations_client_grants method' do
684
+ expect(@instance).to respond_to(:create_organizations_client_grant)
685
+ end
686
+
687
+ it 'is expected to post /api/v2/organizations/org_id/client-grants' do
688
+ expect(@instance).to receive(:post).with(
689
+ '/api/v2/organizations/org_id/client-grants', {
690
+ grant_id: 'grant_id'
691
+ })
692
+ expect { @instance.create_organizations_client_grant('org_id', 'grant_id') }.not_to raise_error
693
+ end
694
+ end
695
+
696
+ context '.delete_organizations_client_grant' do
697
+ it 'is expected to respond to a delete_organizations_client_grant method' do
698
+ expect(@instance).to respond_to(:delete_organizations_client_grant)
699
+ end
700
+
701
+ it 'is expected to delete /api/v2/organizations/org_id/client-grants' do
702
+ expect(@instance).to receive(:delete).with(
703
+ '/api/v2/organizations/org_id/client-grants/grant_id')
704
+ expect { @instance.delete_organizations_client_grant('org_id', 'grant_id') }.not_to raise_error
705
+ end
706
+ end
707
+
618
708
  end
@@ -64,7 +64,8 @@ describe Auth0::Mixins::Initializer do
64
64
  grant_type: 'client_credentials',
65
65
  client_id: client_id,
66
66
  client_secret: client_secret,
67
- audience: api_identifier
67
+ audience: api_identifier,
68
+ organization: nil
68
69
  }
69
70
 
70
71
  expect(RestClient::Request).to receive(:execute) do |arg|
@@ -11,7 +11,8 @@ describe Auth0::Mixins::TokenManagement do
11
11
  grant_type: 'client_credentials',
12
12
  client_id: client_id,
13
13
  client_secret: client_secret,
14
- audience: api_identifier
14
+ audience: api_identifier,
15
+ organization: nil
15
16
  } }
16
17
 
17
18
  let(:params) { {
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: auth0
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.14.2
4
+ version: 5.16.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Auth0
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2023-10-03 00:00:00.000000000 Z
14
+ date: 2023-11-13 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: rest-client
@@ -203,7 +203,6 @@ extensions: []
203
203
  extra_rdoc_files: []
204
204
  files:
205
205
  - ".bundle/config"
206
- - ".circleci/config.yml"
207
206
  - ".devcontainer/Dockerfile"
208
207
  - ".devcontainer/devcontainer.json"
209
208
  - ".env.example"
data/.circleci/config.yml DELETED
@@ -1,60 +0,0 @@
1
- version: 2.1
2
- orbs:
3
- ship: auth0/ship@0
4
- codecov: codecov/codecov@3
5
-
6
- matrix_ruby_versions: &matrix_ruby_versions
7
- matrix:
8
- parameters:
9
- ruby_version: ["3.0", "3.1", "3.2"]
10
- # Default version of ruby to use for lint and publishing
11
- default_ruby_version: &default_ruby_version "3.2"
12
-
13
- executors:
14
- ruby-image:
15
- parameters:
16
- ruby_version:
17
- type: string
18
- default: *default_ruby_version
19
- docker:
20
- - image: cimg/ruby:<< parameters.ruby_version >>
21
-
22
- jobs:
23
- run-tests:
24
- parameters:
25
- ruby_version:
26
- type: string
27
- default: *default_ruby_version
28
- executor:
29
- name: ruby-image
30
- ruby_version: << parameters.ruby_version >>
31
- steps:
32
- - checkout
33
- - run: gem install bundler:2.3.22
34
- - restore_cache:
35
- key: gems-v2-{{ checksum "Gemfile.lock" }}
36
- - run: bundle check --path=vendor/bundle || bundle install --path=vendor/bundle
37
- - save_cache:
38
- key: gems-v2-{{ checksum "Gemfile.lock" }}
39
- paths:
40
- - vendor/bundle
41
- # Must define DOMAIN, CLIENT_ID, CLIENT_SECRET and MASTER_JWT env
42
- - run: bundle exec rake test
43
- - codecov/upload:
44
- file: /home/circleci/project/coverage/coverage.xml
45
-
46
- workflows:
47
- tests:
48
- jobs:
49
- - run-tests:
50
- <<: *matrix_ruby_versions
51
- - ship/ruby-publish:
52
- context:
53
- - publish-rubygems
54
- - publish-gh
55
- filters:
56
- branches:
57
- only:
58
- - master
59
- requires:
60
- - run-tests