{"id":29227924,"url":"https://github.com/grantjforrester/spring-security-jwt","last_synced_at":"2026-05-17T09:42:39.606Z","repository":{"id":144520131,"uuid":"194161280","full_name":"grantjforrester/spring-security-jwt","owner":"grantjforrester","description":"A lightweight module for Spring Security that provides HTTP request authentication by JSON Web Token (JWT).","archived":false,"fork":false,"pushed_at":"2021-05-12T00:28:25.000Z","size":39,"stargazers_count":0,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-10T19:31:55.572Z","etag":null,"topics":["jwt","security","spring"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/grantjforrester.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"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}},"created_at":"2019-06-27T20:48:34.000Z","updated_at":"2023-11-29T23:55:32.000Z","dependencies_parsed_at":null,"dependency_job_id":"559480a1-1da7-4ce8-a693-869598881aa0","html_url":"https://github.com/grantjforrester/spring-security-jwt","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/grantjforrester/spring-security-jwt","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grantjforrester%2Fspring-security-jwt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grantjforrester%2Fspring-security-jwt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grantjforrester%2Fspring-security-jwt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grantjforrester%2Fspring-security-jwt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/grantjforrester","download_url":"https://codeload.github.com/grantjforrester/spring-security-jwt/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grantjforrester%2Fspring-security-jwt/sbom","scorecard":{"id":443666,"data":{"date":"2025-08-11","repo":{"name":"github.com/grantjforrester/spring-security-jwt","commit":"4b177cce05d763d5ec94c2244d1d9f8fa7263baf"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":1.5,"checks":[{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Code-Review","score":0,"reason":"Found 0/27 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: Apache License 2.0: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":0,"reason":"Project has not signed or included provenance with any releases.","details":["Warn: release artifact v1.0 not signed: https://api.github.com/repos/grantjforrester/spring-security-jwt/releases/19118154","Warn: release artifact v1.0 does not have provenance: https://api.github.com/repos/grantjforrester/spring-security-jwt/releases/19118154"],"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Vulnerabilities","score":0,"reason":"27 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-f6vf-pq8c-69m4","Warn: Project is vulnerable to: GHSA-gvpg-vgmx-xg6w","Warn: Project is vulnerable to: GHSA-xwmg-2g98-w7v9","Warn: Project is vulnerable to: GHSA-493p-pfq6-5258","Warn: Project is vulnerable to: GHSA-v528-7hrm-frqp","Warn: Project is vulnerable to: GHSA-2ppp-9496-p23q","Warn: Project is vulnerable to: GHSA-f3jh-qvm4-mg39","Warn: Project is vulnerable to: GHSA-hh32-7344-cg2f","Warn: Project is vulnerable to: GHSA-q3v6-hm2v-pw99","Warn: Project is vulnerable to: GHSA-v2r2-7qm7-jj6v","Warn: Project is vulnerable to: GHSA-v33x-prhc-gph5","Warn: Project is vulnerable to: GHSA-c4q5-6c82-3qpw","Warn: Project is vulnerable to: GHSA-gq28-h5vg-8prx","Warn: Project is vulnerable to: GHSA-36p3-wjmg-h94x","Warn: Project is vulnerable to: GHSA-hh26-6xwr-ggv7","Warn: Project is vulnerable to: GHSA-4gc7-5j7h-4qph","Warn: Project is vulnerable to: GHSA-4wp7-92pw-q264","Warn: Project is vulnerable to: GHSA-g5mm-vmx4-3rg7","Warn: Project is vulnerable to: GHSA-558x-2xjg-6232","Warn: Project is vulnerable to: GHSA-564r-hj7v-mcr5","Warn: Project is vulnerable to: GHSA-9cmq-m9j5-mvww","Warn: Project is vulnerable to: GHSA-wxqc-pxw9-g2p8","Warn: Project is vulnerable to: GHSA-2rmj-mq67-h97g","Warn: Project is vulnerable to: GHSA-2wrp-6fg6-hmc5","Warn: Project is vulnerable to: GHSA-4wrc-f8pq-fpqp","Warn: Project is vulnerable to: GHSA-ccgv-vj62-xf9h","Warn: Project is vulnerable to: GHSA-hgjh-9rj2-g67j"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-19T06:10:36.200Z","repository_id":144520131,"created_at":"2025-08-19T06:10:36.201Z","updated_at":"2025-08-19T06:10:36.201Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274932082,"owners_count":25376066,"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-09-13T02:00:10.085Z","response_time":70,"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":["jwt","security","spring"],"created_at":"2025-07-03T10:01:29.518Z","updated_at":"2025-10-29T07:21:42.484Z","avatar_url":"https://github.com/grantjforrester.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# spring-security-jwt \n![Travis (.org)](https://img.shields.io/travis/grantjforrester/spring-security-jwt)\n![Codecov](https://img.shields.io/codecov/c/github/grantjforrester/spring-security-jwt)\n\nA lightweight module for Spring Security that provides HTTP request authentication by JSON Web Token (JWT).\n\nWhen configured all incoming requests to the Spring application are intercepted and must have a valid JWT to be \nauthenticated, otherwise a response with status code 401 is returned.\n\nA JWT is valid if:\n\n- it is well-formed\n- any \"nbf\" claim has elapsed\n- any \"exp\" claim has not elapsed\n- has the correct signature based on a provided key.\n\n## The Spring Security Context\n\nOn successful authentication the `JWTAuthenticationManager` builds a \n[`PreAuthenticatedAuthenticationToken`](https://docs.spring.io/spring-security/site/docs/4.2.12.RELEASE/apidocs/org/springframework/security/web/authentication/preauth/PreAuthenticatedAuthenticationToken.html)\nwhich is set in the current Spring SecurityContext.\n\nThe token is populated from the JWT as follows:\n\n- claim `sub` is set as the `principal`\n- claim `roles` (an array of strings) is set as the collection of `authorities`\n- the JWT itself is set as the `credentials`\n\n\u003e If you want to use Spring's [method security](https://docs.spring.io/spring-security/site/docs/5.1.5.RELEASE/reference/htmlsingle/#ns-method-security)\n\u003e then I recommend each string in your `roles` claim has the prefix `ROLE_`.\n\u003e\n\u003e Example\n\u003e ```\n\u003e {\n\u003e    ...,\n\u003e    \"roles\" : [\"ROLE_AddUser\", \"ROLE_DeleteUser\"],\n\u003e    ...\n\u003e }\n\u003e ```\n\n## JWT Signature Checking\n\nTo verify a JWT signature a key must be provided.  Two methods of providing a key are supported:\n\n### From Shared Secret\n\nThe key is built from a shared secret usually passed in as a configuration value. See class `FromSharedSecret`.\n\n### From KeySet By Kid Claim\n\nEach JWT must specify a \"kid\" claim in the header.  This value is used to locate a key in the configured\nJWKS key set.  See class `FromKeySetByKidClaim`.\n\n## Usage\n\nIn your Spring application configure Spring Security as follows:\n\n```java\n@Configuration\npublic class WebSecurityConfig extends WebSecurityConfigurerAdapter {\n\n    @Value(\"${keystore.filename}\")\n    private Resource keystore;\n\n    @Autowired\n    private ApplicationContext context;\n\n    /*\n     * Create an authentication filter that looks for a JWT in an \"Authorization\" header with \n     * the authentication scheme \"Bearer\".  Use the given JWTAuthenticationManager to \n     * authenticate the JWT.\n     */\n    @Bean\n    Filter authenticationFilter(JWTAuthenticationManager jwtAuthenticationManager) {\n        JWTAuthenticationFilter filter = new JWTAuthenticationFilter();\n        filter.setJwtProvider(new HeaderJWTProvider(\"Authorization\", \"Bearer\"));\n        filter.setAuthenticationManager(jwtAuthenticationManager);\n        filter.setAuthenticationDetailsSource(new WebAuthenticationDetailsSource());\n        return filter;\n    }\n\n    /*\n     * Create a JWTAuthenticationManager bean responsible for verifying the JWT and setting\n     * up the SecurityContext.\n     */\n    @Bean\n    JWTAuthenticationManager jwtAuthenticationManager() throws Exception {\n        FromKeySetByKidClaim keySelector = new FromKeySetByKidClaim(JWKSet.load(keystore.getInputStream()));\n        return new NimbusJWTAuthenticationManager(keySelector);\n    }\n\n    /*\n     * Intercept incoming requests with the JWTAuthenticationFilter. If authentication fails\n     * return response with status code 401.\n     */\n    @Override\n    protected void configure(HttpSecurity http) throws Exception {\n        Filter authenticationFilter = (Filter) context.getBean(\"authenticationFilter\");\n        http.addFilterBefore(authenticationFilter, BasicAuthenticationFilter.class)\n            .authorizeRequests().anyRequest().authenticated()\n            .and().sessionManagement().sessionCreationPolicy(STATELESS)\n            .and().exceptionHandling().authenticationEntryPoint(\n                new StatusCode401AuthenticationEntrypoint()\n            );\n    }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgrantjforrester%2Fspring-security-jwt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgrantjforrester%2Fspring-security-jwt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgrantjforrester%2Fspring-security-jwt/lists"}