Skip to content

Modern licensing framework with Spring Boot 3 — featuring secure key generation, encryption, token validation services, SDK & CLI tools. Integrated with Keycloak and ships with Docker for easy setup.

License

Notifications You must be signed in to change notification settings

bsayli/licensing

Repository files navigation

Welcome to the Licensing Project!

Build Release codecov Java Spring Boot Keycloak Redis Maven Docker Caffeine JWT License

Licensing Project preview
Spring Boot • Keycloak • Redis • EdDSA — Complete licensing framework


Why this project? Licensing is often treated as an afterthought in enterprise applications. This project provides a complete end-to-end licensing framework built on Spring Boot 3, integrating Keycloak, Redis, and EdDSA to standardize issue/validate flows with a Service, SDK, and CLI.


Licensing flow diagram
End-to-end license validation flow


Setting Up the Environment

  1. Clone the Repository
git clone https://github.com/bsayli/licensing.git
  1. Extract Keycloak DB
  • Get licensing-keycloak.zip from /licensing/db
  • Copy and extract into your home directory ($HOME)

TL;DR – Quickstart

cd licensing/docker-compose/server && docker-compose up -d
# wait ~45s on first run
cd ../client && docker-compose up

Project Purpose

This project provides a complete licensing framework for applications, combining secure key generation, detached digital signatures, and token validation (JWT/EdDSA). It is designed to ensure license authenticity, prevent misuse, and integrate seamlessly with Keycloak for user identity and license metadata.


Subprojects

  • license-generator: Java project for license key generation, encryption, and cryptographic tooling.
  • licensing-service: Spring Boot application that issues and validates license tokens.
  • licensing-service-sdk: Spring Boot application acting as a client SDK (with caching & detached signature) for integrating licensing capabilities into external apps.
  • licensing-service-sdk-cli: Command-line tool for testing and interacting with the licensing service.

Repository Structure

Directory Purpose
db Keycloak database backup (licensing-keycloak.zip)
docker-compose Docker Compose files to run servers and client
scripts Utility scripts to run the client (run_license_sdk_cli.sh)

Prerequisites

  • Git client installed
  • Docker installed and running
  • Docker Compose installed and running
  • Java (>= 21.x)
  • Maven (>= 3.x)

Keycloak Configuration

This project relies on Keycloak to store and manage license metadata.
A full step-by-step guide is provided in KEYCLOAK_CONFIG.md.


Running the Licensing Service

cd licensing/docker-compose/server
docker-compose up -d

This starts Keycloak, Licensing Service, and Licensing Service SDK in the background. Wait ~45 seconds for the services to initialize on the first run.

Optional (local/dev only): If you want to start only Keycloak + Redis separately, you can use docker-compose.infra.yml.


Running the License Validation Tool via Docker

cd licensing/docker-compose/client
docker-compose up

Logs should confirm validation:

licensing-service-sdk-cli | INFO License validated successfully.
licensing-service-sdk-cli | INFO Token: <JWT_TOKEN>
licensing-service-sdk-cli | INFO Message: License is valid

Running the License Validation Tool Directly (Optional 1)

cd licensing/licensing-service-sdk-cli
mvn clean package
cd target
java -jar licensing-service-sdk-cli-1.0.1.jar -s crm -v 1.5.0 -i "crm~macbook~00:2A:8D:BE:F1:56" -k "BSAYLI.<opaqueB64Url>"

Running the License Validation Tool with Script (Optional 2)

cd licensing/scripts
chmod +x run_license_sdk_cli.sh
./run_license_sdk_cli.sh -s billing -v 2.0.0 -i "billing~macbook~00:2A:8D:BE:F1:56" -k "BSAYLI.<opaqueB64Url>"

Notes

  • CLI examples must always be provided on a single line.
  • If parameters contain spaces or special characters, they should be enclosed in quotes ("...").

Security Note

Demo configuration files contain inline secrets in application.yml. In production, HashiCorp Vault or another secret manager should be used. Vault integration is part of the roadmap.


Feedback & Questions

If you notice any issues in this documentation or have suggestions for improvements, feel free to open an Issue or a Discussion.


🗺️ Roadmap

  • Move sensitive configs to HashiCorp Vault for secure secrets management
  • Extend Keycloak integration to manage licenses (create, update, revoke) via dedicated endpoints

⭐ Support

If you found this project useful, please consider giving it a star ⭐ on GitHub — it helps others discover it too!


Related Modules (Quick View)

Module Purpose Documentation
licensing-service REST API for issuing and validating tokens README
licensing-service-sdk Client SDK for integration README
licensing-service-sdk-cli CLI demo client README
license-generator Key & signature tooling README

About

Modern licensing framework with Spring Boot 3 — featuring secure key generation, encryption, token validation services, SDK & CLI tools. Integrated with Keycloak and ships with Docker for easy setup.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages