BadgerPc / jwt-spring-boot-angular-scaffolding

Java 11, Spring Boot and Angular multi-module project secured with JWT that builds as a single jar.

Home Page:https://keepgrowing.in/java/springboot/securing-your-spring-boot-and-angular-app-with-jwt-1-introduction/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

jwt-spring-boot-angular-scaffolding

keep growing logo

This project is a multi-module application, using Spring Boot for the backend and Angular for the frontend. The project can be built into a single jar file using Maven. You can also run the modules separately during development.

The backend and frontend are secured with JSON Web Token.

To learn how to set up a project like this one, check out the following posts:

Getting Started

To clone the repository, run in the command line:

$ git clone https://github.com/little-pinecone/jwt-spring-boot-angular-scaffolding.git

You can build the application with:

$ mvn clean install

Sign up request

You need to create a test user:

sign up request screenshot

  • path: http://localhost:8080/api/users

  • body:

{
    "userCredentials": {
        "username": "user",
        "password": "test"
    }
}

Overview and technical features

  • The project currently serves a login page and hard-coded pastry data returned from the API.
  • It allows registering new users, handles login requests.
  • It serves data from the API to authenticated and authorized users.
  • The user experience is enhanced thanks to the AuthGuard implementation.

Running tests

Run all backend tests with the following command in the root directory:

$ mvn test

Run all frontend tests with the following command in the frontend/src/main/angular directory:

$ ng test

Running in production

Set the apiUrl const in frontend/src/main/angular/src/environments/environment.prod.ts to the path for the production environment.

Override the default TokenProperties values. E.g. to override the expiration time of tokens you can add security.jwt.expiration=your_value to the application.properties file.

Built With

Screenshots

login page cookies

License

This project is licensed under the MIT License - see the license details.

About

Java 11, Spring Boot and Angular multi-module project secured with JWT that builds as a single jar.

https://keepgrowing.in/java/springboot/securing-your-spring-boot-and-angular-app-with-jwt-1-introduction/


Languages

Language:Java 49.6%Language:TypeScript 41.8%Language:HTML 5.4%Language:JavaScript 2.9%Language:CSS 0.3%