{"id":20760108,"url":"https://github.com/gayanukabulegoda/springjwt","last_synced_at":"2026-03-14T02:39:37.341Z","repository":{"id":259321727,"uuid":"848274325","full_name":"gayanukabulegoda/SpringJWT","owner":"gayanukabulegoda","description":"SpringJWT is a simple project designed to help users understand JWT implementation with Spring Security, including the use of bearer tokens for secure authentication.","archived":false,"fork":false,"pushed_at":"2024-09-24T19:28:47.000Z","size":25,"stargazers_count":7,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-14T06:32:29.531Z","etag":null,"topics":["authentication","backend-auth","bearer-token","java-auth","java-security","jwt","jwt-auth","jwt-bearer-authentication","jwt-token","learn-security","spring","spring-authentication","spring-boot","spring-jwt","spring-jwt-authentication","spring-jwt-sample","spring-security","spring-security-jwt","springjwt","web-security"],"latest_commit_sha":null,"homepage":"","language":"Java","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/gayanukabulegoda.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":"2024-08-27T13:14:07.000Z","updated_at":"2025-03-05T05:10:22.000Z","dependencies_parsed_at":"2024-10-24T11:42:18.202Z","dependency_job_id":"a4db36c8-614c-44a0-bc9d-47673a333f42","html_url":"https://github.com/gayanukabulegoda/SpringJWT","commit_stats":null,"previous_names":["gayanukabulegoda/springjwt"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/gayanukabulegoda/SpringJWT","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gayanukabulegoda%2FSpringJWT","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gayanukabulegoda%2FSpringJWT/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gayanukabulegoda%2FSpringJWT/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gayanukabulegoda%2FSpringJWT/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gayanukabulegoda","download_url":"https://codeload.github.com/gayanukabulegoda/SpringJWT/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gayanukabulegoda%2FSpringJWT/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30486275,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-14T01:54:10.014Z","status":"online","status_checked_at":"2026-03-14T02:00:06.612Z","response_time":57,"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":["authentication","backend-auth","bearer-token","java-auth","java-security","jwt","jwt-auth","jwt-bearer-authentication","jwt-token","learn-security","spring","spring-authentication","spring-boot","spring-jwt","spring-jwt-authentication","spring-jwt-sample","spring-security","spring-security-jwt","springjwt","web-security"],"created_at":"2024-11-17T10:11:09.857Z","updated_at":"2026-03-14T02:39:37.309Z","avatar_url":"https://github.com/gayanukabulegoda.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SpringJWT\n\n**SpringJWT** is a demo project designed to help developers understand how to implement **JWT (JSON Web Token)** authentication with **Spring Security**. This project showcases a backend solution using bearer tokens for secure authentication and includes a sample frontend for testing purposes.\n\n## Features\n\n- **JWT Authentication**: Secure user authentication using JWT bearer tokens.\n- **Spring Security Integration**: Leveraging Spring Security to manage user access.\n- **Token Generation and Validation**: Supports token issuance and validation with secure key management.\n- **Sample Frontend**: A basic frontend provided for testing authentication and secure routes.\n- **Custom Exception Handling**: Handles invalid credentials and other security exceptions.\n\n## Project Structure\n\n```\nsrc/\n├── main/\n│   ├── java/lk/ijse/jwt/\n│   │   ├── config/\n│   │   ├── controller/\n│   │   ├── dto/\n│   │   ├── entity/\n│   │   ├── repository/\n│   │   ├── service/\n│   │   ├── util/\n│   └── resources/\n│       └── application.properties\n└── templates/\n```\n\n## How It Works\n\n1. **JWT Token Generation**: After successful login or registration, the backend generates a JWT token using user credentials.\n2. **Token Validation**: For secure routes, the token is validated to authenticate the user.\n3. **Role-Based Authorization**: Different user roles can access specific routes based on the token.\n4. **Sample Frontend Testing**: The frontend helps test login and authentication flow.\n\n## Requirements\n\n- **Java 11+**\n- **Maven**\n- **Spring Boot**\n- **MySQL** (or any compatible database)\n- **Postman** (for API testing)\n\n## Getting Started\n\n### 1. Clone the repository\n```bash\ngit clone https://github.com/gayanukabulegoda/SpringJWT.git\n```\n### 2. Configure the Application\nEdit `application.properties` to set your MySQL connection details:\n```bash\nspring.datasource.url=jdbc:mysql://localhost:3306/springjwt\nspring.datasource.username=YOUR_USERNAME\nspring.datasource.password=YOUR_PASSWORD\n```\n### 3. Build and Run the Application\n```bash\nmvn clean install\nmvn spring-boot:run\n```\nThe backend will start running at `http://localhost:8080`.\n\n### 4. Frontend Testing\nThe project includes a simple frontend to test JWT authentication.\n\n### 5. API Documentation\nPostman Documentation: [API Documentation](https://documenter.getpostman.com/view/36681432/2sAXqwXeJP)\n\n## License\nThis project is licensed under the **MIT License** - see the [LICENSE](LICENSE)  file for details.\n\n##\n\u003cdiv align=\"center\"\u003e\n\u003ca href=\"https://github.com/gayanukabulegoda\" target=\"_blank\"\u003e\u003cimg src = \"https://img.shields.io/badge/GitHub-100000?style=for-the-badge\u0026logo=github\u0026logoColor=white\"\u003e\u003c/a\u003e\n\u003ca href=\"https://git-scm.com/\" target=\"_blank\"\u003e\u003cimg src = \"https://img.shields.io/badge/Git-100000?style=for-the-badge\u0026logo=git\u0026logoColor=white\"\u003e\u003c/a\u003e\n\u003ca href=\"https://spring.io/projects/spring-boot\" target=\"_blank\"\u003e\u003cimg src = \"https://img.shields.io/badge/Spring_Boot-100000?style=for-the-badge\u0026logo=spring-boot\u0026logoColor=white\"\u003e\u003c/a\u003e\n\u003ca href=\"https://spring.io/projects/spring-security\" target=\"_blank\"\u003e\u003cimg src = \"https://img.shields.io/badge/Spring_Security-100000?style=for-the-badge\u0026logo=Spring-Security\u0026logoColor=white\"\u003e\u003c/a\u003e\n\u003ca href=\"https://jwt.io/\" target=\"_blank\"\u003e\u003cimg src = \"https://img.shields.io/badge/JWT-100000?style=for-the-badge\u0026logo=JSON%20web%20tokens\u0026logoColor=white\"\u003e\u003c/a\u003e\n\u003ca href=\"https://www.json.org/json-en.html\" target=\"_blank\"\u003e\u003cimg src = \"https://img.shields.io/badge/json-100000?style=for-the-badge\u0026logo=json\u0026logoColor=white\"\u003e\u003c/a\u003e\n\u003ca href=\"https://maven.apache.org/download.cgi\" target=\"blank\"\u003e\u003cimg src = \"https://img.shields.io/badge/Maven-100000?style=for-the-badge\u0026logo=apachemaven\u0026logoColor=white\"\u003e\u003c/a\u003e\n\u003ca href=\"https://www.mysql.com/downloads/\" target=\"blank\"\u003e\u003cimg src = \"https://img.shields.io/badge/Mysql-100000?style=for-the-badge\u0026logo=mysql\u0026logoColor=white\"\u003e\u003c/a\u003e\n\u003ca href=\"https://www.postman.com/downloads/\" target=\"blank\"\u003e\u003cimg src = \"https://img.shields.io/badge/Postman-100000?style=for-the-badge\u0026logo=Postman\u0026logoColor=white\"\u003e\u003c/a\u003e\n\u003c/div\u003e \u003cbr\u003e\n\u003cp align=\"center\"\u003e\n  \u0026copy; 2024 Gayanuka Bulegoda\n\u003c/p\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgayanukabulegoda%2Fspringjwt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgayanukabulegoda%2Fspringjwt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgayanukabulegoda%2Fspringjwt/lists"}