{"repo":"IMS94/spring-boot-jwt-authorization","free":true,"listed":false,"github":"https://github.com/IMS94/spring-boot-jwt-authorization","clone":"git clone https://github.com/IMS94/spring-boot-jwt-authorization.git","description":"Example project to do role based access control (RBAC) using Spring Boot and JWT","language":"Java","stars":90,"topics":["spring-boot","spring-security","jwt","jwt-authentication","authorization","rbac","role-based-access-control","roles","security","rest-api"],"license":null,"category":"auth-billing-email","readme_excerpt":"Role Based Access Control (RBAC) with Spring Boot and JWT This repo hosts the source code for the article Role Based Access Control (RBAC) with Spring Boot and JWT . This example project demonstrates how to use Spring Boot's inbuilt OAuth2 Resource Server to authenticate and authorize REST APIs with JWT. First, we have enabled JWT authentication and secondly, have introduced Role Based Access Control (RBAC) by mapping a roles claim in JWT to granted authorities in Spring Security. Furthermore, provides a /login endpoint to generate and issue JWTs upon successful login by the users. This approach is ideal to be used as the backend for a single page application (SPA) written using a frontend framework like ReactJS, Angular, etc. Requirements - Java 17 or higher - Maven 3.6+ - Spring Boot 3.5.x Solution Overview Role Based Access Control An example of role based access control. JWT Authentication Overview Getting Started 1. Ensure you have Java 17 or higher installed 2. Build the project: mvn clean install 3. Run the main class com.example.springboot.jwt.JwtApplication to start the application 4. The application starts on http://localhost:8080 API Endpoints Authentication Endpoint Method Auth Required Content-Type Description ---------- -------- :---: --- --- /login POST No application/x-www-form-urlencoded Accepts username and password form params, returns a signed JWT Products (Protected) Endpoint Method Required Authority Description ---------- -------- --- --- /products GET ","default_branch":null,"files":null,"tree":[],"storefront":"/r/IMS94","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/IMS94/spring-boot-jwt-authorization/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}