Skip to content

alessandro-vault/jwt-spring-template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Spring API + JWT Auth Template

Starter REST API with JWT Security

Dependencies

  • Java OpenJDK 17
  • Postgres 12.9+

This API uses environment variables for local development, same for staging and deployment phase

This must be configured before running the app

Name Description
SPRING_ENV This sets the current environment dev, prod
DATABASE_URL Database URL for connection
DATABASE_USERNAME Database user eg. postgres
DATABASE_PASSWORD Secret for database access
JWT_SECRET Secret for jwt encoding

For a secret generation run

openssl rand -hex 32

Usage

Make a POST request to /login with this JSON format

{
 "username": ...,
 "password:" ...
}

You will receive a JWT Acess Token

Releases

No releases published

Packages

No packages published

Languages