A lightweight Java library for creating, signing, and validating JSON Web Tokens (JWT).
Designed as a reusable dependency for backend services that require authentication and secure token handling.
This module provides:
- 🔑 JWT token generation
- 🔍 Token validation and signature verification
- 🕒 Support for expiration times
- 🧪 Small and dependency-friendly design
- 🔄 Easy integration in Javalin, Spring, Ktor, or any backend service
Perfect for microservices, standalone Java apps, or students learning authentication mechanics.
<dependency>
<groupId>com.yourname</groupId>
<artifactId>jwt-token-dependency</artifactId>
<version>1.0.0</version>
</dependency>(Replace groupId/artifactId/version with your actual values.)
implementation 'com.yourname:jwt-token-dependency:1.0.0'JwtService jwt = new JwtService("super-secret-key", 30 * 60 * 1000);
String token = jwt.createToken("user123");
System.out.println(token);JwtService jwt = new JwtService("super-secret-key", 30 * 60 * 1000);
boolean isValid = jwt.validateToken(token);
if (isValid) {
String userId = jwt.getSubject(token);
System.out.println("Authenticated user: " + userId);
}| Setting | Description |
|---|---|
| SECRET_KEY | The signing key used to sign tokens |
| TOKEN_EXPIRE_TIME | Expiration time in milliseconds |
| ISSUER | (Optional) token issuer identity |
+------------------------+
| Your Backend |
| (Javalin / Spring) |
+-----------+------------+
|
| uses
v
+------------------------+
| JWT Token Dependency |
| - createToken() |
| - validateToken() |
| - getSubject() |
+-----------+------------+
|
| generates / validates
v
+-----------------+
| JWT Token |
| (signed JWT) |
+-----------------+
If the project includes tests:
mvn testTo publish locally:
mvn clean installTo publish to Maven Central or a private repository, add your distributionManagement settings.
MIT License (or whatever license you choose).
Pull requests are welcome. Feel free to open issues for bug reports or feature requests.