Skip to content

Commit

Permalink
Update everything
Browse files Browse the repository at this point in the history
  • Loading branch information
anakinj committed Aug 10, 2024
1 parent d9fce68 commit 39ae137
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 16 deletions.
10 changes: 6 additions & 4 deletions .github/workflows/main.yml → .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ jobs:
runs-on: ubuntu-latest
name: RuboCop
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: "3.1"
ruby-version: ruby
bundler-cache: true

- name: Run RuboCop
Expand All @@ -33,16 +33,18 @@ jobs:
- '2.7'
- '3.0'
- '3.1'
- '3.2'
- '3.3'
- head

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true

- name: Run rspec
- name: Run test
run: bundle exec rspec
7 changes: 3 additions & 4 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@

source "https://rubygems.org"

# Specify your gem's dependencies in jwk-loader.gemspec
gemspec

gem "rake", "~> 13.0"
gem "rspec", "~> 3.0"
gem "rubocop", "~> 1.32.0"
gem "rake"
gem "rspec"
gem "rubocop"
gem "simplecov"
gem "vcr"
gem "webmock"
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# JwkLoader
# jwk-loader

This gem can be used in combination with the [jwt](https://rubygems.org/gems/jwt) gem as the mechanism to load and cache the JWKs in the application.
[![Gem Version](https://badge.fury.io/rb/jwk-loader.svg)](https://badge.fury.io/rb/jwk-loader)
[![Build status](https://github.com/anakinj/jwk-loader/actions/workflows/test.yml/badge.svg)](https://github.com/anakinj/jwk-loader/actions/workflows/test.yml)

This gem can be used in combination with the [ruby-jwt](https://rubygems.org/gems/jwt) gem as the mechanism to load and cache the JWKs.

## Installation

Expand Down Expand Up @@ -34,7 +37,7 @@ RSpec.describe 'GET /protected' do
include JwkLoader::Test

context 'when called with a valid token' do
let(:token) { sign_test_token(token_payload: { user_id: 'user' }, jwk_endpoint: 'https://url/to/public/jwks') }
let(:token) { sign_test_token(token_payload: { user_id: "user" }, jwk_endpoint: "https://url/to/public/jwks") }
subject(:response) { get('/protected', { 'HTTP_AUTHORIZATION' => "Bearer #{token}" }) }

it 'is a success' do
Expand Down
2 changes: 1 addition & 1 deletion lib/jwk_loader/config/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module JwkLoader
class Config
class ConfigurationNotFound < JwkLoader::Error
def initialize(key)
super "Configuration for #{key} not available"
super("Configuration for #{key} not available")
end
end

Expand Down
4 changes: 2 additions & 2 deletions spec/jwk-loader_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
RSpec.describe JwkLoader do
describe ".configure" do
it "yields config" do
expect { |b| JwkLoader.configure(&b) }.to yield_with_args(::JwkLoader::Config)
expect { |b| JwkLoader.configure(&b) }.to yield_with_args(JwkLoader::Config)
end
end

Expand All @@ -14,7 +14,7 @@

context "when no configuration is given" do
it "returns a provider with the default configuration" do
expect(provider.cache).to be_a(::JwkLoader::MemoryCache)
expect(provider.cache).to be_a(JwkLoader::MemoryCache)
expect(provider.cache_grace_period).to eq(900)
end
end
Expand Down
2 changes: 1 addition & 1 deletion spec/jwk_loader/jwks_uri_provider_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
end

let(:token) { JWT.encode({ "pay" => "load" }, jwk.keypair, "RS512", { kid: jwk.kid }) }
let(:cache) { ::JwkLoader.cache }
let(:cache) { JwkLoader.cache }

subject(:jwks_provider) { JwkLoader.for_uri(uri: "https://www.googleapis.com/oauth2/v3/certs", cache: cache) }

Expand Down
2 changes: 1 addition & 1 deletion spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
end

config.after(:each) do
::JwkLoader.reset!
JwkLoader.reset!
end
end

Expand Down

0 comments on commit 39ae137

Please sign in to comment.