Skip to content

rajithd/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 Cars Service

java -jar cars-service/build/libs/cars-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": "a@a.com",
    "password": "password",
    "name": "name"
}'
{
    "accessToken": "<TOKEN>",
    "refreshToken": "<TOKEN>"
}

Execute Get Cars REST call without Authorization header

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

Execute Get Card REST call with Authorization header from step 1

curl --location --request GET 'http://localhost:8080/cars' \
--header 'Authorization: <TOKEN>'
[
    {
        "carId": "1",
        "carName": "Audi"
    }
]

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published