{"id":28216219,"url":"https://github.com/emrtnm/spring-security-jwt","last_synced_at":"2025-06-26T16:37:31.247Z","repository":{"id":227874037,"uuid":"772604131","full_name":"emrtnm/spring-security-jwt","owner":"emrtnm","description":"Spring Security JWT","archived":false,"fork":false,"pushed_at":"2024-04-16T10:44:28.000Z","size":29,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-12T06:46:53.339Z","etag":null,"topics":["java","jwt","jwt-authentication","security","spring","springboot","springframework","springsecurity"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/emrtnm.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}},"created_at":"2024-03-15T14:20:21.000Z","updated_at":"2025-01-11T15:09:49.000Z","dependencies_parsed_at":"2024-04-16T11:45:50.058Z","dependency_job_id":"d3241124-252f-4557-b2c4-3f1642b0eee3","html_url":"https://github.com/emrtnm/spring-security-jwt","commit_stats":null,"previous_names":["emrtnm/spring-security-jwt"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/emrtnm/spring-security-jwt","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emrtnm%2Fspring-security-jwt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emrtnm%2Fspring-security-jwt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emrtnm%2Fspring-security-jwt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emrtnm%2Fspring-security-jwt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/emrtnm","download_url":"https://codeload.github.com/emrtnm/spring-security-jwt/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emrtnm%2Fspring-security-jwt/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262103298,"owners_count":23259429,"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":["java","jwt","jwt-authentication","security","spring","springboot","springframework","springsecurity"],"created_at":"2025-05-17T23:12:07.743Z","updated_at":"2025-06-26T16:37:31.238Z","avatar_url":"https://github.com/emrtnm.png","language":"Java","readme":"# Spring Security JWT\n[![Spring Boot](https://img.shields.io/badge/Spring%20Boot-3.2.3-green)](https://spring.io/projects/spring-boot)\n[![Spring Security](https://img.shields.io/badge/Spring%20Security-6.2.2-brightgreen)](https://spring.io/projects/spring-security)\n[![JWT](https://img.shields.io/badge/JWT-JSON%20Web%20Token-orange)](https://jwt.io/)\n[![License: GPL-3.0](https://img.shields.io/badge/License-GPL%203.0-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)\n\nThis repository contains an example of authentication and access control using Spring Security and JWT (JSON Web Token). It provides customized authentication using a MySQL database instead of Spring Security's default user management.\n\n## Features\n - Secure API access using Spring Security\n - Authentication and access control with JWT\n - User management using MySQL database\n - Example of user login and token-based authorization\n\nHow To Run\n---------------\n\n1. Clone this repository:\n\n```bash\ngit clone git@github.com:emrtnm/spring-security-jwt.git\n```\n\n2. Open project settings and select BellSoft Liberica 17 SDK (Recommended).\n\n3. Make your MySQL database connection settings by opening the `application.properties` file:\n\n```bash\nspring.datasource.url=jdbc:mysql://localhost:3306/your_database\nspring.datasource.username=your_username\nspring.datasource.password=your_password\n```\n\n4. Change your secret key in `application.properties` file (Optional):\n\n```bash\nsecurity.jwt.token.secret-key=d32d53896a4e21855aeb0efaa23c4b5ab0721a6e23702d5eb549332d9e913d14\n```\n\n5. Open terminal in your project folder\n\n6. Run this command\n\n```bash\nmvn spring-boot:run\n```\n\n6. Go to http://localhost:8080 from your browser.\n\n7. You should see this message:\n\n```json\n{\n  \"message\": \"Unauthorized path\"\n}\n```\n\n## How To Test\n\n1. **Open Postman:** Open the Postman application.\n2. **Import File:** Click on the \"File\" tab in the top menu.\n3. **Click on Import:** Select the \"Import\" option.\n4. **Choose File to Import:** Click on \"Upload Files\" and select the `collection.json` file located in the main directory. Then click \"Open\" or \"Choose\" to import the file.\n5. **Collection Created:** After importing the file, a collection named \"Spring Security JWT API\" will be created.\n6. **Enjoy:** You can now use the newly created collection in Postman to manage your requests and test your API.\n\n## File Structure\n```bash\n├── README.md\n├── collection.json\n├── pom.xml\n── src\n    ├── main\n    │   ├── java\n    │   │   └── com\n    │   │       └── emrtnm\n    │   │           └── jwt\n    │   │               ├── Application.java\n    │   │               ├── config\n    │   │               │   ├── JwtAuthFilter.java\n    │   │               │   ├── PasswordConfig.java\n    │   │               │   ├── RestExceptionHandler.java\n    │   │               │   ├── SecurityConfig.java\n    │   │               │   └── UserAuthenticationEntryPoint.java\n    │   │               ├── controller\n    │   │               │   ├── AuthController.java\n    │   │               │   └── HomeController.java\n    │   │               ├── dto\n    │   │               │   ├── CredentialsDto.java\n    │   │               │   ├── ErrorDto.java\n    │   │               │   ├── SignUpDto.java\n    │   │               │   ├── UserDto.java\n    │   │               │   └── UserResponse.java\n    │   │               ├── entity\n    │   │               │   └── User.java\n    │   │               ├── enums\n    │   │               │   └── Role.java\n    │   │               ├── exception\n    │   │               │   └── AppException.java\n    │   │               ├── mapper\n    │   │               │   └── UserMapper.java\n    │   │               ├── repository\n    │   │               │   └── UserRepository.java\n    │   │               └── service\n    │   │                   └── UserService.java\n    │   └── resources\n    │       └── application.properties\n    └── test\n        └── java\n            └── com\n                └── emrtnm\n                    └── jwt\n                        └── ApplicationTests.java\n\n\n```\n\n## License\n\nThis project is open-sourced software licensed under the [GPL-3.0 license](https://www.gnu.org/licenses/gpl-3.0).\n\n\n### Make A Contribution!\nIf you think that anything here could be improved, please don't hesitate to contribute. Anyone who wants to, regardless of their ability, skill, or background, can contribute to this project. All contributions are made for the benefit of the community. Thanks very much for helping this repository become much more suitable for its purpose and more useful to a larger number of people.\n\n**#java** **#spring** **#jwt** **#security** **#springsecurity** **#springboot** **#springframework**\n**#auth** **#jsonwebtoken** **#springsecurityjwt**\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Femrtnm%2Fspring-security-jwt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Femrtnm%2Fspring-security-jwt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Femrtnm%2Fspring-security-jwt/lists"}