Skip to content

This is a demo project to show how to create a Singpass resource server using Spring Boot with Gradle with the client assertion flow.

Notifications You must be signed in to change notification settings

weehong/singpass-resource-server

Repository files navigation

Spring Boot - Singpass Resource Server

This is a demo project to show how to create a Singpass resource server using Spring Boot with Gradle with the client assertion flow.

Prerequisites

  • JDK 23
  • Gradle 8.12.1
  • Prepare environment variables:
SINGPASS_CLIENT_ID=
SINGPASS_REDIRECT_URL=
SINGPASS_ISSUER_URL=
SINGPASS_PUBLIC_JWKS_URL=
SINGPASS_SCOPE=
SINGPASS_JWKS_SECRET=

This variable will be used in the application.yaml file.

Authentication flow

  1. Frontend application redirects user to Singpass login page.
  2. User logs in with Singpass.
  3. Singpass redirects user back to frontend application with an authorization code.
  4. Frontend application sends the authorization code to the backend.
  5. Backend application exchanges the authorization code for an access token.
  6. Backend application uses the access token to access Singpass resources.
  7. Singpass returns the user's data to the backend application.

Endpoint

  • /api/v1/oidc/auth - This endpoint will redirect the user to the Singpass login page.
  • /api/v1/oidc/token - This endpoint will exchange the authorization code for an access token.

How to use

  • Clone this repository.
  • Run the application.
  • Access http://localhost:8080 to start the server

About

This is a demo project to show how to create a Singpass resource server using Spring Boot with Gradle with the client assertion flow.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages