Skip to content

Commit

Permalink
test: Test on recent Rubies and updated Rubocop to latest version (#10)
Browse files Browse the repository at this point in the history
* Fix changelog

* Update everything
  • Loading branch information
anakinj authored Aug 10, 2024
1 parent d39e89a commit 2095128
Show file tree
Hide file tree
Showing 9 changed files with 28 additions and 24 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
14 changes: 7 additions & 7 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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)).
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
2 changes: 1 addition & 1 deletion release-please-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"include-v-in-tag": true,
"packages": {
".": {
"version-file": "lib/jwt/eddsa/version.rb"
"version-file": "lib/jwk_loader/version.rb"
}
}
}
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 2095128

Please sign in to comment.