Giter Site home page Giter Site logo

tonyhokan / angular-11-spring-boot-jwt-authentication Goto Github PK

View Code? Open in Web Editor NEW

This project forked from bezkoder/angular-11-spring-boot-jwt-authentication

0.0 1.0 0.0 563 KB

Angular 11 Spring Boot JWT Authentication example with Authorization | User Registration & Login

JavaScript 3.47% TypeScript 41.60% HTML 12.86% CSS 2.34% Java 39.73%

angular-11-spring-boot-jwt-authentication's Introduction

In this tutorial, I will show you how to build a full stack Angular 11 + Spring Boot JWT Authentication example. The back-end server uses Spring Boot with Spring Security for JWT Authentication & Authorization, Spring Data JPA for interacting with database. The front-end will be built using Angular 11 with HttpInterceptor & Form validation.

Angular 11 Spring Boot JWT Authentication example

It will be a full stack, with Spring Boot for back-end and Angular 11 for front-end. The system is secured by Spring Security with JWT Authentication.

User can signup new account, login with username & password. Authorization by the role of the User (admin, moderator, user) Screenshots Here are UI screenshots of our system.

– Anyone can access a public page before logging in:

Angular 11 Spring Boot JWT Authentication Public Page

– New user registration:

Angular 11 Spring Boot JWT Authentication User Registration

– Signup Form Validation:

Angular 11 Spring Boot JWT Authentication Form Validation

– After signup is successful, User can login:

Angular 11 Spring Boot JWT Authentication User Login

-Loggedin User can access Profile page/ User page:

Angular 11 Spring Boot JWT Authentication Profile Page

Angular 11 Spring Boot JWT Authentication User Board

– This is UI for admin:

Angular 11 Spring Boot JWT Authentication Admin UI

– If a User who doesn’t have Admin role tries to access Admin/Moderator Board page:

Angular 11 Spring Boot JWT Authentication Authorization

Demo

This is full Angular + Spring Boot JWT authentication demo (with form validation, check signup username/email duplicates, test authorization with 3 roles: Admin, Moderator, User).

Angular + Spring Boot JWT Authentication & Authorization example

Flow for User Registration and User Login

The diagram shows flow for User Registration process and User Login process. Angular 11 Spring Boot JWT Authentication Flow

It’s not too difficult to understand. We have 2 endpoints for authentication:

  • api/auth/signup for User Registration
  • api/auth/signin for User Login

If Client wants to send request to protected data/endpoints, a legal JWT must be added to HTTP Authorization Header.

Spring Boot & Spring Security for Back-end

Angular 11 Spring Boot JWT Authentication Back-end

Angular 11 for Front-end

Angular 11 Spring Boot JWT Authentication Front-end

For more details, please visit: https://bezkoder.com/angular-11-spring-boot-jwt-auth/

angular-11-spring-boot-jwt-authentication's People

Contributors

tienbku avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.