Simple spring boot JWT authentication example

Overview

JWT authentication

To run this project

  1. You need jre 11 and Docker
  2. in /src/test/resources folder run docker-compose up -d, this starts a database in the Docker container
  3. Run an application

Api endpoints

  • POST: /user/create request(email, password)
    • curl -i -X POST "http://localhost:8080/user/create" -H "Content-Type: application/json" --data-binary "{\"email\":\"[email protected]\",\"password\":\"test123\"}"
  • POST: /auth/login request(email, password) response(accessToken refreshToken)
    • curl -i -X POST "http://localhost:8080/auth/login" -H "Content-Type: application/json" --data-binary "{\"email\":\"[email protected]\",\"password\":\"test123\"}"
  • POST: /auth/refresh request(refreshToken), response(accessToken)
    • curl -i -X POST "http://localhost:8080/auth/refresh" -H "Content-Type: application/json" --data-binary "{\"refreshToken\":\"tXr5njmMcnsiNBdkmfTKqkHOr8B0WqwS0Ew+7P0g9fviYD2l+KE+YGu6zAxk76mH4pLQehYtiBGpy0qgdqCCWg==\"}"
  • GET: /logout
    • curl -i -X GET "http://localhost:8080/logout" -H "Content-Type: application/json" -H "Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJhdXRoMCIsIklEIjoiYzczY2EwZWMtZDg5MS00YzJmLWJiYmEtMzU5MzJkNjE1ODE5IiwiRU1BSUwiOiJhYUBnbWFpbC5jb20iLCJleHAiOjE2NDQxMDQyODZ9.Xyu3D9JFW-z-9CFc3FuvFMaRVNU-n8PMsA3-WCCwOOA"
  • GET: /user
    • curl -i -X GET "http://localhost:8080/user" -H "Content-Type: application/json" -H "Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJhdXRoMCIsIklEIjoiYzczY2EwZWMtZDg5MS00YzJmLWJiYmEtMzU5MzJkNjE1ODE5IiwiRU1BSUwiOiJhYUBnbWFpbC5jb20iLCJleHAiOjE2NDQxMDQyODZ9.Xyu3D9JFW-z-9CFc3FuvFMaRVNU-n8PMsA3-WCCwOOA"
You might also like...
Spring-with-maven - Spring Boot App with Postgresql and maven

Spring Boot Api Aplikasi ini dibuat menggunakan bahasa kotlin dan untuk database

Spring Boot Example with Kotlin and Domain Driven Design

Spring Boot Kotlin Domain Driven Design Example Just an example project where ddd is implemented with some other great patterns and architecture from

Spring boot kotlin example

Spring Boot Kotlin Example Gradle 配置 代理配置 当内网环境需要代理时,在项目根目录添加文件 gradle.propertie

Spring-graphql-getting-started - Spring for GraphQL provides support for Spring applications built on GraphQL Java

Getting Started with GraphQL and Spring Boot Spring for GraphQL provides support

A simple (and naive) RESTful API made with Ktor, jasync-sql and JWT.

A simple (and naive) RESTful API made with Ktor, jasync-sql and JWT. Route Method Description /account POST Create a new account /account DELETE Delet

Kotlin backend based on the Clean Architecture principles. Ktor, JWT, Exposed, Flyway, KGraphQL/GraphQL generated endpoints, Gradle.
Kotlin backend based on the Clean Architecture principles. Ktor, JWT, Exposed, Flyway, KGraphQL/GraphQL generated endpoints, Gradle.

Kotlin Clean Architecture Backend Kotlin backend based on the Clean Architecture principles. The application is separated into three modules: Domain,

SpringBoot SpringDoc JWT
SpringBoot SpringDoc JWT

springboot-springdoc-jwt Things todo list Clone this repository: git clone https

Grocery - A simple CRUD Project using Spring Boot, Kotlin and MongoDB

Grocery - A simple CRUD Project using Spring Boot, Kotlin and MongoDB

Simple Todo list API using Spring-Boot, Webflux, Kotlin, Coroutines, & PostgreSQL

Simple Todo list API using Spring-Boot, Webflux, Kotlin, Coroutines, & PostgreSQL

Biometric Authentication Fingerprint Example
Biometric Authentication Fingerprint Example

Biometric Authentication Fingerprint Example See the blog post of this project here Project Presentation First, let's add the Biometric library to our

A sample skeleton backend app built using Spring Boot kotlin, Expedia Kotlin Graphql, Reactive Web that can be deployed to Google App Engine Flexible environmennt

spring-kotlin-gql-gae This is a sample skeleton of a backend app that was built using: Spring Boot(Kotlin) Reactive Web Sprinng Data R2DBC with MYSQL

Sample Social Login Project of Spring Boot and Kotlin

Sample-Spring-Boot-Social-Kotlin Sample Social Login Project of Spring Boot and Kotlin dependencies dependencies { implementation("org.springframewor

This repository demonstrates how Kotlin can simplify Spring Boot configuration properties file mapping

Kotlin spring-boot nested config props This repository demonstrates how Kotlin can simplify Spring Boot configuration properties file mapping @Constru

My personal template for a Spring Boot REST reactive webapp

My personal spring boot kotlin reactive template Features Spring Security implementation with JWT access and refresh token MongoDB database Project Co

Generated with spring boot kotlin starter kit

Kotlin backend Generated with spring boot kotlin starter kit The idea is to: Get a microservice written in kotlin for managing users and roles. To be

The Okila server project uses the Spring boot framework and uses the Kotlin language

Okila-Server The Okila server project uses the Spring boot framework and uses the Kotlin language Format Response //The response successfully format

This is my first Spring Boot with Kotlin project and used React as frontend.
This is my first Spring Boot with Kotlin project and used React as frontend.

༒☬༒ ꜱᴘʀɪɴɢ ʙᴏᴏᴛ + ᴋᴏᴛʟɪɴ ༒☬༒ This project is simple course enrolment site built with React with Typescript and Spring boot with Kotlin. Frontend - Ove

An application that simulate the Swedish Transport Agency, implemented with Spring Boot, Kotlin and GraphQL

graphql-kotlin-spring-server An application that simulate the Swedish Transport Agency, implemented with Spring Boot, Kotlin and GraphQL Running the s

API for a library using Kotlin, Spring-boot and covered by test

Library API This API is to create Books and be able to borrow from them I'm using: Spring Boot version 2.5.6 Kotlin 1.5.31 Java 11 I'm implementing us

Owner
null
Multitask、MultiThread(MultiConnection)、Breakpoint-resume、High-concurrency、Simple to use、Single/NotSingle-process

FileDownloader Android multi-task file download engine. 中文文档 FileDownloader2 Now, FileDownloader2-OkDownload is released, okdownload will contain all

LAIX Inc. (formerly LingoChamp Inc.) 10.7k Jan 3, 2023
KodeEditor - A simple code editor with syntax highlighting and pinch to zoom

KodeEditor - A simple code editor with syntax highlighting and pinch to zoom

Markus Ressel 65 Oct 28, 2022
A simple screen starter written in kotlin

screen-starter A simple screen starter written in kotlin. Compilation Use clean shadowJar! Usage Use java -jar screen-starter-1.0-SNAPSHOT.jar --confi

GrowlyX 3 Sep 1, 2021
This repository contains a simple script that lets you kill gradle and kotlin daemons.

AndroidDaemonKiller This repository contains a simple script that lets you kill gradle and kotlin daemons. After updating gradle or kotlin or checking

Paul Woitaschek 25 Dec 3, 2022
Simple Artificial Neural Network java library

SANN Simple Artificial Neural Network java library WIP Creating neural network Variant 1 //create new net (input, hidden, default len, output) Net net

Korpusov Maxim 14 Oct 11, 2022
Simple system for building dialogue in Cepi

Dialogue Dialogue builder for Cepi Installation Download the jar from Releases OR compile it yourself. Instructions to do so are in Compile header Dro

Cepi 2 Dec 14, 2022
A simple and scalable Android bot emulation framework, as presented at Black Hat Europe's Arsenal

m3 A simple and scalable Android bot emulation framework. A detailed explanation can be found here. This project was first published at Black Hat Euro

null 22 Aug 20, 2022
Create a simple one screen application with scrollable table view

Create a simple one screen application with scrollable table view

Nikola Crnogorac 0 Jan 2, 2023
Implementing JWT token authentication on Android with Clean Architecture

Implementando autenticação com token JWT no Android com Clean Architecture Implementar autenticação com Token JWT no Android não é uma tarefa fácil. É

Rocketseat Experts Club 4 Jun 18, 2022
Secure your REST APIs with Spring Security, Resource and Authorization Server from zero to JWT

Secure REST APIs with Spring ./mvnw RTFM YouTube: Spring Security Patterns YouTube: Spring Security 5.5 From Taxi to Takeoff Official Apache Maven doc

Maksim Kostromin 1 Dec 5, 2021