This project is a Spring Boot application with OAuth2 resource server capabilities and a Postgres Storage, along with a React user interface. It is protected by Keycloak acting as the authorization server. The entirety of the application is hosted in Kubernetes, and the necessary deployment YAMLs are stored within their respective folders. The running version of the application can be accessed here.
⚠️ Be advised, OneAuth application may be subject to unexpected shutdowns at any given moment without prior notification. Contact me for further information.
The project is divided into two main components:
The backend is a Spring Boot application configured with the following dependencies:
- Spring Boot Starter Data JPA: Provides easy setup for Spring Data JPA.
- Spring Boot Starter Validation: Adds support for bean validation in Spring Boot applications.
- Spring Boot Starter OAuth2 Resource Server: Configures the application as an OAuth2 resource server, allowing it to validate and process OAuth2 tokens.
- Spring Boot Starter Web: Sets up Spring Web MVC.
- Springdoc OpenAPI Starter WebMVC UI: Enables generation of OpenAPI documentation for RESTful APIs.
- PostgreSQL Driver: Allows the application to interact with a PostgreSQL database.
- Lombok: Provides annotations to reduce boilerplate code.
- Testcontainers: Offers lightweight, throwaway instances of common databases for testing.
- Spring Boot Starter Test: Includes testing utilities and dependencies for Spring Boot applications.
- Spring Security Test: Provides testing utilities for Spring Security configurations.
The frontend is built using React, a popular JavaScript library for building user interfaces. It provides a user-friendly interface for interacting with the backend API.
- JDK 17
- Maven
- Docker
- Node.js
- npm (Node Package Manager)
- Clone this repository.
- Run
docker-compose up
- Set active profile as
local
by setting upSPRING_PROFILES_ACTIVE=local
in environment variables.
- You need to have the Backend running along with
docker-compose up
. - Switch to the
frontend
folder. - Run
npm install
to install UI dependencies. - Run
npm run dev
to run application locally in port3000
.
⚠️ Client credentials are subject to change, update your existing client credentials variableclient_secret
to match the one listed here if you face any issue.
- Import PostMan Collection
oauth_token.postman_collection.json
- Make sure
client_secret
collection variable is set to the latest one that isTW5jxBuNWqAwvoRDqM6tEkIfxcEOuYmi
- Make
Get OAuth Token
POST request, you would receiveaccess_token
in the response. - Use this to test out OneAuth APIs listed in the Swagger here.
- Follow the same method to fetch new token when the current one expires i.e. you receive 401 or 403 Exception.