Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,17 @@ jobs:
strategy:
matrix:
ruby:
- '3.2.1'

- '3.3.3'
services:
redis:
image: redis:7
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 6379:6379
steps:
- uses: actions/checkout@v3
- name: Update
Expand Down
2 changes: 1 addition & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ AllCops:
TargetRubyVersion: 2.6.0
NewCops: enable

require:
plugins:
- rubocop-rake

Style/Documentation:
Expand Down
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ gem 'rspec', '~> 3.0'
gem 'rubocop', '~> 1.21'
gem 'rubocop-rake'
gem 'rubocop-rspec'
gem 'rubocop-rspec_rails'
gem 'database_cleaner-redis'
127 changes: 78 additions & 49 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
token_manager (0.1.1)
token_manager (0.1.2)
activesupport
curb
jwt (~> 2.0)
Expand All @@ -10,74 +10,102 @@ PATH
GEM
remote: https://rubygems.org/
specs:
activesupport (7.0.4.3)
concurrent-ruby (~> 1.0, >= 1.0.2)
activesupport (8.1.2)
base64
bigdecimal
concurrent-ruby (~> 1.0, >= 1.3.1)
connection_pool (>= 2.2.5)
drb
i18n (>= 1.6, < 2)
json
logger (>= 1.4.2)
minitest (>= 5.1)
tzinfo (~> 2.0)
ast (2.4.2)
concurrent-ruby (1.2.2)
connection_pool (2.3.0)
curb (1.0.5)
securerandom (>= 0.3)
tzinfo (~> 2.0, >= 2.0.5)
uri (>= 0.13.1)
ast (2.4.3)
base64 (0.3.0)
bigdecimal (4.0.1)
concurrent-ruby (1.3.6)
connection_pool (3.0.2)
curb (1.2.2)
database_cleaner-core (2.0.1)
database_cleaner-redis (2.0.0)
database_cleaner-core (~> 2.0.0)
redis
diff-lcs (1.5.0)
i18n (1.12.0)
diff-lcs (1.6.2)
drb (2.2.3)
i18n (1.14.8)
concurrent-ruby (~> 1.0)
json (2.6.3)
jwt (2.7.0)
minitest (5.18.0)
parallel (1.22.1)
parser (3.2.1.1)
json (2.18.1)
jwt (2.10.2)
base64
language_server-protocol (3.17.0.5)
lint_roller (1.1.0)
logger (1.7.0)
minitest (6.0.1)
prism (~> 1.5)
parallel (1.27.0)
parser (3.3.10.1)
ast (~> 2.4.1)
racc
prism (1.9.0)
racc (1.8.1)
rainbow (3.1.1)
rake (13.0.6)
redis (5.0.6)
redis-client (>= 0.9.0)
redis-client (0.14.0)
rake (13.3.1)
redis (5.4.1)
redis-client (>= 0.22.0)
redis-client (0.26.4)
connection_pool
regexp_parser (2.7.0)
rexml (3.2.5)
rspec (3.12.0)
rspec-core (~> 3.12.0)
rspec-expectations (~> 3.12.0)
rspec-mocks (~> 3.12.0)
rspec-core (3.12.1)
rspec-support (~> 3.12.0)
rspec-expectations (3.12.2)
regexp_parser (2.11.3)
rspec (3.13.2)
rspec-core (~> 3.13.0)
rspec-expectations (~> 3.13.0)
rspec-mocks (~> 3.13.0)
rspec-core (3.13.6)
rspec-support (~> 3.13.0)
rspec-expectations (3.13.5)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.12.0)
rspec-mocks (3.12.4)
rspec-support (~> 3.13.0)
rspec-mocks (3.13.7)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.12.0)
rspec-support (3.12.0)
rubocop (1.48.1)
rspec-support (~> 3.13.0)
rspec-support (3.13.7)
rubocop (1.84.1)
json (~> 2.3)
language_server-protocol (~> 3.17.0.2)
lint_roller (~> 1.1.0)
parallel (~> 1.10)
parser (>= 3.2.0.0)
parser (>= 3.3.0.2)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0)
rexml (>= 3.2.5, < 4.0)
rubocop-ast (>= 1.26.0, < 2.0)
regexp_parser (>= 2.9.3, < 3.0)
rubocop-ast (>= 1.49.0, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 2.4.0, < 3.0)
rubocop-ast (1.27.0)
parser (>= 3.2.1.0)
rubocop-capybara (2.17.1)
rubocop (~> 1.41)
rubocop-rake (0.6.0)
rubocop (~> 1.0)
rubocop-rspec (2.19.0)
rubocop (~> 1.33)
rubocop-capybara (~> 2.17)
unicode-display_width (>= 2.4.0, < 4.0)
rubocop-ast (1.49.0)
parser (>= 3.3.7.2)
prism (~> 1.7)
rubocop-rake (0.7.1)
lint_roller (~> 1.1)
rubocop (>= 1.72.1)
rubocop-rspec (3.9.0)
lint_roller (~> 1.1)
rubocop (~> 1.81)
rubocop-rspec_rails (2.32.0)
lint_roller (~> 1.1)
rubocop (~> 1.72, >= 1.72.1)
rubocop-rspec (~> 3.5)
ruby-progressbar (1.13.0)
securerandom (0.4.1)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
unicode-display_width (2.4.2)
unicode-display_width (3.2.0)
unicode-emoji (~> 4.1)
unicode-emoji (4.2.0)
uri (1.1.1)

PLATFORMS
arm64-darwin-24
x86_64-darwin-21
x86_64-linux

Expand All @@ -88,7 +116,8 @@ DEPENDENCIES
rubocop (~> 1.21)
rubocop-rake
rubocop-rspec
rubocop-rspec_rails
token_manager!

BUNDLED WITH
2.4.8
2.5.11
4 changes: 3 additions & 1 deletion lib/token_manager.rb
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,9 @@ def retrieve_issuer_key(iss, kid)
url = @trusted_issuers.dig(iss, 'url')
raise(RetrievePublicKeyError, "Add trusted_issuers: { url: 'https://my_app.com/public_key_url' }") unless url

response = Curl.get(@trusted_issuers.dig(iss, 'url'), kid: kid)
response = Curl.get(@trusted_issuers.dig(iss, 'url'), kid: kid) do |c|
c.headers.merge!('User-Agent' => @service_name)
end
unless response.response_code.in?(200..299)
raise(RetrievePublicKeyError,
"Can't retrieve public_key from #{response.url}. Response code: #{response.response_code}")
Expand Down
2 changes: 1 addition & 1 deletion lib/token_manager/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

class TokenManager
VERSION = '0.1.1'
VERSION = '0.1.2'
end
7 changes: 4 additions & 3 deletions spec/.rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
inherit_from:
- ../.rubocop.yml

require:
plugins:
- rubocop-rspec
- rubocop-rspec_rails

RSpec/ExampleLength:
Max: 60
Expand Down Expand Up @@ -31,7 +32,7 @@ RSpec/SubjectStub:
Lint/AmbiguousBlockAssociation:
Enabled: false

RSpec/FilePath:
RSpec/SpecFilePathFormat:
Exclude:
- resources/**/*

Expand All @@ -55,7 +56,7 @@ RSpec/ExampleWording:
Style/HashSyntax:
Enabled: false

RSpec/Rails/InferredSpecType:
RSpecRails/InferredSpecType:
Enabled: false

RSpec/NoExpectationExample:
Expand Down