sgivu-auth) is the OAuth2/OpenID Connect authorization server that handles authentication and token issuance for the entire SGIVU platform.
Service Overview
Port
9000
Database
PostgreSQL
Session Store
JDBC (PostgreSQL)
Role
OAuth2 Authorization Server
Key Features
- OAuth2 Authorization Server with Spring Authorization Server
- JWT token generation using keystore-based signing
- Session management with JDBC persistence
- User authentication and authorization
- Integration with User Service for user data
- Database migration with Flyway
Base Configuration
Server Settings
The
forward-headers-strategy: framework enables proper handling of proxy headers from the gateway.Session Management
The auth service uses JDBC-based session storage:Session Configuration Details
Session Configuration Details
- store-type: jdbc - Sessions stored in PostgreSQL
- **cleanup-cron: 0 */15 * * * *** - Cleans expired sessions every 15 minutes
- flush-mode: on_save - Writes to database only when explicitly saved
- save-mode: on_get_attribute - Session saved when attributes are accessed
JWT Configuration
The service uses a keystore to sign JWT tokens:Issuer Configuration
iss claim and must be accessible by all services.
Database Configuration
JPA Settings
open-in-view: false prevents lazy loading issues by ensuring all database operations occur within transaction boundaries.Flyway Migration
- Development
- Production
Service Integration
Eureka Registration
Service Discovery Map
Gateway Client Configuration
Security Configuration
Internal Service Authentication
Session Configuration
- Development
- Production
Client Configuration
- Development
- Production
Observability
Actuator Endpoints
- Development
- Production
Distributed Tracing
Samples 10% of requests to reduce overhead while maintaining visibility into system behavior.
Logging
API Documentation
- Production
Required Environment Variables
All Environments
| Variable | Description | Example |
|---|---|---|
SERVICE_INTERNAL_SECRET_KEY | Shared secret for internal APIs | your-secret-key |
JWT_KEYSTORE_LOCATION | Path to JWT keystore | classpath:keystore.jks |
JWT_KEYSTORE_PASSWORD | Keystore password | changeit |
JWT_KEY_ALIAS | Key alias in keystore | sgivu-jwt |
JWT_KEY_PASSWORD | Key password | changeit |
SGIVU_GATEWAY_SECRET | Gateway OAuth2 client secret | gateway-secret |
Development
| Variable | Description |
|---|---|
DEV_AUTH_DB_HOST | Database host |
DEV_AUTH_DB_PORT | Database port |
DEV_AUTH_DB_NAME | Database name |
DEV_AUTH_DB_USERNAME | Database username |
DEV_AUTH_DB_PASSWORD | Database password |
DEV_ANGULAR_APP_URL | Angular app URL |
Production
| Variable | Description |
|---|---|
PROD_AUTH_DB_HOST | Database host |
PROD_AUTH_DB_PORT | Database port |
PROD_AUTH_DB_NAME | Database name |
PROD_AUTH_DB_USERNAME | Database username |
PROD_AUTH_DB_PASSWORD | Database password |
PROD_ANGULAR_APP_URL | Angular app URL |
OPENAPI_SERVER_URL | Public API docs URL |
Optional
| Variable | Description | Default |
|---|---|---|
PORT | Service port | 9000 |
EUREKA_URL | Eureka server URL | http://sgivu-discovery:8761/eureka |
ISSUER_URL | JWT issuer URL | http://sgivu-auth:9000 |
SGIVU_USER_URL | User service URL | http://sgivu-user:8081 |
FLYWAY_BASELINE_ON_MIGRATE | Baseline existing DB | false |
Configuration Files
sgivu-auth.yml- Base configurationsgivu-auth-dev.yml- Development overridessgivu-auth-prod.yml- Production overrides
Related Services
Gateway Service
OAuth2 client configuration
User Service
User data provider