auth0 5.10.0 → 5.13.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -34,16 +34,21 @@ describe Auth0::Mixins::TokenManagement do
34
34
 
35
35
  context 'get_token' do
36
36
  it 'renews the token if there is no token set' do
37
- expect(RestClient::Request).to receive(:execute).with(hash_including(
38
- method: :post,
39
- url: 'https://samples.auth0.com/oauth/token',
40
- payload: payload.to_json
41
- ))
42
- .and_return(StubResponse.new({
43
- "access_token" => "test",
44
- "expires_in" => 86400},
45
- true,
46
- 200))
37
+ expect(RestClient::Request).to receive(:execute) do |arg|
38
+ expect(arg).to(match(
39
+ include(
40
+ method: :post,
41
+ url: 'https://samples.auth0.com/oauth/token'
42
+ )))
43
+
44
+ expect(JSON.parse(arg[:payload], { symbolize_names: true })).to eq(payload)
45
+
46
+ StubResponse.new({
47
+ "access_token" => "test",
48
+ "expires_in" => 86400},
49
+ true,
50
+ 200)
51
+ end
47
52
 
48
53
  instance.send(:get_token)
49
54
 
@@ -70,16 +75,21 @@ describe Auth0::Mixins::TokenManagement do
70
75
  params[:token] = 'test-token'
71
76
  params[:token_expires_at] = time_now.to_i + 5
72
77
 
73
- expect(RestClient::Request).to receive(:execute).with(hash_including(
74
- method: :post,
75
- url: 'https://samples.auth0.com/oauth/token',
76
- payload: payload.to_json
77
- ))
78
- .and_return(StubResponse.new({
79
- "access_token" => "renewed_token",
80
- "expires_in" => 86400},
81
- true,
82
- 200))
78
+ expect(RestClient::Request).to receive(:execute) do |arg|
79
+ expect(arg).to(match(
80
+ include(
81
+ method: :post,
82
+ url: 'https://samples.auth0.com/oauth/token'
83
+ )))
84
+
85
+ expect(JSON.parse(arg[:payload], { symbolize_names: true })).to eq(payload)
86
+
87
+ StubResponse.new({
88
+ "access_token" => "renewed_token",
89
+ "expires_in" => 86400},
90
+ true,
91
+ 200)
92
+ end
83
93
 
84
94
  instance.send(:get_token)
85
95
 
@@ -91,16 +101,21 @@ describe Auth0::Mixins::TokenManagement do
91
101
  params[:token] = 'test-token'
92
102
  params[:token_expires_at] = time_now.to_i - 10
93
103
 
94
- expect(RestClient::Request).to receive(:execute).with(hash_including(
95
- method: :post,
96
- url: 'https://samples.auth0.com/oauth/token',
97
- payload: payload.to_json
98
- ))
99
- .and_return(StubResponse.new({
100
- "access_token" => "renewed_token",
101
- "expires_in" => 86400},
102
- true,
103
- 200))
104
+ expect(RestClient::Request).to receive(:execute) do |arg|
105
+ expect(arg).to(match(
106
+ include(
107
+ method: :post,
108
+ url: 'https://samples.auth0.com/oauth/token'
109
+ )))
110
+
111
+ expect(JSON.parse(arg[:payload], { symbolize_names: true })).to eq(payload)
112
+
113
+ StubResponse.new({
114
+ "access_token" => "renewed_token",
115
+ "expires_in" => 86400},
116
+ true,
117
+ 200)
118
+ end
104
119
 
105
120
  instance.send(:get_token)
106
121
 
data/spec/spec_helper.rb CHANGED
@@ -1,4 +1,3 @@
1
- require 'pry'
2
1
  require 'rack/test'
3
2
  require 'faker'
4
3
  require 'json'
@@ -13,5 +13,8 @@ class DummyClassForTokens
13
13
  @base_uri = "https://#{@domain}"
14
14
  @token = config[:token]
15
15
  @token_expires_at = config[:token_expires_at]
16
+ @client_assertion_signing_key = config[:client_assertion_signing_key]
17
+ @client_assertion_signing_alg = config[:client_assertion_signing_alg] || 'RS256'
18
+ @headers ||= {}
16
19
  end
17
20
  end
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.10.0
4
+ version: 5.13.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: 2022-10-10 00:00:00.000000000 Z
14
+ date: 2023-04-24 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: rest-client
@@ -139,34 +139,6 @@ dependencies:
139
139
  - - "~>"
140
140
  - !ruby/object:Gem::Version
141
141
  version: '2.0'
142
- - !ruby/object:Gem::Dependency
143
- name: pry
144
- requirement: !ruby/object:Gem::Requirement
145
- requirements:
146
- - - "~>"
147
- - !ruby/object:Gem::Version
148
- version: '0.10'
149
- type: :development
150
- prerelease: false
151
- version_requirements: !ruby/object:Gem::Requirement
152
- requirements:
153
- - - "~>"
154
- - !ruby/object:Gem::Version
155
- version: '0.10'
156
- - !ruby/object:Gem::Dependency
157
- name: pry-nav
158
- requirement: !ruby/object:Gem::Requirement
159
- requirements:
160
- - - "~>"
161
- - !ruby/object:Gem::Version
162
- version: '0.2'
163
- type: :development
164
- prerelease: false
165
- version_requirements: !ruby/object:Gem::Requirement
166
- requirements:
167
- - - "~>"
168
- - !ruby/object:Gem::Version
169
- version: '0.2'
170
142
  - !ruby/object:Gem::Dependency
171
143
  name: rspec
172
144
  requirement: !ruby/object:Gem::Requirement
@@ -276,11 +248,14 @@ files:
276
248
  - ".rspec"
277
249
  - ".rubocop.yml"
278
250
  - ".rubocop_todo.yml"
251
+ - ".semgrepignore"
279
252
  - ".shiprc"
280
253
  - CHANGELOG.md
281
254
  - CODE_OF_CONDUCT.md
282
255
  - DEPLOYMENT.md
256
+ - DEVELOPMENT.md
283
257
  - Dockerfile
258
+ - EXAMPLES.md
284
259
  - Gemfile
285
260
  - Gemfile.lock
286
261
  - Guardfile
@@ -389,6 +364,7 @@ files:
389
364
  - lib/auth0/api/v2/users.rb
390
365
  - lib/auth0/api/v2/users_by_email.rb
391
366
  - lib/auth0/client.rb
367
+ - lib/auth0/client_assertion.rb
392
368
  - lib/auth0/exception.rb
393
369
  - lib/auth0/mixins.rb
394
370
  - lib/auth0/mixins/access_token_struct.rb
@@ -401,6 +377,7 @@ files:
401
377
  - lib/auth0/mixins/validation.rb
402
378
  - lib/auth0/version.rb
403
379
  - lib/auth0_client.rb
380
+ - opslevel.yml
404
381
  - publish_rubygem.sh
405
382
  - spec/fixtures/vcr_cassettes/Auth0_Api_AuthenticationEndpoints/_change_password/should_trigger_a_password_reset.yml
406
383
  - spec/fixtures/vcr_cassettes/Auth0_Api_AuthenticationEndpoints/_login_with_resource_owner/should_fail_with_an_incorrect_email.yml
@@ -579,6 +556,7 @@ files:
579
556
  - spec/integration/lib/auth0/api/v2/api_user_blocks_spec.rb
580
557
  - spec/integration/lib/auth0/api/v2/api_users_spec.rb
581
558
  - spec/integration/lib/auth0/auth0_client_spec.rb
559
+ - spec/lib/auth0/api/authentication_endpoints_spec.rb
582
560
  - spec/lib/auth0/api/v2/actions_spec.rb
583
561
  - spec/lib/auth0/api/v2/anomaly_spec.rb
584
562
  - spec/lib/auth0/api/v2/attack_protection_spec.rb
@@ -637,7 +615,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
637
615
  - !ruby/object:Gem::Version
638
616
  version: '0'
639
617
  requirements: []
640
- rubygems_version: 3.3.11
618
+ rubygems_version: 3.4.10
641
619
  signing_key:
642
620
  specification_version: 4
643
621
  summary: Auth0 API Client