{"id":30110121,"url":"https://github.com/anakinj/jwk-loader","last_synced_at":"2025-08-10T04:18:02.340Z","repository":{"id":57748928,"uuid":"511272417","full_name":"anakinj/jwk-loader","owner":"anakinj","description":"Gem to manage JWK caches","archived":false,"fork":false,"pushed_at":"2025-07-02T12:26:28.000Z","size":46,"stargazers_count":3,"open_issues_count":0,"forks_count":3,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-28T00:22:07.599Z","etag":null,"topics":["hacktoberfest","jwk","jwt"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/anakinj.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2022-07-06T19:48:31.000Z","updated_at":"2025-07-02T12:26:29.000Z","dependencies_parsed_at":"2024-08-10T12:56:06.173Z","dependency_job_id":null,"html_url":"https://github.com/anakinj/jwk-loader","commit_stats":{"total_commits":20,"total_committers":3,"mean_commits":6.666666666666667,"dds":"0.19999999999999996","last_synced_commit":"518b336f0415dcc40b5a04041de314ea4348208e"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/anakinj/jwk-loader","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anakinj%2Fjwk-loader","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anakinj%2Fjwk-loader/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anakinj%2Fjwk-loader/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anakinj%2Fjwk-loader/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/anakinj","download_url":"https://codeload.github.com/anakinj/jwk-loader/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anakinj%2Fjwk-loader/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268576821,"owners_count":24273057,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-03T02:00:12.545Z","response_time":2577,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["hacktoberfest","jwk","jwt"],"created_at":"2025-08-10T04:18:01.595Z","updated_at":"2025-08-10T04:18:02.267Z","avatar_url":"https://github.com/anakinj.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# jwk-loader\n\n[![Gem Version](https://badge.fury.io/rb/jwk-loader.svg)](https://badge.fury.io/rb/jwk-loader)\n[![Build status](https://github.com/anakinj/jwk-loader/actions/workflows/test.yml/badge.svg)](https://github.com/anakinj/jwk-loader/actions/workflows/test.yml)\n\nThis 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.\n\n## Installation\n\nInstall the gem and add to the application's Gemfile by executing:\n\n    $ bundle add jwk-loader\n\nIf bundler is not being used to manage dependencies, install the gem by executing:\n\n    $ gem install jwk-loader\n\n## Usage\n\n### Using as a jwks loader when decoding JWT tokens\n\n```ruby\nrequire \"jwt\"\nrequire \"jwk-loader\"\n\nJWT.decode(token, nil, true, algorithm: \"RS512\", jwks: JwkLoader.for_uri(uri: \"https://url/to/public/jwks\") )\n```\n\n### Testing endpoints protected by JWT tokens\n\nWhen testing HTTP endpoints protected by asymmetric JWT keys the mechanism in `jwk_loader/test` can be used to simplify the process.\n\n```ruby\nrequire 'jwk_loader/test'\n\nRSpec.describe 'GET /protected' do\n  include JwkLoader::Test\n\n  context 'when called with a valid token' do\n    let(:token) { sign_test_token(token_payload: { user_id: \"user\" }, jwk_endpoint: \"https://url/to/public/jwks\") }\n    subject(:response) { get('/protected', { 'HTTP_AUTHORIZATION' =\u003e \"Bearer #{token}\" }) }\n\n    it 'is a success' do\n      expect(response.status).to eq(200)\n    end\n  end\nend\n```\n\n### Configuring the gem\n\n```ruby\nrequire \"jwt-loader\"\n\nJwkLoader.configure do |config|\n  config[:cache] = YetAnotherCache.new\n  config[:cache_grace_period] = 999\nend\n```\n\nor in alternative\n\n```ruby\nrequire \"jwt-loader\"\n\nJwkLoader.configure do |config|\n  config.cache = YetAnotherCache.new\n  config.cache_grace_period = 999\nend\n```\n\n\n## Development\n\nAfter checking out the repo, run `bundle install` to install dependencies. Then, run `bundle exec rspec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/anakinj/jwk-loader. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/anakinj/jwk-loader/blob/main/CODE_OF_CONDUCT.md).\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).\n\n## Code of Conduct\n\nEveryone interacting in the Jwk::Loader project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/abajubh/jwk-loader/blob/main/CODE_OF_CONDUCT.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanakinj%2Fjwk-loader","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fanakinj%2Fjwk-loader","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanakinj%2Fjwk-loader/lists"}