{"id":22503126,"url":"https://github.com/afa-farkhod/springboot-jwt-authentication-authorization","last_synced_at":"2026-04-16T03:32:01.460Z","repository":{"id":181518527,"uuid":"662897845","full_name":"afa-farkhod/SpringBoot-JWT-Authentication-Authorization","owner":"afa-farkhod","description":"JWT authentication and authorization implementation in Spring Boot 3.0 application","archived":false,"fork":false,"pushed_at":"2023-10-03T06:26:35.000Z","size":181,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-03-30T05:41:08.254Z","etag":null,"topics":["authentication","authorization","java","jwt","jwt-authentication","postman","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":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/afa-farkhod.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}},"created_at":"2023-07-06T06:04:10.000Z","updated_at":"2024-04-03T18:25:06.000Z","dependencies_parsed_at":"2023-10-03T17:31:12.636Z","dependency_job_id":null,"html_url":"https://github.com/afa-farkhod/SpringBoot-JWT-Authentication-Authorization","commit_stats":null,"previous_names":["af4092/springboot-jwt-authentication-authorization","afa-farkhod/springboot-jwt-authentication-authorization"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/afa-farkhod/SpringBoot-JWT-Authentication-Authorization","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/afa-farkhod%2FSpringBoot-JWT-Authentication-Authorization","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/afa-farkhod%2FSpringBoot-JWT-Authentication-Authorization/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/afa-farkhod%2FSpringBoot-JWT-Authentication-Authorization/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/afa-farkhod%2FSpringBoot-JWT-Authentication-Authorization/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/afa-farkhod","download_url":"https://codeload.github.com/afa-farkhod/SpringBoot-JWT-Authentication-Authorization/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/afa-farkhod%2FSpringBoot-JWT-Authentication-Authorization/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31870506,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-15T15:24:51.572Z","status":"online","status_checked_at":"2026-04-16T02:00:06.042Z","response_time":69,"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","authorization","java","jwt","jwt-authentication","postman","spring-boot","spring-security"],"created_at":"2024-12-06T23:29:18.534Z","updated_at":"2026-04-16T03:32:01.437Z","avatar_url":"https://github.com/afa-farkhod.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SpringBoot-JWT-Authentication-Authorization\nJWT authentication and authorization implementation in Spring Boot 3.0 application\n\n## [Implementation]() \n\n- The implementation is about the JWT authentication and authorization in Spring Boot 3.0 application using Spring Security 6 and MySQL database to store user credentials. To secure the application and protect endpoints JSON Web Tokens were used. In the beginning we set the MySQL database and create user table to store user's credentials. Then we configure Spring Security to use JWT and define security rules for application. In the end, we test the application by building simple API and using Postman to send authenticated requests.\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://github.com/afa-farkhod/SpringBoot-JWT-Authentication-Authorization/assets/24220136/9d9c0e7f-0e91-4d59-b4bf-26a85d501aca\" alt=\"Image\"\u003e\n\u003c/p\u003e\n\n## Run the Demonstration\n\n- We start the Spring application:\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://github.com/af4092/SpringBoot-JWT-Authentication-Authorization/assets/24220136/56e236a3-a688-4146-a68e-528b017b0d80\" alt=\"Image\"\u003e\n\u003c/p\u003e\n\n- We can see that table was created:\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://github.com/af4092/SpringBoot-JWT-Authentication-Authorization/assets/24220136/3fc19098-4b17-4fbc-936b-8acedc5224b9\" alt=\"Image\"\u003e\n\u003c/p\u003e\n\n- Now we register new user to our Database by sending post request with `Postman` client:\n\n  \u003cimg width=\"1307\" alt=\"image\" src=\"https://github.com/af4092/SpringBoot-JWT-Authentication-Authorization/assets/24220136/0a81c831-dfd2-43f4-b0c1-8636e7ede355\"\u003e\n\n- Then we can see that our new user is successfully registered to Database and in fact as we can see password is encoded so that no one except the owner can know the real password:\n\n![image](https://github.com/af4092/SpringBoot-JWT-Authentication-Authorization/assets/24220136/5097d213-a9c7-4762-a8f4-45eb4a8dda06)\n\n- And on Postman Client side we `Authorization JWT token` as the proof of successful registration to Database:\n\n\u003cimg width=\"1290\" alt=\"image\" src=\"https://github.com/af4092/SpringBoot-JWT-Authentication-Authorization/assets/24220136/5704153b-b754-4b7c-87a2-3ee2cf3bf335\"\u003e\n\n- And now, after registering the user to Database, we try to login with the existing email and password, for this we send request through Postman client to server with the email and password information:\n\n\u003cimg width=\"1303\" alt=\"image\" src=\"https://github.com/af4092/SpringBoot-JWT-Authentication-Authorization/assets/24220136/fa58c275-3609-4e06-818e-b0e9e82539eb\"\u003e\n\n- And as the result we get our token back:\n\n\u003cimg width=\"1287\" alt=\"image\" src=\"https://github.com/af4092/SpringBoot-JWT-Authentication-Authorization/assets/24220136/f93e1db9-baf5-4348-ad1e-a34ec9483228\"\u003e\n\n\n## [Troubleshooting](https://stackoverflow.com/questions/39632667/how-do-i-remove-the-process-currently-using-a-port-on-localhost-in-windows)\n\n- Sometimes when we run the Spring application which in default listens to `port:8080` we get the `port in use` error. In this case we open the terminal and check port: 8080 and kill the PID which is listening to port.\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://github.com/af4092/SpringBoot-JWT-Authentication-Authorization/assets/24220136/40137834-ad6b-4d31-8130-35633ce8d2ca\" alt=\"Image\"\u003e\n\u003c/p\u003e\n\n![image](https://github.com/af4092/SpringBoot-JWT-Authentication-Authorization/assets/24220136/52596d27-dd2c-4688-995f-043ca6ec7240)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fafa-farkhod%2Fspringboot-jwt-authentication-authorization","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fafa-farkhod%2Fspringboot-jwt-authentication-authorization","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fafa-farkhod%2Fspringboot-jwt-authentication-authorization/lists"}