All Projects → bezkoder → spring-boot-login-example

bezkoder / spring-boot-login-example

Licence: other
Spring Boot Login and Registration example with MySQL, JWT, Rest Api - Spring Boot Spring Security Login example

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to spring-boot-login-example

spring-boot-security-postgresql
Spring Boot, Spring Security, PostgreSQL: JWT Authentication & Authorization example
Stars: ✭ 65 (+30%)
Mutual labels:  authorization, spring-security, spring-data-jpa, jwt-authentication
Jwt Spring Security Jpa
Backend MVP showcasing JWT (Json Web Token) authentication with multiple login, timeout / refresh / logout (with in memory invalidation) using Spring Security & MySQL JPA.
Stars: ✭ 202 (+304%)
Mutual labels:  spring-security, jwt-token, jwt-authentication, jwt-auth
spring-boot-refresh-token-jwt
Spring Boot Refresh Token using JWT example - Expire and Renew JWT Token
Stars: ✭ 156 (+212%)
Mutual labels:  spring-security, jwt-authentication, jwt-auth, jwt-authorization
JwtAuthDemo
ASP.NET Core + Angular JWT auth demo; integration tests; login, logout, refresh token, impersonation, authentication, authorization; run on Docker Compose.
Stars: ✭ 278 (+456%)
Mutual labels:  login, authorization, jwt-token, jwt-auth
Laravel Api Boilerplate
A Boilerplate Project For Laravel API's (NOT MAINTAINED)
Stars: ✭ 113 (+126%)
Mutual labels:  jwt-token, jwt-authentication, jwt-auth
Spring Security Pac4j
pac4j security library for Spring Security: OAuth, CAS, SAML, OpenID Connect, LDAP, JWT...
Stars: ✭ 231 (+362%)
Mutual labels:  login, authorization, spring-security
Quasar-JWT
Quasar - JWT Authentication Starter Kit
Stars: ✭ 38 (-24%)
Mutual labels:  jwt-token, jwt-authentication, jwt-auth
creek
使用Spring Security + JWT Token + RBAC的方式实现认证和授权,持久层使用Mybatis plus。避免每次重复编写认证和授权功能、角色管理、异常处理、参数校验等代码,直接上手业务代码,不再烦恼于构建项目与风格统一。
Stars: ✭ 21 (-58%)
Mutual labels:  spring-security, jwt-token, spring-data-jpa
TASK-Management-System
Spring Boot and Angular 7 web application for task management .
Stars: ✭ 34 (-32%)
Mutual labels:  spring-security, spring-data-jpa, jwt-authentication
Spring Examples
SpringBoot Examples
Stars: ✭ 67 (+34%)
Mutual labels:  spring-security, jwt-token, spring-data-jpa
Registration Login Spring Xml Maven Jsp Mysql
Registration and Login Example with Spring MVC, Spring Security, Spring Data JPA, XML Configuration, Maven, JSP, and MySQL.
Stars: ✭ 134 (+168%)
Mutual labels:  authorization, spring-security, spring-data-jpa
Oauthlib
A generic, spec-compliant, thorough implementation of the OAuth request-signing logic
Stars: ✭ 2,323 (+4546%)
Mutual labels:  authorization, jwt-authentication, token-based-authentication
MyAPI
A template to create awesome APIs easily ⚡️
Stars: ✭ 117 (+134%)
Mutual labels:  jwt-token, jwt-authentication, jwt-auth
React Login
A client side implementation of authentication using react.js for my blog on medium. This is the second part of my previous blog on how to implement scalable node.js server.
Stars: ✭ 105 (+110%)
Mutual labels:  jwt-token, jwt-authentication, jwt-auth
Jose2go
Golang (GO) implementation of Javascript Object Signing and Encryption specification
Stars: ✭ 150 (+200%)
Mutual labels:  jwt-token, jwt-authentication, jwt-auth
Laravel Jwt
Laravel with JWT Authentication for API development
Stars: ✭ 31 (-38%)
Mutual labels:  jwt-token, jwt-authentication, jwt-auth
Jwt
Go JWT signing, verifying and validating
Stars: ✭ 394 (+688%)
Mutual labels:  jwt-token, jwt-authentication, jwt-auth
API-Authentication-NodeJs
API Authentication using JWT's (JSON Web Tokens). Plug n Play inside any app which requires authentication. NodeJs Express MongoDB & Redis.
Stars: ✭ 162 (+224%)
Mutual labels:  jwt-token, jwt-authentication, jwt-auth
EasyTokenGenerator
This repo aims to dynamically and simply generate tokens in Token Based systems.
Stars: ✭ 15 (-70%)
Mutual labels:  jwt-token, jwt-authentication, token-based-authentication
Registration Login Spring Hsql
Registration and Login Example with Spring Security, Spring Boot, Spring Data JPA, HSQL, JSP
Stars: ✭ 208 (+316%)
Mutual labels:  authorization, spring-security, spring-data-jpa

Spring Boot Login example with Spring Security, MySQL and JWT

  • Appropriate Flow for User Login and Registration with JWT
  • Spring Boot Rest Api Architecture with Spring Security
  • How to configure Spring Security to work with JWT
  • How to define Data Models and association for Authentication and Authorization
  • Way to use Spring Data JPA to interact with MySQL Database

User Registration, Login and Authorization process.

spring-boot-login-example-flow

Spring Boot Server Architecture with Spring Security

You can have an overview of our Spring Boot Server with the diagram below:

spring-boot-login-example-architecture

For more detail, please visit:

Spring Boot Login example with MySQL and JWT

For H2 Embedded database

For MongoDB

Dependency

– If you want to use PostgreSQL:

<dependency>
  <groupId>org.postgresql</groupId>
  <artifactId>postgresql</artifactId>
  <scope>runtime</scope>
</dependency>

– or MySQL:

<dependency>
  <groupId>mysql</groupId>
  <artifactId>mysql-connector-java</artifactId>
  <scope>runtime</scope>
</dependency>

Configure Spring Datasource, JPA, App properties

Open src/main/resources/application.properties

  • For PostgreSQL:
spring.datasource.url= jdbc:postgresql://localhost:5432/testdb
spring.datasource.username= postgres
spring.datasource.password= 123

spring.jpa.properties.hibernate.jdbc.lob.non_contextual_creation= true
spring.jpa.properties.hibernate.dialect= org.hibernate.dialect.PostgreSQLDialect

# Hibernate ddl auto (create, create-drop, validate, update)
spring.jpa.hibernate.ddl-auto= update

# App Properties
bezkoder.app.jwtSecret= bezKoderSecretKey
bezkoder.app.jwtExpirationMs= 86400000
  • For MySQL
spring.datasource.url= jdbc:mysql://localhost:3306/testdb?useSSL=false
spring.datasource.username= root
spring.datasource.password= 123456

spring.jpa.properties.hibernate.dialect= org.hibernate.dialect.MySQL5InnoDBDialect
spring.jpa.hibernate.ddl-auto= update

# App Properties
bezkoder.app.jwtSecret= bezKoderSecretKey
bezkoder.app.jwtExpirationMs= 86400000

Run Spring Boot application

mvn spring-boot:run

Run following SQL insert statements

INSERT INTO roles(name) VALUES('ROLE_USER');
INSERT INTO roles(name) VALUES('ROLE_MODERATOR');
INSERT INTO roles(name) VALUES('ROLE_ADMIN');

Refresh Token

Spring Boot Refresh Token with JWT example

More Practice:

Spring Boot File upload example with Multipart File

Exception handling: @RestControllerAdvice example in Spring Boot

Spring Boot Repository Unit Test with @DataJpaTest

Spring Boot Pagination & Sorting example

Associations:

Spring Boot One To Many example with Spring JPA, Hibernate

Spring Boot Many To Many example with Spring JPA, Hibernate

JPA One To One example with Spring Boot

Deployment:

Deploy Spring Boot App on AWS – Elastic Beanstalk

Docker Compose Spring Boot and MySQL example

Fullstack CRUD App

Vue.js + Spring Boot + H2 Embedded database example

Vue.js + Spring Boot + MySQL example

Vue.js + Spring Boot + PostgreSQL example

Angular 8 + Spring Boot + Embedded database example

Angular 8 + Spring Boot + MySQL example

Angular 8 + Spring Boot + PostgreSQL example

Angular 10 + Spring Boot + MySQL example

Angular 10 + Spring Boot + PostgreSQL example

Angular 11 + Spring Boot + MySQL example

Angular 11 + Spring Boot + PostgreSQL example

Angular 12 + Spring Boot + Embedded database example

Angular 12 + Spring Boot + MySQL example

Angular 12 + Spring Boot + PostgreSQL example

Angular 13 + Spring Boot + H2 Embedded Database example

Angular 13 + Spring Boot + MySQL example

Angular 13 + Spring Boot + PostgreSQL example

Angular 14 + Spring Boot + H2 Embedded Database example

Angular 14 + Spring Boot + MySQL example

Angular 14 + Spring Boot + PostgreSQL example

React + Spring Boot + MySQL example

React + Spring Boot + PostgreSQL example

React + Spring Boot + MongoDB example

Run both Back-end & Front-end in one place:

Integrate Angular with Spring Boot Rest API

Integrate React.js with Spring Boot Rest API

Integrate Vue.js with Spring Boot Rest API

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].