/AuthorizeMe

Primary LanguageJavaApache License 2.0Apache-2.0

This is a simple Angular/Spring testbed application with following features:

  • Spring Boot / JPA / Rest Repository
  • JWT - JSON Web Token
  • RBAC - Role based access control
  • Spring Method security
  • Angular - Drap and Drop
  • Angular - Path/Role based authorization checking
  • Angular - Simple collapsable status bar
  • SSE - Simple client stream listener for receiving updates when data changed elsewhere

Install

  • Checkout this repo
  • Install npm and run npm install
  • Import project to whatever IDE

Resources

Thanks to following persons/resources as unordered list which helped me to build this project:

  • Imesha Sudasingha - Role Based Access Control (RBAC) with Spring Boot and JWT
  • Sergio Lema - Secure Your Fullstack Angular - Spring Boot Application With the JWT Authentication
  • Dan Vega - Spring Security JWT: How to secure your Spring Boot REST APIs with JSON Web Tokens
  • Frontend

    This project was generated with Angular CLI version 16.x.x.

    Components

    Authentication

    The authentication used is JWT. First, the user must login in the backend with a username and password. If the credentials are correct, a JWT will be returned. The JWT will be stored in the localstorage for further usage. When available the JWT will be sent in the Authorization Header for each request made with axios.

    Backend

    The backend service is a Spring Boot application with JWT authentication. Further there is a role based access control (RBAC) implemented which might be easily adopted to other role based mechanism. Roles/Permissions have to be hard coded by nature here since the services are tight to specific roles.

    Disclaimer

    Spring and Angular are highly dynamic frameworks. This project is based on technology of year 2023. This project is just a showcase and not a production ready application. Further there is no guarantee of correctness or completeness of the code. Use it at your own risk. Please feel to complain about major misconceptions I am more than happy to learn from it.

    Remarks

    Spring HATEOAS is an interesting concept. It strikes me it is obviously somehow hard wired into Spring Rest and can not easily be avoided. There might be many pros and cons, the main problem is there are not many public libraries supporting it.