Read-only mirror of https://github.com/blw-ofag-ufag/atlas-agate-test-backend — Bundesamt für Landwirtschaft. Issues & pull requests at the source.
  • Java 99.1%
  • Dockerfile 0.9%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
semantic-release-bot 3155a72fd6 chore(release): 1.0.0 [skip ci]
## 1.0.0 (2026-11-25)

### Features

* align setup with atlas-agate-backend (A1A-340) (#16) ([5934613](5934613ac8)), closes [A1A-340](https://blw-ofag-ufag.atlassian.net/browse/A1A-340)
* **auth:** adds auth A1-41 ([4e58b4b](4e58b4bc5f)), closes [A1-41](https://blw-ofag-ufag.atlassian.net/browse/A1-41)
* **auth:** adds multi tenant support ([e2de07b](e2de07bd15))
* **auth:** integrates auth A1-41 ([02ac5eb](02ac5eb0b6)), closes [A1-41](https://blw-ofag-ufag.atlassian.net/browse/A1-41) [A1-41](https://blw-ofag-ufag.atlassian.net/browse/A1-41)
* **auth:** switches producer-info role prefix to agridata.ch A1-130 (#4) ([57366c8](57366c895c)), closes [A1-130](https://blw-ofag-ufag.atlassian.net/browse/A1-130)
* **init-backend:** initializes test backend ([4c86ef5](4c86ef53b8))
* **keycloak:** Dev Service on the delivered ECR image, realm agate, port 9999 (A1A-312) (#29) ([3dfa986](3dfa986f5e)), closes [A1A-312](https://blw-ofag-ufag.atlassian.net/browse/A1A-312) [A1A-312](https://blw-ofag-ufag.atlassian.net/browse/A1A-312) [A1A-312](https://blw-ofag-ufag.atlassian.net/browse/A1A-312) [A1A-312](https://blw-ofag-ufag.atlassian.net/browse/A1A-312) [A1A-312](https://blw-ofag-ufag.atlassian.net/browse/A1A-312) [A1A-312](https://blw-ofag-ufag.atlassian.net/browse/A1A-312) [A1A-312](https://blw-ofag-ufag.atlassian.net/browse/A1A-312) [A1A-312](https://blw-ofag-ufag.atlassian.net/browse/A1A-312) [A1A-312](https://blw-ofag-ufag.atlassian.net/browse/A1A-312) [A1A-312](https://blw-ofag-ufag.atlassian.net/browse/A1A-312) [A1A-312](https://blw-ofag-ufag.atlassian.net/browse/A1A-312) [A1A-312](https://blw-ofag-ufag.atlassian.net/browse/A1A-312) [A1A-312](https://blw-ofag-ufag.atlassian.net/browse/A1A-312) [A1A-312](https://blw-ofag-ufag.atlassian.net/browse/A1A-312)
* **soap:** add Agate SOAP client and TVD user REST endpoint (A1-113) (#9) ([4f1d094](4f1d094111)), closes [A1-113](https://blw-ofag-ufag.atlassian.net/browse/A1-113) [A1-113](https://blw-ofag-ufag.atlassian.net/browse/A1-113) [A1-113](https://blw-ofag-ufag.atlassian.net/browse/A1-113) [A1-113](https://blw-ofag-ufag.atlassian.net/browse/A1-113) [A1-113](https://blw-ofag-ufag.atlassian.net/browse/A1-113) [A1-113](https://blw-ofag-ufag.atlassian.net/browse/A1-113) [A1-113](https://blw-ofag-ufag.atlassian.net/browse/A1-113) [A1-113](https://blw-ofag-ufag.atlassian.net/browse/A1-113)
* **soap:** expose getUsersByLoginId via REST for test automation (A1-172) (#11) ([8b82966](8b82966b9a)), closes [A1-172](https://blw-ofag-ufag.atlassian.net/browse/A1-172)
* **user:** require agate.Agate_Testsupport for the TVD user endpoints (A1A-308) (#35) ([fa5980b](fa5980b054)), closes [A1A-308](https://blw-ofag-ufag.atlassian.net/browse/A1A-308) [A1A-308](https://blw-ofag-ufag.atlassian.net/browse/A1A-308) [A1A-308](https://blw-ofag-ufag.atlassian.net/browse/A1A-308) [A1A-308](https://blw-ofag-ufag.atlassian.net/browse/A1A-308) [A1A-308](https://blw-ofag-ufag.atlassian.net/browse/A1A-308)

### Bug Fixes

* **cors:** fixes cors auth issue ([daef6fc](daef6fc92a))
* **deps:** update blw-ofag-ufag/atlas-code-github-workflows action to v1.9.0 ([705a45e](705a45ee35))
* **deps:** update group-update [security] ([c14f50d](c14f50d298))
* **oidc-client:** attach mTLS config and harden startup against IdP outage (A1-113) (#10) ([d71c38d](d71c38df2f)), closes [A1-113](https://blw-ofag-ufag.atlassian.net/browse/A1-113) [A1-113](https://blw-ofag-ufag.atlassian.net/browse/A1-113) [A1-113](https://blw-ofag-ufag.atlassian.net/browse/A1-113) [A1-113](https://blw-ofag-ufag.atlassian.net/browse/A1-113)
* run CI on ubuntu-26.04 runners (#17) ([62c6e57](62c6e571d5))
* **sonar:** fixes sonar issues A1-41 ([b126163](b126163102)), closes [A1-41](https://blw-ofag-ufag.atlassian.net/browse/A1-41)
* **test:** align seed usernames to backslash-free brokered form (A1-189) (#13) ([dfaa3e5](dfaa3e54d0)), closes [A1-189](https://blw-ofag-ufag.atlassian.net/browse/A1-189)
* **test:** trigger pipeline ([0f7f765](0f7f765075))
2026-11-25 14:40:38 +00:00
.github/workflows chore(ci): read the deployment app from the branch environment (dev/int) (#36) 2026-11-25 14:57:33 +01:00
.mvn/wrapper fix(deps): update group-update [security] 2026-11-25 13:42:14 +01:00
http feat(keycloak): Dev Service on the delivered ECR image, realm agate, port 9999 (A1A-312) (#29) 2026-11-09 12:42:10 +01:00
src feat(user): require agate.Agate_Testsupport for the TVD user endpoints (A1A-308) (#35) 2026-11-19 22:33:25 +01:00
.dockerignore feat(init-backend): initializes test backend 2026-04-07 21:35:16 +02:00
.gitattributes feat(init-backend): initializes test backend 2026-04-07 21:35:16 +02:00
.gitignore feat(soap): add Agate SOAP client and TVD user REST endpoint (A1-113) (#9) 2026-07-14 18:03:53 +02:00
.owaspignore.xml feat(init-backend): initializes test backend 2026-04-07 21:35:16 +02:00
.releaserc.json feat(init-backend): initializes test backend 2026-04-07 21:35:16 +02:00
.trivyignore feat(auth): switches producer-info role prefix to agridata.ch A1-130 (#4) 2026-06-03 07:00:39 +02:00
CHANGELOG.md chore(release): 1.0.0 [skip ci] 2026-11-25 14:40:38 +00:00
checkstyle.xml feat: align setup with atlas-agate-backend (A1A-340) (#16) 2026-10-15 17:16:59 +02:00
Dockerfile feat(soap): add Agate SOAP client and TVD user REST endpoint (A1-113) (#9) 2026-07-14 18:03:53 +02:00
mvnw feat(auth): switches producer-info role prefix to agridata.ch A1-130 (#4) 2026-06-03 07:00:39 +02:00
mvnw.cmd feat(init-backend): initializes test backend 2026-04-07 21:35:16 +02:00
package.json fix(deps): update group-update [security] 2026-11-25 13:42:14 +01:00
pnpm-lock.yaml fix(deps): update group-update [security] 2026-11-25 13:42:14 +01:00
pom.xml chore(release): 1.0.0 [skip ci] 2026-11-25 14:40:38 +00:00
README.md feat(user): require agate.Agate_Testsupport for the TVD user endpoints (A1A-308) (#35) 2026-11-19 22:33:25 +01:00
renovate.json chore(deps): add renovate.json (#22) 2026-11-02 15:51:57 +01:00

🌿 Agate Test Backend

Simulates backends that validate Agate tokens. The service exposes the decoded token claims and user-info for the authenticated user, and serves as a reference implementation for Agate OIDC integration.


🚀 Getting Started

Run in dev mode

./mvnw quarkus:dev -Dquarkus.profile=local

🔐 Keycloak

The local profile starts the Keycloak Dev Service, which serves src/test/resources/agate-realm.json (same realm as atlas-agate-backend) on port 9999. No docker-compose setup is needed. The container is shared with atlas-agate-backend: whichever backend starts first creates it, the other reuses it — so only one Keycloak may run on 9999.

The Dev Service (profiles local and test) runs the delivered Agate Keycloak image from ECR, pinned in application-local.yml and application-test.yml (quarkus.keycloak.devservices.image-name, same pin as atlas-agate-backend), with realm-name: agate. Its custom mappers are active, so tokens look like on dev.

The Keycloak of atlas-agate-local binds 9999 too and is not reused. Stop it (docker compose stop keycloak there) before quarkus:dev, or run against it instead of the Dev Service: -Dquarkus.keycloak.devservices.enabled=false.

Registry access. The image lives in the private ECR of the Agate dev account (681832766879). Let the ECR credential helper fetch the token through your AWS profile whenever Docker or Testcontainers pulls — no docker login:

  1. Docker Desktop for macOS ships docker-credential-ecr-login; elsewhere download it from the releases of that repository and put it on your PATH. Check with docker-credential-ecr-login version.

  2. Route the registry to it in ~/.docker/config.json (Windows: %USERPROFILE%\.docker\config.json), keeping the existing content:

    "credHelpers": {
      "681832766879.dkr.ecr.eu-central-2.amazonaws.com": "ecr-login"
    }
    

    Remove a token from an earlier login: docker logout 681832766879.dkr.ecr.eu-central-2.amazonaws.com.

  3. Make the dev account your default profile — the helper takes it from AWS_PROFILE, also when Testcontainers calls it from the JVM. atlas-dev is the profile set up in pc-core-blw-agate-dev; use yours if it differs.

    echo 'export AWS_PROFILE=atlas-dev' >> ~/.zshrc   # Windows: setx AWS_PROFILE atlas-dev
    

    Open a new terminal afterwards (and restart your IDE if you start the app from there). Other accounts (int, prod, bbs …) always with an explicit --profile, which overrides the default.

  4. When the SSO session has expired (every 12 h): aws sso login.

no basic auth credentials means AWS_PROFILE is missing in that process or the SSO session has expired — a token cached in ~/.ecr/cache.json does not help without the profile. Details are in ~/.ecr/log/ecr-login.log.

Alternative without the helper: docker login per session. The previous way still works — skip steps 1–3 and log Docker in yourself once per session (the token lasts 12 h). On Windows the Credential Manager may reject this token as too long; use the helper there.

aws sso login --profile atlas-dev
aws ecr get-login-password --region eu-central-2 --profile atlas-dev \
  | docker login --username AWS --password-stdin 681832766879.dkr.ecr.eu-central-2.amazonaws.com

CI pulls the image through its own pull role (agate-ecr-pull-role) — nothing to do there.

Realm. src/test/resources/agate-realm.json is an export of examples/local of atlas-agate-keycloak-config, with the client secrets Keycloak generates itself scrubbed to local-dummy-secret, copied byte-identical into both backends — never edit it here; roles and clients are added in that module. It is temporary: the versioned realm artifact replaces it (A1A-602). Bump the image pin (both profile files) together with the export.

Tokens from the embedded Keycloak are accepted because quarkus.oidc.resolve-tenants-with-issuer maps them onto the tenant the Dev Service configures. Request the openid scope — the app has user-info-required enabled, and Keycloak refuses the UserInfo endpoint for tokens without it.

The SOAP client (/api/tvd/users) gets its token from the same Keycloak (client tvd-agate-api) and calls the locally running atlas-agate-backend (http://localhost:8901/backend/soap/AdminService/v1_44); override with SOAP_ENDPOINT_URL.

🧪 HTTP requests

http/ contains IntelliJ HTTP client requests. The local environment in http/env/http-client.env.json uses the realm users biosuisse, erika, av (password grant) and the tvd client (client credentials).

🔎 Tracing

quarkus-opentelemetry continues an inbound W3C traceparent header (or starts a new trace) and puts traceId/spanId into the MDC; both are part of the log format and the traceId is returned in error responses (ExceptionDto). Traces are not exported yet (quarkus.otel.traces.exporter=none).


🧪 Tests

@QuarkusTest spins up the delivered Keycloak image (see Keycloak; ECR login required) with the Agate realm export, without brokering authentication to eIAM. Tests can also be driven via Swagger UI or the .http test files.


⚙️ GitHub Workflow

Uses the BLW shared workflow: atlas-code-github-workflows


✅ Checkstyle

Import the Checkstyle plugin in your IDE and point it at checkstyle.xml in the repository root to catch violations before pushing.

In the IDE Checkstyle settings, exclude SQL scripts:

*.{sql}

Run Checkstyle:

./mvnw checkstyle:check

🔖 Semantic Versioning

Versioning is driven by two files:

File Purpose
package.json Pins the pnpm version used to run semantic-release
.releaserc.json Configures branches, version strategy, and release steps

🎨 ASCII Banner

Generated with manytools.org ASCII banner — font: Slant