Skip to content

JWTTestKit is a lightweight tool for testing JWT-based authentication. It generates tokens and hosts a mock JWKS endpoint, simplifying the simulation of authentication flows without real-world services.

License

Notifications You must be signed in to change notification settings

rjaros87/JWTTestKit

Repository files navigation

JWT Test Kit 🔐

Java Micronaut License

Buy Me A Coffee

A powerful Micronaut-based toolkit for generating and managing JWT tokens for testing purposes. Perfect for developers who need to simulate identity provider tokens during development and testing phases using JWKS endpoint.

✨ Features

  • 🎯 Generate JWT tokens with custom claims
  • 🔑 JWKS endpoint for key management. See JWKS Configuration
  • 🔄 Support for common identity providers:
    • AWS Cognito
    • Okta
    • Custom
  • 📚 Interactive Swagger UI documentation
  • 🏥 Health check endpoints for Kubernetes
  • 🐳 Docker support
  • ⚡ Native image support with GraalVM
  • ⎈ Helm chart for easy deployment on Kubernetes

🚀 Getting Started

Prerequisites

  • Java 21 or higher
  • Gradle 8.x (included via wrapper)

Running the Application

  1. Clone the repository:

    git clone https://github.com/rjaros87/JWTTestKit.git
    cd JWTTestKit
  2. Build and run using Gradle:

    ./gradlew run

    Or build a native image:

    ./gradlew nativeCompile
  3. The application will start on port 8080 by default

🐳 Docker Support

Build Docker image:

./gradlew dockerBuild

Build native Docker image:

./gradlew dockerBuildNative

⎈ Helm chart

To deploy the JWT Test Kit on Kubernetes, you can use the provided Helm chart. Follow these steps:

  • Add the Helm repository:
helm repo add jwt-testkit https://rjaros87.github.io/JWTTestKit
  • Update the Helm repository:
helm repo update
  • Install the JWT Test Kit chart:
helm install jwt-testkit jwt-testkit/jwt-testkit
  • Access the application using the service name jwt-test-kit and the port default port 80 for http in your Kubernetes cluster.

🔧 API Endpoints

Fetch in Bruno

📚 JWT Token Generation

Management

Health Check

  • URL: /health
  • Method: GET
  • Port: 8082 (configurable via MANAGEMENT_PORT)

⚙️ Configuration

Key configurations can be adjusted in application.yml:

  • Server ports
  • JWT signing keys
  • Token expiration times
  • Management endpoints

JWKS Configuration

To configure JWKS in your Micronaut application, add the following properties to your application.yml file:

micronaut:
  security:
    enabled: true
    token:
      jwt:
        signatures:
          jwks:
            custom:
              url: http://localhost:8080/JWTTestKit/jwks

Exposed Environment Variables

You can configure the application using the following environment variables:

  • APPLICATION_PORT – The port on which the JWT Test Kit application runs (default: 8080).
  • APPLICATION_HOST – The host address where the JWT Test Kit application runs (default: localhost).
  • APPLICATION_SCHEME – The protocol used by the JWT Test Kit application (default: http).

🛠️ Building from Source

./gradlew clean build

📄 License

This project is licensed under the Apache License 2.0 - see the LICENSE file for details.

🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

About

JWTTestKit is a lightweight tool for testing JWT-based authentication. It generates tokens and hosts a mock JWKS endpoint, simplifying the simulation of authentication flows without real-world services.

Resources

License

Stars

Watchers

Forks

Packages