Skip to content

Commit 5e9bbda

Browse files
authored
Merge branch 'master' into fix/gemspec-packaging-reduce-false-positives
2 parents 449be1b + 693a8c1 commit 5e9bbda

8 files changed

Lines changed: 66 additions & 102 deletions

File tree

.github/workflows/semgrep.yml

Lines changed: 0 additions & 40 deletions
This file was deleted.

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,4 +66,4 @@ jobs:
6666

6767
- name: Upload coverage
6868
if: matrix.ruby == '3.2' || matrix.ruby == '3.3'
69-
uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de # pin@5.5.2
69+
uses: codecov/codecov-action@57e3a136b779b570ffcdbf80b3bdc90e7fab3de2 # pin@6.0.0

Gemfile.lock

Lines changed: 13 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ PATH
1111
GEM
1212
remote: https://rubygems.org/
1313
specs:
14-
activesupport (8.1.2)
14+
activesupport (8.1.2.1)
1515
base64
1616
bigdecimal
1717
concurrent-ruby (~> 1.0, >= 1.3.1)
@@ -24,11 +24,11 @@ GEM
2424
securerandom (>= 0.3)
2525
tzinfo (~> 2.0, >= 2.0.5)
2626
uri (>= 0.13.1)
27-
addressable (2.8.9)
27+
addressable (2.9.0)
2828
public_suffix (>= 2.0.2, < 8.0)
2929
ast (2.4.3)
3030
base64 (0.3.0)
31-
bigdecimal (4.0.1)
31+
bigdecimal (4.1.2)
3232
coderay (1.1.3)
3333
concurrent-ruby (1.3.6)
3434
connection_pool (3.0.2)
@@ -79,10 +79,7 @@ GEM
7979
i18n (1.14.8)
8080
concurrent-ruby (~> 1.0)
8181
io-console (0.8.2)
82-
json (2.19.1)
83-
json-schema (6.2.0)
84-
addressable (~> 2.8)
85-
bigdecimal (>= 3.1, < 5)
82+
json (2.19.4)
8683
jwt (2.10.2)
8784
base64
8885
language_server-protocol (3.17.0.5)
@@ -93,8 +90,6 @@ GEM
9390
rb-inotify (~> 0.9, >= 0.9.10)
9491
logger (1.7.0)
9592
lumberjack (1.4.2)
96-
mcp (0.8.0)
97-
json-schema (>= 4.1)
9893
method_source (1.1.0)
9994
mime-types (3.7.0)
10095
logger
@@ -108,8 +103,8 @@ GEM
108103
notiffany (0.1.3)
109104
nenv (~> 0.1)
110105
shellany (~> 0.0)
111-
parallel (1.27.0)
112-
parser (3.3.10.2)
106+
parallel (2.1.0)
107+
parser (3.3.11.1)
113108
ast (~> 2.4.1)
114109
racc
115110
pp (0.6.3)
@@ -122,13 +117,13 @@ GEM
122117
reline (>= 0.6.0)
123118
public_suffix (7.0.5)
124119
racc (1.8.1)
125-
rack (3.2.5)
120+
rack (3.2.6)
126121
rainbow (3.1.1)
127-
rake (13.3.1)
122+
rake (13.4.2)
128123
rb-fsevent (0.11.2)
129124
rb-inotify (0.11.1)
130125
ffi (~> 1.0)
131-
regexp_parser (2.11.3)
126+
regexp_parser (2.12.0)
132127
reline (0.6.3)
133128
io-console (~> 0.5)
134129
rest-client (2.1.0)
@@ -151,12 +146,11 @@ GEM
151146
diff-lcs (>= 1.2.0, < 2.0)
152147
rspec-support (~> 3.13.0)
153148
rspec-support (3.13.7)
154-
rubocop (1.85.1)
149+
rubocop (1.86.1)
155150
json (~> 2.3)
156151
language_server-protocol (~> 3.17.0.2)
157152
lint_roller (~> 1.1.0)
158-
mcp (~> 0.6)
159-
parallel (~> 1.10)
153+
parallel (>= 1.10)
160154
parser (>= 3.3.0.2)
161155
rainbow (>= 2.2.2, < 4.0)
162156
regexp_parser (>= 2.9.3, < 3.0)
@@ -186,15 +180,15 @@ GEM
186180
simplecov_json_formatter (0.1.4)
187181
terminal-notifier-guard (1.7.0)
188182
thor (1.5.0)
189-
timecop (0.9.10)
183+
timecop (0.9.11)
190184
tzinfo (2.0.6)
191185
concurrent-ruby (~> 1.0)
192186
unicode-display_width (3.2.0)
193187
unicode-emoji (~> 4.1)
194188
unicode-emoji (4.2.0)
195189
uri (1.1.1)
196190
vcr (6.4.0)
197-
webmock (3.26.1)
191+
webmock (3.26.2)
198192
addressable (>= 2.8.0)
199193
crack (>= 0.3.2)
200194
hashdiff (>= 0.4.0, < 2.0.0)

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,17 @@ Ruby API client for the [Auth0](https://auth0.com) platform.
1313
📚 <a href="#documentation">Documentation</a> - 🚀 <a href="#getting-started">Getting started</a> - 💻 <a href="#api-reference">API reference</a> - 💬 <a href="#feedback">Feedback</a>
1414
</div>
1515

16+
> [!NOTE]
17+
> **[v6.0.0.beta.0](https://github.com/auth0/ruby-auth0/releases/tag/v6.0.0.beta.0) is now available!** This release features a completely rewritten Management API client, auto-generated from the Auth0 OpenAPI spec using [Fern](https://buildwithfern.com/), with strongly-typed responses, built-in pagination, and automatic token management.
18+
>
19+
> ```bash
20+
> gem install auth0 --pre
21+
> ```
22+
>
23+
> We'd love your feedback - please [open an issue](https://github.com/auth0/ruby-auth0/issues/new) if you encounter any problems.
24+
>
25+
> 📖 [Migration Guide](https://github.com/auth0/ruby-auth0/blob/v6/v6_MIGRATION_GUIDE.md) ・ [Changelog](https://github.com/auth0/ruby-auth0/blob/v6/CHANGELOG.md) ・ [API Reference](https://github.com/auth0/ruby-auth0/blob/v6/reference.md)
26+
1627
## Documentation
1728
1829
- [API documentation](https://www.rubydoc.info/gems/auth0) - documentation auto-generated from the code comments that explains all the available features

examples/ruby-api/Gemfile.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ GEM
1010
nio4r (2.7.3)
1111
puma (5.6.9)
1212
nio4r (~> 2.0)
13-
rack (3.2.5)
13+
rack (3.2.6)
1414
rack-protection (4.2.0)
1515
base64 (>= 0.1.0)
1616
logger (>= 1.6.0)
1717
rack (>= 3.0.0, < 4)
18-
rack-session (2.1.1)
18+
rack-session (2.1.2)
1919
base64 (>= 0.1.0)
2020
rack (>= 3.0.0)
2121
ruby2_keywords (0.0.5)
Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,14 @@
11
module Auth0
22
module Mixins
33
module TokenManagement
4-
5-
private
6-
7-
def initialize_token(options)
8-
@token = options[:access_token] || options[:token]
9-
# default expiry to an hour if a token was given but no expires_at
10-
@token_expires_at = @token ? options[:token_expires_at] || Time.now.to_i + 3600 : nil
11-
12-
@audience = options[:api_identifier] || "https://#{@domain}/api/v2/"
13-
get_token() if @token.nil?
14-
end
154

5+
# Get the Client's api token (or generate a new one if it has expired).
6+
#
7+
# @note This method may perform a network request to refresh an expired token. It is not thread-safe.
8+
# @return [String] the api token
169
def get_token
17-
# pp @token_expires_at
1810
has_expired = @token && @token_expires_at ? @token_expires_at < (Time.now.to_i + 10) : false
19-
11+
2012
if (@token.nil? || has_expired) && @client_id && (@client_secret || @client_assertion_signing_key)
2113
response = api_token(audience: @audience)
2214
@token = response.token
@@ -27,6 +19,17 @@ def get_token
2719
@token
2820
end
2921
end
22+
23+
private
24+
25+
def initialize_token(options)
26+
@token = options[:access_token] || options[:token]
27+
# default expiry to an hour if a token was given but no expires_at
28+
@token_expires_at = @token ? options[:token_expires_at] || Time.now.to_i + 3600 : nil
29+
30+
@audience = options[:api_identifier] || "https://#{@domain}/api/v2/"
31+
get_token() if @token.nil?
32+
end
3033
end
3134
end
32-
end
35+
end

spec/lib/auth0/api/v2/users_spec.rb

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -823,10 +823,6 @@
823823
end
824824

825825
context '.user_sessions' do
826-
it 'is expected to respond to user_sessions' do
827-
expect(@instance).to respond_to :user_authentication_method
828-
end
829-
830826
it 'is expected to respond to user_sessions' do
831827
expect(@instance).to respond_to :user_sessions
832828
end

spec/lib/auth0/mixins/token_management_spec.rb

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
organization: nil
1616
} }
1717

18-
let(:params) { {
18+
let(:params) { {
1919
domain: domain,
2020
client_id: client_id,
2121
client_secret: client_secret,
@@ -43,15 +43,15 @@
4343
)))
4444

4545
expect(JSON.parse(arg[:payload], { symbolize_names: true })).to eq(payload)
46-
47-
StubResponse.new({
48-
"access_token" => "test",
49-
"expires_in" => 86400},
50-
true,
46+
47+
StubResponse.new({
48+
"access_token" => "test",
49+
"expires_in" => 86400},
50+
true,
5151
200)
5252
end
5353

54-
instance.send(:get_token)
54+
instance.get_token
5555

5656
expect(instance.instance_variable_get('@token')).to eq('test')
5757
expect(instance.instance_variable_get('@token_expires_at')).to eq(time_now.to_i + 86400)
@@ -66,7 +66,7 @@
6666
url: 'https://samples.auth0.com/oauth/token',
6767
))
6868

69-
instance.send(:get_token)
69+
instance.get_token
7070

7171
expect(instance.instance_variable_get('@token')).to eq('test-token')
7272
expect(instance.instance_variable_get('@token_expires_at')).to eq(time_now.to_i + 86400)
@@ -84,15 +84,15 @@
8484
)))
8585

8686
expect(JSON.parse(arg[:payload], { symbolize_names: true })).to eq(payload)
87-
88-
StubResponse.new({
89-
"access_token" => "renewed_token",
90-
"expires_in" => 86400},
91-
true,
87+
88+
StubResponse.new({
89+
"access_token" => "renewed_token",
90+
"expires_in" => 86400},
91+
true,
9292
200)
9393
end
9494

95-
instance.send(:get_token)
95+
instance.get_token
9696

9797
expect(instance.instance_variable_get('@token')).to eq('renewed_token')
9898
expect(instance.instance_variable_get('@token_expires_at')).to eq(time_now.to_i + 86400)
@@ -110,15 +110,15 @@
110110
)))
111111

112112
expect(JSON.parse(arg[:payload], { symbolize_names: true })).to eq(payload)
113-
114-
StubResponse.new({
115-
"access_token" => "renewed_token",
116-
"expires_in" => 86400},
117-
true,
113+
114+
StubResponse.new({
115+
"access_token" => "renewed_token",
116+
"expires_in" => 86400},
117+
true,
118118
200)
119119
end
120120

121-
instance.send(:get_token)
121+
instance.get_token
122122

123123
expect(instance.instance_variable_get('@token')).to eq('renewed_token')
124124
expect(instance.instance_variable_get('@token_expires_at')).to eq(time_now.to_i + 86400)
@@ -130,7 +130,7 @@
130130

131131
expect(RestClient::Request).not_to receive(:execute)
132132

133-
instance.send(:get_token)
133+
expect(instance.get_token).to eq('test-token')
134134
end
135135
end
136-
end
136+
end

0 commit comments

Comments
 (0)