auth0 5.15.0 → 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 +4 -4
- data/.github/workflows/snyk.yml +4 -2
- data/.github/workflows/test.yml +1 -1
- data/CHANGELOG.md +6 -0
- data/Gemfile.lock +22 -21
- data/lib/auth0/api/authentication_endpoints.rb +2 -1
- data/lib/auth0/api/v2/client_grants.rb +27 -2
- data/lib/auth0/api/v2/organizations.rb +50 -0
- data/lib/auth0/version.rb +1 -1
- data/spec/lib/auth0/api/authentication_endpoints_spec.rb +28 -0
- data/spec/lib/auth0/api/v2/client_grants_spec.rb +30 -0
- data/spec/lib/auth0/api/v2/organizations_spec.rb +66 -0
- data/spec/lib/auth0/mixins/initializer_spec.rb +2 -1
- data/spec/lib/auth0/mixins/token_management_spec.rb +2 -1
- metadata +2 -3
- data/.circleci/config.yml +0 -60
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: '0978f1fb53fb4cf3047f12b60ae15d131a47e225f124bb74b26a508ba51c1548'
|
|
4
|
+
data.tar.gz: 37dedc6fe3b8c9cf4a8fe795d0011a73c66a7c79f4485bb72c4f722772bf2644
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1f5c2df075fd3dea61c55467c3818561f763d459aaeb66c9147849f46c0ed366777e59982438d9479f197f16770e4615bedb3872326775f0ba3782d312a5ad84
|
|
7
|
+
data.tar.gz: d65412c6bc0a4a1806eb1ff08b92503ea3c60c3e44e359b4c45cde37c715109ced81bd2aa78f726784fc1c82c45a3482aacaacbdcdf3abf58ecf070b505d3de4
|
data/.github/workflows/snyk.yml
CHANGED
|
@@ -11,7 +11,7 @@ on:
|
|
|
11
11
|
branches:
|
|
12
12
|
- master
|
|
13
13
|
schedule:
|
|
14
|
-
- cron:
|
|
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
|
-
-
|
|
45
|
+
- run: npm install -g snyk
|
|
46
|
+
|
|
47
|
+
- run: snyk test
|
|
46
48
|
env:
|
|
47
49
|
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
|
data/.github/workflows/test.yml
CHANGED
|
@@ -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,11 @@
|
|
|
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
|
+
|
|
3
9
|
## [v5.15.0](https://github.com/auth0/ruby-auth0/tree/v5.15.0) (2023-10-30)
|
|
4
10
|
[Full Changelog](https://github.com/auth0/ruby-auth0/compare/v5.14.2...v5.15.0)
|
|
5
11
|
|
data/Gemfile.lock
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
auth0 (5.
|
|
4
|
+
auth0 (5.16.0)
|
|
5
5
|
addressable (~> 2.8)
|
|
6
6
|
jwt (~> 2.7)
|
|
7
7
|
rest-client (~> 2.1)
|
|
@@ -11,22 +11,23 @@ PATH
|
|
|
11
11
|
GEM
|
|
12
12
|
remote: https://rubygems.org/
|
|
13
13
|
specs:
|
|
14
|
-
actionpack (7.1.
|
|
15
|
-
actionview (= 7.1.
|
|
16
|
-
activesupport (= 7.1.
|
|
14
|
+
actionpack (7.1.2)
|
|
15
|
+
actionview (= 7.1.2)
|
|
16
|
+
activesupport (= 7.1.2)
|
|
17
17
|
nokogiri (>= 1.8.5)
|
|
18
|
+
racc
|
|
18
19
|
rack (>= 2.2.4)
|
|
19
20
|
rack-session (>= 1.0.1)
|
|
20
21
|
rack-test (>= 0.6.3)
|
|
21
22
|
rails-dom-testing (~> 2.2)
|
|
22
23
|
rails-html-sanitizer (~> 1.6)
|
|
23
|
-
actionview (7.1.
|
|
24
|
-
activesupport (= 7.1.
|
|
24
|
+
actionview (7.1.2)
|
|
25
|
+
activesupport (= 7.1.2)
|
|
25
26
|
builder (~> 3.1)
|
|
26
27
|
erubi (~> 1.11)
|
|
27
28
|
rails-dom-testing (~> 2.2)
|
|
28
29
|
rails-html-sanitizer (~> 1.6)
|
|
29
|
-
activesupport (7.1.
|
|
30
|
+
activesupport (7.1.2)
|
|
30
31
|
base64
|
|
31
32
|
bigdecimal
|
|
32
33
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
|
@@ -39,7 +40,7 @@ GEM
|
|
|
39
40
|
addressable (2.8.5)
|
|
40
41
|
public_suffix (>= 2.0.2, < 6.0)
|
|
41
42
|
ast (2.4.2)
|
|
42
|
-
base64 (0.
|
|
43
|
+
base64 (0.2.0)
|
|
43
44
|
bigdecimal (3.1.4)
|
|
44
45
|
builder (3.2.4)
|
|
45
46
|
coderay (1.1.3)
|
|
@@ -62,7 +63,7 @@ GEM
|
|
|
62
63
|
dotenv-rails (2.8.1)
|
|
63
64
|
dotenv (= 2.8.1)
|
|
64
65
|
railties (>= 3.2)
|
|
65
|
-
drb (2.
|
|
66
|
+
drb (2.2.0)
|
|
66
67
|
ruby2_keywords
|
|
67
68
|
erubi (1.12.0)
|
|
68
69
|
faker (2.23.0)
|
|
@@ -93,7 +94,7 @@ GEM
|
|
|
93
94
|
i18n (1.14.1)
|
|
94
95
|
concurrent-ruby (~> 1.0)
|
|
95
96
|
io-console (0.6.0)
|
|
96
|
-
irb (1.
|
|
97
|
+
irb (1.9.0)
|
|
97
98
|
rdoc
|
|
98
99
|
reline (>= 0.3.8)
|
|
99
100
|
json (2.6.3)
|
|
@@ -112,7 +113,7 @@ GEM
|
|
|
112
113
|
mime-types-data (3.2023.1003)
|
|
113
114
|
minitest (5.20.0)
|
|
114
115
|
multi_json (1.15.0)
|
|
115
|
-
mutex_m (0.
|
|
116
|
+
mutex_m (0.2.0)
|
|
116
117
|
nenv (0.3.0)
|
|
117
118
|
netrc (0.11.0)
|
|
118
119
|
nokogiri (1.15.4-aarch64-linux)
|
|
@@ -130,16 +131,16 @@ GEM
|
|
|
130
131
|
parser (3.2.2.4)
|
|
131
132
|
ast (~> 2.4.1)
|
|
132
133
|
racc
|
|
133
|
-
pp (0.
|
|
134
|
+
pp (0.5.0)
|
|
134
135
|
prettyprint
|
|
135
|
-
prettyprint (0.
|
|
136
|
+
prettyprint (0.2.0)
|
|
136
137
|
pry (0.14.2)
|
|
137
138
|
coderay (~> 1.1)
|
|
138
139
|
method_source (~> 1.0)
|
|
139
140
|
psych (5.1.1.1)
|
|
140
141
|
stringio
|
|
141
142
|
public_suffix (5.0.3)
|
|
142
|
-
racc (1.7.
|
|
143
|
+
racc (1.7.3)
|
|
143
144
|
rack (3.0.8)
|
|
144
145
|
rack-session (2.0.0)
|
|
145
146
|
rack (>= 3.0.0)
|
|
@@ -155,9 +156,9 @@ GEM
|
|
|
155
156
|
rails-html-sanitizer (1.6.0)
|
|
156
157
|
loofah (~> 2.21)
|
|
157
158
|
nokogiri (~> 1.14)
|
|
158
|
-
railties (7.1.
|
|
159
|
-
actionpack (= 7.1.
|
|
160
|
-
activesupport (= 7.1.
|
|
159
|
+
railties (7.1.2)
|
|
160
|
+
actionpack (= 7.1.2)
|
|
161
|
+
activesupport (= 7.1.2)
|
|
161
162
|
irb
|
|
162
163
|
rackup (>= 1.0.0)
|
|
163
164
|
rake (>= 12.2)
|
|
@@ -168,10 +169,10 @@ GEM
|
|
|
168
169
|
rb-fsevent (0.11.2)
|
|
169
170
|
rb-inotify (0.10.1)
|
|
170
171
|
ffi (~> 1.0)
|
|
171
|
-
rdoc (6.
|
|
172
|
+
rdoc (6.6.0)
|
|
172
173
|
psych (>= 4.0.0)
|
|
173
174
|
regexp_parser (2.8.2)
|
|
174
|
-
reline (0.
|
|
175
|
+
reline (0.4.0)
|
|
175
176
|
io-console (~> 0.5)
|
|
176
177
|
rest-client (2.1.0)
|
|
177
178
|
http-accept (>= 1.7.0, < 2.0)
|
|
@@ -222,7 +223,7 @@ GEM
|
|
|
222
223
|
simplecov (~> 0.19)
|
|
223
224
|
simplecov-html (0.12.3)
|
|
224
225
|
simplecov_json_formatter (0.1.4)
|
|
225
|
-
stringio (3.0.
|
|
226
|
+
stringio (3.0.9)
|
|
226
227
|
sync (0.5.0)
|
|
227
228
|
term-ansicolor (1.7.1)
|
|
228
229
|
tins (~> 1.0)
|
|
@@ -235,7 +236,7 @@ GEM
|
|
|
235
236
|
concurrent-ruby (~> 1.0)
|
|
236
237
|
unf (0.1.4)
|
|
237
238
|
unf_ext
|
|
238
|
-
unf_ext (0.0.
|
|
239
|
+
unf_ext (0.0.9)
|
|
239
240
|
unicode-display_width (2.5.0)
|
|
240
241
|
vcr (6.2.0)
|
|
241
242
|
webmock (3.19.1)
|
|
@@ -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
|
|
@@ -330,6 +330,52 @@ module Auth0
|
|
|
330
330
|
end
|
|
331
331
|
alias remove_organizations_member_roles delete_organizations_member_roles
|
|
332
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
|
+
|
|
333
379
|
private
|
|
334
380
|
# Organizations API path
|
|
335
381
|
def organizations_path
|
|
@@ -351,6 +397,10 @@ module Auth0
|
|
|
351
397
|
def organizations_invitations_path(org_id)
|
|
352
398
|
"#{organizations_path}/#{org_id}/invitations"
|
|
353
399
|
end
|
|
400
|
+
|
|
401
|
+
def organizations_client_grants_path(org_id)
|
|
402
|
+
"#{organizations_path}/#{org_id}/client-grants"
|
|
403
|
+
end
|
|
354
404
|
end
|
|
355
405
|
end
|
|
356
406
|
end
|
data/lib/auth0/version.rb
CHANGED
|
@@ -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
|
|
@@ -639,4 +639,70 @@ describe Auth0::Api::V2::Organizations do
|
|
|
639
639
|
expect { @instance.delete_organizations_member_roles('org_id', 'user_id') }.to raise_error 'Must supply an array of role ids'
|
|
640
640
|
end
|
|
641
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
|
+
|
|
642
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|
|
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.
|
|
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-
|
|
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
|