Auth Service is designed to be production-ready from the start, but several configuration steps must be completed before it is safe to expose publicly. TheDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/ricardomb-tech/auth-service/llms.txt
Use this file to discover all available pages before exploring further.
prod Spring profile has no default values for any environment variable — this is intentional. Every secret, credential, and connection string must be supplied explicitly through the environment, so a misconfigured deployment fails loudly at startup rather than silently running with insecure placeholders.
Required Environment Variables
All of the following variables must be set in the environment before starting Auth Service with theprod profile. There are no fallbacks.
| Variable | Description |
|---|---|
DB_HOST | Hostname or IP address of the PostgreSQL 15 server. |
DB_PORT | PostgreSQL port (typically 5432). |
DB_NAME | Name of the database (e.g. auth_service). |
DB_USER | PostgreSQL user with read/write access to DB_NAME. |
DB_PASSWORD | Password for DB_USER. |
JWT_SECRET_CURRENT | Active HS256 signing secret. Must be ≥ 256 bits (32+ random bytes, base64-encoded). |
JWT_SECRET_PREVIOUS | Previous signing secret kept during rotation. Set to empty string when not rotating. |
GOOGLE_CLIENT_ID | OAuth2 client ID from Google Cloud Console. |
GOOGLE_CLIENT_SECRET | OAuth2 client secret from Google Cloud Console. |
GITHUB_CLIENT_ID | OAuth2 client ID from GitHub Developer Settings. |
GITHUB_CLIENT_SECRET | OAuth2 client secret from GitHub Developer Settings. |
OAUTH2_SUCCESS_REDIRECT_URI | Frontend URI to redirect to after a successful OAuth2 login (e.g. https://app.example.com/oauth2/success). |
OAUTH2_FAILURE_REDIRECT_URI | Frontend URI to redirect to after a failed OAuth2 login (e.g. https://app.example.com/oauth2/failure). |
MAIL_HOST | SMTP server hostname for transactional email. |
MAIL_PORT | SMTP server port (e.g. 587 for STARTTLS, 465 for SMTPS). |
KAFKA_BOOTSTRAP_SERVERS | Comma-separated list of Redpanda/Kafka broker addresses (e.g. broker1:9092,broker2:9092). |
AUTH_ADMIN_EMAIL | Email address for the initial admin account (FR-12). Required at startup to seed the first administrator. |
AUTH_ADMIN_PASSWORD | Password for the initial admin account. Must meet the application’s password-strength requirements. |
APP_BASE_URL | Public base URL of the Auth Service (e.g. https://auth.example.com). Used to construct verification and password-reset links in emails. |
Security Checklist
Generate a strong JWT signing secret
The JWT access tokens are signed with HS256. The secret must be at least 256 bits (32 bytes) of cryptographically random data.Set the output as
JWT_SECRET_CURRENT. Store it in your secrets manager (AWS Secrets Manager, HashiCorp Vault, Kubernetes Secrets, etc.) — never commit it to source control or bake it into a container image.Configure production SMTP credentials
Replace the MailHog dev values with real SMTP server details. Depending on your provider, you will also need to set
MAIL_USERNAME and MAIL_PASSWORD (or equivalent authentication properties) in your environment or Spring configuration overlay.Register production OAuth2 callback URLs
In the Google Cloud Console and GitHub Developer Settings, add the production callback URL for each provider before setting the client credentials:
- Google:
https://auth.example.com/login/oauth2/code/google - GitHub:
https://auth.example.com/login/oauth2/code/github
GOOGLE_CLIENT_ID, GOOGLE_CLIENT_SECRET, GITHUB_CLIENT_ID, GITHUB_CLIENT_SECRET) and update the redirect URIs:Ensure PostgreSQL is network-isolated
The database should not be reachable from the public internet. Place it in a private subnet or VPC, and restrict access to only the Auth Service’s network identity (security group, firewall rule, or equivalent). Verify
DB_HOST resolves to a private address.Start the service with the prod profile
BeanCreationException or IllegalStateException and exit immediately — check the log for the variable name.Zero-Downtime JWT Secret Rotation
Auth Service supports rotating the HS256 signing secret without invalidating in-flight access tokens, using a two-slot secret pair:JWT_SECRET_CURRENT and JWT_SECRET_PREVIOUS.
The verification logic tries JWT_SECRET_CURRENT first and falls back to JWT_SECRET_PREVIOUS if validation fails. This means tokens signed with either secret are accepted during the rotation window.
Rotation procedure:
- Before rotation:
JWT_SECRET_CURRENTholds the active secret;JWT_SECRET_PREVIOUSis empty or holds an older key. - Introduce the new secret: Set
JWT_SECRET_PREVIOUSto the current value ofJWT_SECRET_CURRENT, and setJWT_SECRET_CURRENTto a newly generated secret (openssl rand -base64 32). - Redeploy the service with the updated environment. New tokens are immediately signed with the new
JWT_SECRET_CURRENT; tokens already issued with the old secret are still validated viaJWT_SECRET_PREVIOUS. - Wait for old tokens to expire: Access tokens have a 15-minute TTL (
auth.jwt.access-ttl=15m). After 15 minutes, no valid in-flight token can still be signed with the old secret. - Clear the previous secret: Set
JWT_SECRET_PREVIOUSto an empty string and redeploy. Rotation is complete.
Health Checks
Auth Service includes Spring Boot Actuator (spring-boot-starter-actuator) for operational observability, but the management endpoints are not exposed publicly by default:
health endpoint on that port. Until then, you can perform a TCP check against port 8080 or temporarily expose the health group on a firewall-restricted management port by setting: