Skip to content

Commit

Permalink
Merge pull request #20 from carabao-capital/1.0.0-rc.10
Browse files Browse the repository at this point in the history
1.0.0-rc.10
  • Loading branch information
itsmechlark authored May 26, 2022
2 parents fcba02a + 45cef48 commit e37cf20
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 8 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [1.0.0-rc.10] - 2022-05-26
### Changed
- Improved caching of requests to Auth0.

## [1.0.0-rc.9] - 2022-05-25
### Fixed
- Loading user's permissions above 100 limit.
Expand Down
11 changes: 7 additions & 4 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,12 @@ GIT
PATH
remote: .
specs:
devise-auth0 (1.0.0.rc9)
devise-auth0 (1.0.0.rc10)
auth0 (~> 5.6)
devise (~> 4.8)
dry-configurable (~> 0.13)
faraday (~> 1.10.0)
faraday-http-cache
jwt (~> 2.3)
mail
net-smtp
Expand Down Expand Up @@ -157,6 +158,8 @@ GEM
faraday-em_http (1.0.0)
faraday-em_synchrony (1.0.0)
faraday-excon (1.1.0)
faraday-http-cache (2.3.0)
faraday (>= 0.8)
faraday-httpclient (1.0.1)
faraday-multipart (1.0.3)
multipart-post (>= 1.2, < 3)
Expand All @@ -170,7 +173,7 @@ GEM
hashdiff (1.0.1)
hashie (5.0.0)
http-accept (1.7.0)
http-cookie (1.0.4)
http-cookie (1.0.5)
domain_name (~> 0.5)
i18n (1.10.0)
concurrent-ruby (~> 1.0)
Expand Down Expand Up @@ -321,12 +324,12 @@ GEM
sqlite3 (1.4.2)
thor (1.2.1)
timecop (0.9.5)
timeout (0.2.0)
timeout (0.3.0)
tzinfo (2.0.4)
concurrent-ruby (~> 1.0)
unf (0.1.4)
unf_ext
unf_ext (0.0.8.1)
unf_ext (0.0.8.2)
unicode-display_width (2.1.0)
vcr (6.1.0)
warden (1.2.9)
Expand Down
1 change: 1 addition & 0 deletions devise-auth0.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ Gem::Specification.new do |s|
s.add_runtime_dependency("devise", "~> 4.8")
s.add_runtime_dependency("dry-configurable", "~> 0.13")
s.add_runtime_dependency("faraday", "~> 1.10.0")
s.add_runtime_dependency("faraday-http-cache")
s.add_runtime_dependency("jwt", "~> 2.3")
s.add_runtime_dependency("mail")
s.add_runtime_dependency("net-smtp")
Expand Down
6 changes: 5 additions & 1 deletion lib/devise/auth0/token.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# frozen_string_literal: true

require "faraday"
require "faraday/http_cache"
require "jwt"

module Devise
Expand Down Expand Up @@ -40,7 +41,9 @@ def user
"email" => "#{uid}@#{config.domain}",
}
else
client.user(auth0_id)
::Devise.auth0.cache.fetch("devise-auth0/#{auth0_id}", expires_in: ::Devise.auth0.cache_expires_in) do
client.user(auth0_id)
end
end
end

Expand Down Expand Up @@ -96,6 +99,7 @@ def issuer

def jwks_hash
conn = ::Faraday.new("https://#{config.custom_domain}") do |f|
f.use(:http_cache, store: ::Devise.auth0.cache)
f.request(:retry, max: 3)
f.adapter(::Faraday.default_adapter)
end
Expand Down
2 changes: 1 addition & 1 deletion lib/devise/auth0/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ module VERSION
MAJOR = 1
MINOR = 0
TINY = 0
PRE = "rc9"
PRE = "rc10"

STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
end
Expand Down
2 changes: 0 additions & 2 deletions spec/devise/auth0/model_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
let(:model) { auth0_user_model }
let(:user) { auth0_user }

before { Devise.auth0.cache.clear }

describe ".required_fields" do
it { expect(described_class.required_fields(model)).to(eq([])) }
end
Expand Down
1 change: 1 addition & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@
config.before do
WebMock.reset!
WebMock.disable_net_connect!
Devise.auth0.cache.clear
end

config.include(Devise::Test::ControllerHelpers, type: :controller)
Expand Down

0 comments on commit e37cf20

Please sign in to comment.