TenantService is the ORISO tenant registry. It stores tenant identity, subdomain, licensing limits, theming, feature settings, multilingual legal content, and content activation dates. It also exposes restricted public tenant metadata used before a caller has a full authenticated tenant context.
- Architecture
- API
- Authentication and tenant context
- Configuration
- Local development
- Build and test
- Deployment
- Developer documentation
This is a Java 17 Spring Boot 3 service built with Maven.
Primary layers:
api/tenantservice.yamldefines the public TenantService REST contract.TenantControllerimplements generated API interfaces and applies endpoint authorization.TenantServiceFacadeorchestrates tenant create, update, delete, search, restricted reads, and downstream synchronization.TenantService,TenantRepository, andTenantEntityown MariaDB persistence.WebSecurityConfig,JwtAuthConverter, andAuthorisationServicemap Keycloak JWTs to local authorities.TenantResolverServiceresolves tenant context from access token, cookies, or subdomain.ConsultingTypeService,ApplicationSettingsService, andUserAdminServicecall other ORISO services through generated OpenAPI clients.
The OpenAPI contract is in api/tenantservice.yaml.
Main endpoint groups:
/tenantadmin- tenant administration./tenantadmin/search- paginated tenant admin search./tenantand/tenant/{id}- authenticated tenant reads./tenant/public/**- restricted public tenant metadata./tenant/access- checks whether the current user can access a tenant context.
TenantController also contains a handwritten DELETE /tenant/{id} endpoint. If generated clients need this operation, add it to api/tenantservice.yaml.
The service uses Keycloak/OAuth2 JWT authentication through Spring Security.
Role and permission flow:
WebSecurityConfigconfigures stateless JWT resource-server authentication.JwtAuthConverterreads realm roles from the JWT.RoleAuthorizationAuthorityMappermaps ORISO roles into localAUTHORIZATION_*authorities.@PreAuthorizerules onTenantControllerprotect tenant and tenant-admin operations.
Tenant context resolution order:
AccessTokenTenantResolverreads tenant id from the authenticated JWT.CookieTenantResolverreads cookie hints in single-domain mode.SubdomainTenantResolverresolves tenant by request subdomain.
Base configuration lives in src/main/resources/application.properties.
Profile overrides live in:
src/main/resources/application-local.propertiessrc/main/resources/application-dev.propertiessrc/main/resources/application-staging.propertiessrc/main/resources/application-prod.propertiessrc/main/resources/application-testing.properties
Required runtime values are validated by ConfigurationValidator:
SPRING_DATASOURCE_URLSPRING_DATASOURCE_USERNAMESPRING_DATASOURCE_PASSWORDKEYCLOAK_AUTH_SERVER_URLKEYCLOAK_REALMSPRING_SECURITY_OAUTH2_RESOURCESERVER_JWT_ISSUER_URISPRING_SECURITY_OAUTH2_RESOURCESERVER_JWT_JWK_SET_URICONSULTING_TYPE_SERVICE_API_URLUSER_SERVICE_API_URL
Use Kubernetes DNS names for service URLs and database hosts. Avoid hardcoded cluster IPs because they break when services or pods are recreated.
The DPA gate uses the stored signing instant for new signatures. To interpret older wall times for a verified historical writer, configure all three settings for that deployment.
| Environment variable | Value |
|---|---|
ORISO_DPA_LEGACY_SIGNING_ZONE |
Verified historical writer zone as a Java zone ID |
ORISO_DPA_LEGACY_SIGNING_FROM |
First verified local wall time, inclusive |
ORISO_DPA_LEGACY_SIGNING_TO |
Last verified local wall time, inclusive |
Both limits use ISO local date and time without an offset. An incomplete set disables legacy conversion, and an end before the start rejects the configuration. The gate omits the timestamp for legacy rows outside the verified interval and for ambiguous or nonexistent local times.
For the full mixed local frontend/UserService/TenantService setup, see
documentation/local-development.md.
Prerequisites:
- JDK 17
- Maven wrapper from this repository
- MariaDB reachable through the configured datasource URL
- Keycloak realm and JWT issuer/JWK configuration
- ConsultingTypeService and UserAdminService URLs
Run locally:
./mvnw spring-boot:run -Dspring-boot.run.profiles=local
Health check:
curl http://localhost:8081/actuator/health
Run tests:
./mvnw testBuild the jar:
./mvnw package
Check formatting:
./mvnw spotless:check
The Maven compiler, Surefire, and Docker runtime use --enable-preview.
Keep the tested JDK and deployment JDK aligned when changing Java versions.
Dockerfile runs TenantService.jar on eclipse-temurin:17-jre.
Development deployment helper:
./deploy-development.sh
Operational notes:
- Application default port is
8081. - The Dockerfile currently exposes
8080; align this before relying on container metadata. - Liquibase changelogs exist under
src/main/resources/db/changelog/, but profiles currently disable Liquibase. run-trivy.shis available for image/security scanning.
Understand-Anything documentation and graph artifacts are stored in .understand-anything/.
Start here:
.understand-anything/README.md.understand-anything/ARCHITECTURE.md.understand-anything/ONBOARDING.md.understand-anything/FINDINGS.md.understand-anything/DEPENDENCY-AUDIT.md.understand-anything/ORISO-ECOSYSTEM.md.understand-anything/knowledge-graph.json
Open the graph dashboard:
cd /Users/nikunjchampakbhairohit/.understand-anything/repo/understand-anything-plugin/packages/dashboard GRAPH_DIR="/Users/nikunjchampakbhairohit/Developer/freelance/Germany/Oriso-frank-client/ORISO/ORISO-TenantService" pnpm exec vite --host 127.0.0.1
Then open the local URL printed by Vite.
pom.xml- dependencies, OpenAPI generation, Liquibase plugin, Java compiler, and test configuration.api/tenantservice.yaml- primary REST API contract.src/main/java/com/vi/tenantservice/api/controller/TenantController.java- HTTP entrypoint.src/main/java/com/vi/tenantservice/api/facade/TenantServiceFacade.java- main tenant orchestration layer.src/main/java/com/vi/tenantservice/api/service/TenantService.java- tenant persistence service.src/main/java/com/vi/tenantservice/api/model/TenantEntity.java- JPA tenant table mapping.src/main/java/com/vi/tenantservice/api/repository/TenantRepository.java- tenant repository and search query.src/main/java/com/vi/tenantservice/config/security/WebSecurityConfig.java- security configuration.src/main/java/com/vi/tenantservice/config/security/AuthorisationService.java- JWT claims and authority extraction.src/main/java/com/vi/tenantservice/api/service/consultingtype/ConsultingTypeService.java- downstream ConsultingType integration.