Code Monkey home page Code Monkey logo

spring-jwt-demo's Introduction

Spring REST JWT Security Demo Project


Descripción

Este proyecto fue creado siguiendo el tutorial de la profesora Ivana Soledad Rojas Córsico (Perfil de GitHub) a quién le agradezco su forma tan clara de explicar.
El objetivo de este repositorio es compartir el conocimiento y habilidades adquiridas en el tutorial. el repositorio original del proyecto se encuentra en el siguiente enlace Repositorio de la profesora.


El tutorial explica la implementación de un sistema de autenticación y autorización de usuarios en una API REST utilizando JWT.

El proyecto fue desarrollado utilizando las siguientes tecnologías:

  • Spring Boot 3
  • Spring Security 6
  • JWT Authentication

Se siguio el siguiente diagrama para la autenticación/registro de usuarios:

Diagrama autenticación

Y el siguiente diagrama de validación de token:

Diagrama autenticación


Endpoints de la API

/auth/login [POST]

Este endpoint recibe un objeto JSON con los datos de usuario y contraseña, si los datos son correctos se genera un token JWT y se devuelve en la respuesta.

POST http://localhost:8080/auth/login
Content-Type: application/json

{
  "username": "string",
  "password": "string"
}
/auth/register [POST]

Este endpoint recibe un objeto JSON con los datos de usuario para registrarlo en la base de datos.

POST http://localhost:8080/auth/register
Content-Type: application/json

{
  "username": "string",
  "password": "string",
  "firstName": "string",
  "lastName": "string",
  "country": "string"
}
/api/v1/demo [POST]

Este endpoint es el único que requiere autenticación, se debe mandar el token JWT en el header Authorization para poder acceder a él.

POST http://localhost:8080/api/v1/demo
Authorization: Bearer {{token}}

spring-jwt-demo's People

Contributors

developerarmando 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.