Code Monkey home page Code Monkey logo

angel-raa / spring-security-jwt-authentication-and-authorization Goto Github PK

View Code? Open in Web Editor NEW
9.0 1.0 1.0 287 KB

This example shows how to implement JWT token-based authentication and authorization in a Spring Boot application. The project uses Spring Security to provide authentication and authorization, JPA and PostgreSQL as the database.

Java 99.27% Dockerfile 0.73%
docker-compose java jdk-17 jwt-token spring-boot spring-security jpa postgresql spring-projects

spring-security-jwt-authentication-and-authorization's Introduction

spring security jwt authentication and authorization

Si encuentras útil este repositorio, ¡por favor ayúdanos marcándolo con una ⭐! 😊

Tecnologías Utilizadas

  • JDK 17
  • Spring Boot 3
  • Spring Data Jpa
  • Spring security 6
  • PostgreSQL 15
  • Java JWT
  • Docker

Prerrequisitos

Asegúrate de tener instalados los siguientes componentes en tu entorno de desarrollo antes de comenzar:

  1. Git
  2. Docker

Configuración del Entorno

Clonar el repositorio en tu máquina local

git clone https://github.com/Angel-Raa/spring-security-jwt-authentication-and-authorization.git

Navegar al directorio del proyecto

Dirígete al directorio del proyecto recién clonado utilizando el siguiente comando:

cd spring-security-jwt-authentication-and-authorization

Crear y Configurar file.env y db.env

Debes crear dos archivos de configuración, file.env y db.env, en el directorio raíz del repositorio clonado.

file.env Este archivo contiene las variables de entorno para la aplicación.

SPRING_DATASOURCE_URL=jdbc:postgresql://database:5432/tu_basedatos
SPRING_DATASOURCE_USERNAME=tu_usuario
SPRING_DATASOURCE_PASSWORD=tu_contraseña
SPRING_JPA_PROPERTIES_HIBERNATE_DIALECT=org.hibernate.dialect.PostgreSQLDialect
SPRING_JPA_HIBERNATE_DDL_AUTO=update
SPRING_JPA_SHOW=true

db.env Este archivo contiene las credenciales para la base de datos.

POSTGRES_DB=nombre_de_tu_basedatos
POSTGRES_PASSWORD=contraseña_de_la_base_de_datos
POSTGRES_USER=usuario_de_la_base_de_datos

Asegúrate de reemplazar nombre_de_tu_basedatos, contraseña_de_la_base_de_datos y usuario_de_la_base_de_datos con los valores adecuados para tu configuración.

Construir y ejecutar los contenedores de Docker Compose

docker compose up -d

Swagger Documentation

http://localhost:8000/api/v1/swagger-ui/index.html#/

Recursos Adicionales

Aquí hay algunos recursos adicionales que podrían ser útiles:

spring-security-jwt-authentication-and-authorization's People

Contributors

angel-raa avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

rrsc

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.