Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

Microservice Application Overview

Microservice with Api Gateway, Eureka Discovery Client and User Service with KeyCloak authentication server


1. Keycloak Identity and Access Management

Keycloak is used for managing user authentication and authorization.

  • Docker Command to Run Keycloak:
    docker run -p 9090:8080 -e KC_BOOTSTRAP_ADMIN_USERNAME=admin -e KC_BOOTSTRAP_ADMIN_PASSWORD=admin quay.io/keycloak/keycloak:26.2.5 start-dev
  • Keycloak Admin Console URL: http://localhost:8080/
  • Default Admin Credentials:
    • Username: admin
    • Password: admin

2. Eureka Service Discovery

Eureka acts as a service registry for all microservices.


3. API Gateway

The API Gateway provides a single entry point for external clients to access the microservices.


4. User Service

The User Service handles user-related operations.


5. Accessing User Service Through API Gateway

All external interactions with the User Service should be routed through the API Gateway.

5.1 Create User

  • URL: http://localhost:8762/user/create

  • Method: POST

  • Content-Type: application/json

  • Payload Example:

    {
        "username": "asad123",
        "password": "12345",
        "email": "hm.ashad.zaman.123@gmail.com",
        "firstName": "Ashad123",
        "lastName": "zaman45",
        "phone": "01325781959"
    }

5.2 Getting an Access Token from Keycloak

To access protected resources, you'll need an access token from Keycloak.

  • Token Endpoint URL: http://localhost:8080/realms/refresh-memory-microservice/protocol/openid-connect/token

  • Request Method: POST

  • Payload (Form URL-Encoded):

    grant_type=password
    client_id=<your-client-id>
    username=<your-username>
    password=<your-password>
    client_secret=<client_secret>
    

    Note: Replace <your-client-id> and <your-client-secret> with the actual client ID configured in your Keycloak realm (e.g., refresh-memory-client).


5.3 Get User Details (Protected Endpoint)

This endpoint requires an access token obtained from Keycloak.

  • URL: http://localhost:8762/user/me

  • Method: GET

  • Authorization Header: Authorization: Bearer {token}

    Example: Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages