diff --git a/.github/workflows/main.yml b/.github/workflows/test.yml similarity index 81% rename from .github/workflows/main.yml rename to .github/workflows/test.yml index 708912a..89f1a86 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/test.yml @@ -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 @@ -33,10 +33,12 @@ 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 @@ -44,5 +46,5 @@ jobs: ruby-version: ${{ matrix.ruby }} bundler-cache: true - - name: Run rspec + - name: Run test run: bundle exec rspec diff --git a/CHANGELOG.md b/CHANGELOG.md index 6100723..a92d6f7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,14 +1,14 @@ -## [Unreleased] +# Changelog -## [1.0.0] - 2023-12-28 +## [1.0.0](https://github.com/anakinj/jwk-loader/compare/v0.1.1...v1.0.0) (2023-12-28) + +### Features - `jwk_loader/test` for convenience for testing without external dependencies. [#6](https://github.com/anakinj/jwk-loader/pull/6) ([@anakinj](https://github.com/anakinj)) - Serialize the cached key sets into `JWT::JWK:Set` to avoid generating OpenSSL PKeys for each time the keys are used. [#6](https://github.com/anakinj/jwk-loader/pull/6) ([@anakinj](https://github.com/anakinj)) -## [0.1.1] - 2022-08-26 - -- make sure 'net/http' is required [#2](https://github.com/anakinj/jwk-loader/pull/2) ([@lukad](https://github.com/lukad)). +## [1.0.0](https://github.com/anakinj/jwk-loader/compare/v0.1.0...v0.1.1) (2022-08-26) -## [0.1.0] - 2022-07-06 +### Fixes -- Initial release +- make sure 'net/http' is required [#2](https://github.com/anakinj/jwk-loader/pull/2) ([@lukad](https://github.com/lukad)). diff --git a/Gemfile b/Gemfile index d72a67d..7717343 100644 --- a/Gemfile +++ b/Gemfile @@ -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" diff --git a/README.md b/README.md index af887cf..8832f63 100644 --- a/README.md +++ b/README.md @@ -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 @@ -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 diff --git a/lib/jwk_loader/config/config.rb b/lib/jwk_loader/config/config.rb index 4389401..c21f3bc 100644 --- a/lib/jwk_loader/config/config.rb +++ b/lib/jwk_loader/config/config.rb @@ -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 diff --git a/release-please-config.json b/release-please-config.json index 2831bdb..4f9c15a 100644 --- a/release-please-config.json +++ b/release-please-config.json @@ -3,7 +3,7 @@ "include-v-in-tag": true, "packages": { ".": { - "version-file": "lib/jwt/eddsa/version.rb" + "version-file": "lib/jwk_loader/version.rb" } } } \ No newline at end of file diff --git a/spec/jwk-loader_spec.rb b/spec/jwk-loader_spec.rb index 42dcc66..8dc89a1 100644 --- a/spec/jwk-loader_spec.rb +++ b/spec/jwk-loader_spec.rb @@ -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 @@ -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 diff --git a/spec/jwk_loader/jwks_uri_provider_spec.rb b/spec/jwk_loader/jwks_uri_provider_spec.rb index 3f2fafa..75f6745 100644 --- a/spec/jwk_loader/jwks_uri_provider_spec.rb +++ b/spec/jwk_loader/jwks_uri_provider_spec.rb @@ -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) } diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 5827f77..f962f33 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -21,7 +21,7 @@ end config.after(:each) do - ::JwkLoader.reset! + JwkLoader.reset! end end