Skip to content

satheeshkumar3/spring-cloud-security-jwt

Repository files navigation

Spring Cloud Security JWT

Spring Cloud Security JWT is Simple MicroServices project to demonstrate Spring Cloud Components and how it interacts with Config server, Discovery Server and how its performing security validation.

Architecture

My Image

Prerequisites

  • Java 17

Build all projects

./gradlew clean build

Run Config Service

java -jar config-service/build/libs/config-service-0.0.1.jar

Run Discovery Service

java -jar discovery-service/build/libs/discovery-service-0.0.1.jar

Run Gateway Service

java -jar gateway-service/build/libs/gateway-service-0.0.1.jar

Run Auth Service

java -jar auth-service/build/libs/auth-service-0.0.1.jar

Run bike Service

java -jar bike-service/build/libs/bike-service-0.0.1.jar

Testing Scenarios

Execute auth register REST call

curl --location --request POST 'http://localhost:8080/auth/register' \
--header 'Content-Type: application/json' \
--data-raw '{
    "email": "[email protected]",
    "password": "password",
    "name": "name"
}'
{
    "accessToken": "<TOKEN>",
    "refreshToken": "<TOKEN>"
}

Execute Get Cars REST call without Authorization header

curl --location --request GET 'http://localhost:8080/bike'
401 

Execute Get Card REST call with Authorization header from step 1

curl --location --request GET 'http://localhost:8080/bike' \
--header 'Authorization: <TOKEN>'
[
    {
        "bikeId": "1",
        "bikeName": "RTR 160"
    }
]

About

spring-security

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors