{"id":26179291,"url":"https://github.com/bezkoder/spring-boot-login-example","last_synced_at":"2025-09-04T07:39:35.080Z","repository":{"id":50546335,"uuid":"438206806","full_name":"bezkoder/spring-boot-login-example","owner":"bezkoder","description":"Spring Boot Login and Registration example with MySQL, JWT, Rest Api - Spring Boot Spring Security Login example","archived":false,"fork":false,"pushed_at":"2024-02-04T09:05:47.000Z","size":109,"stargazers_count":215,"open_issues_count":3,"forks_count":126,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-05-19T21:03:13.656Z","etag":null,"topics":["authentication","authorization","jwt","jwt-auth","jwt-authentication","jwt-authorization","jwt-token","login","mysql","rest-api","spring-boot","spring-data-jpa","spring-security","token-based-authentication"],"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/bezkoder.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-12-14T10:16:50.000Z","updated_at":"2025-05-18T14:55:08.000Z","dependencies_parsed_at":"2025-03-26T21:10:33.939Z","dependency_job_id":"55e815ff-4fd7-47c1-871e-a38469ed94fb","html_url":"https://github.com/bezkoder/spring-boot-login-example","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/bezkoder/spring-boot-login-example","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bezkoder%2Fspring-boot-login-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bezkoder%2Fspring-boot-login-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bezkoder%2Fspring-boot-login-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bezkoder%2Fspring-boot-login-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bezkoder","download_url":"https://codeload.github.com/bezkoder/spring-boot-login-example/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bezkoder%2Fspring-boot-login-example/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273574055,"owners_count":25129882,"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","status":"online","status_checked_at":"2025-09-04T02:00:08.968Z","response_time":61,"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","jwt","jwt-auth","jwt-authentication","jwt-authorization","jwt-token","login","mysql","rest-api","spring-boot","spring-data-jpa","spring-security","token-based-authentication"],"created_at":"2025-03-11T21:49:30.089Z","updated_at":"2025-09-04T07:39:35.051Z","avatar_url":"https://github.com/bezkoder.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Spring Boot Login example with Spring Security, MySQL and JWT\nBuild a Spring Boot Login and Registration example (Rest API) that supports JWT with HttpOnly Cookie. You’ll know:\n\n- Appropriate Flow for User Login and Registration with JWT and HttpOnly Cookies\n- Spring Boot Rest Api Architecture with Spring Security\n- How to configure Spring Security to work with JWT\n- How to define Data Models and association for Authentication and Authorization\n- Way to use Spring Data JPA to interact with MySQL Database\n\n## User Registration, Login and Authorization process.\n\n![spring-boot-login-example-flow](spring-boot-login-example-flow.png)\n\n## Spring Boot Server Architecture with Spring Security\nYou can have an overview of our Spring Boot Server with the diagram below:\n\n![spring-boot-login-example-architecture](spring-boot-login-example-architecture.png)\n\nFor more detail, please visit:\n\u003e [Spring Boot Login example with MySQL and JWT](https://www.bezkoder.com/spring-boot-login-example-mysql/)\n\n\u003e [For H2 Embedded database](https://www.bezkoder.com/spring-boot-security-login-jwt/)\n\n\u003e [For MongoDB](https://www.bezkoder.com/spring-boot-jwt-auth-mongodb/)\n\nWorking with Front-end:\n\u003e [Angular 12](https://www.bezkoder.com/angular-12-jwt-auth-httponly-cookie/) / [Angular 13](https://www.bezkoder.com/angular-13-jwt-auth-httponly-cookie/) / [Angular 14](https://www.bezkoder.com/angular-14-jwt-auth/) / [Angular 15](https://www.bezkoder.com/angular-15-jwt-auth/) / [Angular 16](https://www.bezkoder.com/angular-16-jwt-auth/) / [Angular 17](https://www.bezkoder.com/angular-17-jwt-auth/)\n\n\u003e [React](https://www.bezkoder.com/react-login-example-jwt-hooks/) / [React Redux](https://www.bezkoder.com/redux-toolkit-auth/)\n\n## Dependency\n– If you want to use PostgreSQL:\n```xml\n\u003cdependency\u003e\n  \u003cgroupId\u003eorg.postgresql\u003c/groupId\u003e\n  \u003cartifactId\u003epostgresql\u003c/artifactId\u003e\n  \u003cscope\u003eruntime\u003c/scope\u003e\n\u003c/dependency\u003e\n```\n– or MySQL:\n```xml\n\u003cdependency\u003e\n  \u003cgroupId\u003ecom.mysql\u003c/groupId\u003e\n  \u003cartifactId\u003emysql-connector-j\u003c/artifactId\u003e\n  \u003cscope\u003eruntime\u003c/scope\u003e\n\u003c/dependency\u003e\n```\n## Configure Spring Datasource, JPA, App properties\nOpen `src/main/resources/application.properties`\n- For PostgreSQL:\n```\nspring.datasource.url= jdbc:postgresql://localhost:5432/testdb\nspring.datasource.username= postgres\nspring.datasource.password= 123\n\nspring.jpa.properties.hibernate.jdbc.lob.non_contextual_creation= true\nspring.jpa.properties.hibernate.dialect= org.hibernate.dialect.PostgreSQLDialect\n\n# Hibernate ddl auto (create, create-drop, validate, update)\nspring.jpa.hibernate.ddl-auto= update\n\n# App Properties\nbezkoder.app.jwtCookieName= bezkoder\nbezkoder.app.jwtSecret= ======================BezKoder=Spring===========================\nbezkoder.app.jwtExpirationMs= 86400000\n```\n- For MySQL\n```\nspring.datasource.url= jdbc:mysql://localhost:3306/testdb?useSSL=false\nspring.datasource.username= root\nspring.datasource.password= 123456\n\nspring.jpa.properties.hibernate.dialect= org.hibernate.dialect.MySQL5InnoDBDialect\nspring.jpa.hibernate.ddl-auto= update\n\n# App Properties\nbezkoder.app.jwtCookieName= bezkoder\nbezkoder.app.jwtSecret= ======================BezKoder=Spring===========================\nbezkoder.app.jwtExpirationMs= 86400000\n```\n## Run Spring Boot application\n```\nmvn spring-boot:run\n```\n\n## Run following SQL insert statements\n```\nINSERT INTO roles(name) VALUES('ROLE_USER');\nINSERT INTO roles(name) VALUES('ROLE_MODERATOR');\nINSERT INTO roles(name) VALUES('ROLE_ADMIN');\n```\n\n## Refresh Token\n\n[Spring Boot Refresh Token with JWT example](https://www.bezkoder.com/spring-boot-refresh-token-jwt/)\n\n## More Practice:\n\u003e [Spring Boot File upload example with Multipart File](https://bezkoder.com/spring-boot-file-upload/)\n\n\u003e [Exception handling: @RestControllerAdvice example in Spring Boot](https://bezkoder.com/spring-boot-restcontrolleradvice/)\n\n\u003e [Spring Boot Repository Unit Test with @DataJpaTest](https://bezkoder.com/spring-boot-unit-test-jpa-repo-datajpatest/)\n\n\u003e [Spring Boot Rest Controller Unit Test with @WebMvcTest](https://www.bezkoder.com/spring-boot-webmvctest/)\n\n\u003e [Spring Boot Pagination \u0026 Sorting example](https://www.bezkoder.com/spring-boot-pagination-sorting-example/)\n\n\u003e Validation: [Spring Boot Validate Request Body](https://www.bezkoder.com/spring-boot-validate-request-body/)\n\n\u003e Documentation: [Spring Boot and Swagger 3 example](https://www.bezkoder.com/spring-boot-swagger-3/)\n\n\u003e Caching: [Spring Boot Redis Cache example](https://www.bezkoder.com/spring-boot-redis-cache-example/)\n\nAssociations:\n\u003e [JPA/Hibernate One To Many example in Spring Boot](https://www.bezkoder.com/jpa-one-to-many/)\n\n\u003e [JPA/Hibernate Many To Many example in Spring Boot](https://www.bezkoder.com/jpa-many-to-many/)\n\n\u003e [JPA/Hibernate One To One example in Spring Boot](https://www.bezkoder.com/jpa-one-to-one/)\n\nDeployment:\n\u003e [Deploy Spring Boot App on AWS – Elastic Beanstalk](https://www.bezkoder.com/deploy-spring-boot-aws-eb/)\n\n\u003e [Docker Compose Spring Boot and MySQL example](https://www.bezkoder.com/docker-compose-spring-boot-mysql/)\n\n## Fullstack CRUD App\n\n\u003e [Vue.js + Spring Boot + H2 Embedded database example](https://www.bezkoder.com/spring-boot-vue-js-crud-example/)\n\n\u003e [Vue.js + Spring Boot + MySQL example](https://www.bezkoder.com/spring-boot-vue-js-mysql/)\n\n\u003e [Vue.js + Spring Boot + PostgreSQL example](https://www.bezkoder.com/spring-boot-vue-js-postgresql/)\n\n\u003e [Angular 8 + Spring Boot + Embedded database example](https://www.bezkoder.com/angular-spring-boot-crud/)\n\n\u003e [Angular 8 + Spring Boot + MySQL example](https://www.bezkoder.com/angular-spring-boot-crud/)\n\n\u003e [Angular 8 + Spring Boot + PostgreSQL example](https://www.bezkoder.com/angular-spring-boot-postgresql/)\n\n\u003e [Angular 10 + Spring Boot + MySQL example](https://www.bezkoder.com/angular-10-spring-boot-crud/)\n\n\u003e [Angular 10 + Spring Boot + PostgreSQL example](https://www.bezkoder.com/angular-10-spring-boot-postgresql/)\n\n\u003e [Angular 11 + Spring Boot + MySQL example](https://www.bezkoder.com/angular-11-spring-boot-crud/)\n\n\u003e [Angular 11 + Spring Boot + PostgreSQL example](https://www.bezkoder.com/angular-11-spring-boot-postgresql/)\n\n\u003e [Angular 12 + Spring Boot + Embedded database example](https://www.bezkoder.com/angular-12-spring-boot-crud/)\n\n\u003e [Angular 12 + Spring Boot + MySQL example](https://www.bezkoder.com/angular-12-spring-boot-mysql/)\n\n\u003e [Angular 12 + Spring Boot + PostgreSQL example](https://www.bezkoder.com/angular-12-spring-boot-postgresql/)\n\n\u003e [Angular 13 + Spring Boot + H2 Embedded Database example](https://www.bezkoder.com/spring-boot-angular-13-crud/)\n\n\u003e [Angular 13 + Spring Boot + MySQL example](https://www.bezkoder.com/spring-boot-angular-13-mysql/)\n\n\u003e [Angular 13 + Spring Boot + PostgreSQL example](https://www.bezkoder.com/spring-boot-angular-13-postgresql/)\n\n\u003e [Angular 14 + Spring Boot + H2 Embedded Database example](https://www.bezkoder.com/spring-boot-angular-14-crud/)\n\n\u003e [Angular 14 + Spring Boot + MySQL example](https://www.bezkoder.com/spring-boot-angular-14-mysql/)\n\n\u003e [Angular 14 + Spring Boot + PostgreSQL example](https://www.bezkoder.com/spring-boot-angular-14-postgresql/)\n\n\u003e [Angular 15 + Spring Boot + H2 Embedded Database example](https://www.bezkoder.com/spring-boot-angular-15-crud/)\n\n\u003e [Angular 15 + Spring Boot + MySQL example](https://www.bezkoder.com/spring-boot-angular-15-mysql/)\n\n\u003e [Angular 15 + Spring Boot + PostgreSQL example](https://www.bezkoder.com/spring-boot-angular-15-postgresql/)\n\n\u003e [Angular 16 + Spring Boot + H2 Embedded Database example](https://www.bezkoder.com/spring-boot-angular-16-crud/)\n\n\u003e [Angular 16 + Spring Boot + MySQL example](https://www.bezkoder.com/spring-boot-angular-16-mysql/)\n\n\u003e [Angular 16 + Spring Boot + PostgreSQL example](https://www.bezkoder.com/spring-boot-angular-16-postgresql/)\n\n\u003e [Angular 17 + Spring Boot + H2 Embedded Database example](https://www.bezkoder.com/spring-boot-angular-17-crud/)\n\n\u003e [Angular 17 + Spring Boot + MySQL example](https://www.bezkoder.com/spring-boot-angular-17-mysql/)\n\n\u003e [Angular 17 + Spring Boot + PostgreSQL example](https://www.bezkoder.com/spring-boot-angular-17-postgresql/)\n\n\u003e [React + Spring Boot + MySQL example](https://www.bezkoder.com/react-spring-boot-crud/)\n\n\u003e [React + Spring Boot + PostgreSQL example](https://www.bezkoder.com/spring-boot-react-postgresql/)\n\n\u003e [React + Spring Boot + MongoDB example](https://www.bezkoder.com/react-spring-boot-mongodb/)\n\nRun both Back-end \u0026 Front-end in one place:\n\u003e [Integrate Angular with Spring Boot Rest API](https://www.bezkoder.com/integrate-angular-spring-boot/)\n\n\u003e [Integrate React.js with Spring Boot Rest API](https://www.bezkoder.com/integrate-reactjs-spring-boot/)\n\n\u003e [Integrate Vue.js with Spring Boot Rest API](https://www.bezkoder.com/integrate-vue-spring-boot/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbezkoder%2Fspring-boot-login-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbezkoder%2Fspring-boot-login-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbezkoder%2Fspring-boot-login-example/lists"}