{"id":22243150,"url":"https://github.com/ims94/spring-boot-jwt-authorization","last_synced_at":"2025-06-16T05:33:31.384Z","repository":{"id":41377012,"uuid":"408050865","full_name":"IMS94/spring-boot-jwt-authorization","owner":"IMS94","description":"Example project to do role based access control (RBAC) using Spring Boot and JWT","archived":false,"fork":false,"pushed_at":"2021-12-17T02:23:27.000Z","size":547,"stargazers_count":26,"open_issues_count":1,"forks_count":22,"subscribers_count":1,"default_branch":"master","last_synced_at":"2023-03-03T00:18:49.982Z","etag":null,"topics":["authorization","jwt","jwt-authentication","rbac","rest-api","role-based-access-control","roles","security","single-page-app","spring-boot","spring-security"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/IMS94.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-09-19T06:30:09.000Z","updated_at":"2023-02-11T20:34:20.000Z","dependencies_parsed_at":"2022-09-01T23:51:11.117Z","dependency_job_id":null,"html_url":"https://github.com/IMS94/spring-boot-jwt-authorization","commit_stats":null,"previous_names":[],"tags_count":null,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IMS94%2Fspring-boot-jwt-authorization","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IMS94%2Fspring-boot-jwt-authorization/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IMS94%2Fspring-boot-jwt-authorization/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IMS94%2Fspring-boot-jwt-authorization/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/IMS94","download_url":"https://codeload.github.com/IMS94/spring-boot-jwt-authorization/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":227851692,"owners_count":17829393,"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","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":["authorization","jwt","jwt-authentication","rbac","rest-api","role-based-access-control","roles","security","single-page-app","spring-boot","spring-security"],"created_at":"2024-12-03T04:21:08.898Z","updated_at":"2024-12-03T04:21:09.800Z","avatar_url":"https://github.com/IMS94.png","language":"Java","readme":"# Role Based Access Control (RBAC) with Spring Boot and JWT\n\nThis repo hosts the source code for the article [**Role Based Access Control (RBAC) with Spring Boot and JWT**](https://medium.com/geekculture/role-based-access-control-rbac-with-spring-boot-and-jwt-bc20a8c51c15?source=github_source).\n\nThis example project demonstrates how to use the Spring Boot's inbuilt OAuth2 Resoure Server to authenticate and \nauthorize REST APIs with JWT. First, we have enabled **JWT authentication** and secondly, have introduced \n**Role Based Access Control (RBAC)** by mapping a roles claim in JWT to granted authorities in Spring Security.\n\nFurthermore, provides a \"/login\" endpoint to generate and issue JWTs upon\nsuccessful login by the users.\n\nThis approach is ideal to be used as the \n**backend for a single page application (SPA)** written using a frontend framework like\nReactJS, Angular, etc...\n\n## Solution Overview\n\n![Solution Overview](https://github.com/IMS94/spring-boot-jwt-authorization/blob/master/authorization_process.png?raw=true \"Solution Overview\")\n\n## Role Based Access Control\nAn example of role based access control.\n\n![RBAC Example](https://github.com/IMS94/spring-boot-jwt-authorization/blob/master/rbac_sample.png?raw=true \"Solution Overview\")\n\n## JWT Authentication Overview\n\n![Solution Overview](https://github.com/IMS94/spring-boot-jwt-authorization/blob/master/solution_overview.png?raw=true \"Solution Overview\")\n\n## Getting Started\n\n- Use `mvn clean install` in the project root directory to build the project. \n- Run the main class, `com.example.springboot.jwt.JwtApplication` to start the application.\n\n## Endpoints\n\n- `/login` -\u003e Public endpoint which returns a signed JWT for valid user credentials (username/password)\n- `/products` -\u003e Contains several endpoints to add and remove product entities. Protected by JWT authentication and\nauthorized based on role.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fims94%2Fspring-boot-jwt-authorization","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fims94%2Fspring-boot-jwt-authorization","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fims94%2Fspring-boot-jwt-authorization/lists"}