GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - BITS-GmbH/ORISO-AddonService: ORISO AddonService: discovery, enablement and gateway for ORISO add-ons (ADR-031 draft)

BranchesTags
Open more actions menu

Latest commit

 

History

27 Commits
27 Commits

Folders and files

NameName
Last commit message
Last commit date
.github
.github
 
 
.mvn/wrapper
.mvn/wrapper
 
 
docs
docs
 
 
examples/demo-addon
examples/demo-addon
 
 
src
src
 
 
tooling/vite-plugin-oriso-addon
tooling/vite-plugin-oriso-addon
 
 
.gitignore
.gitignore
 
 
Dockerfile
Dockerfile
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
mvnw
mvnw
 
 
pom.xml
pom.xml
 
 

Repository files navigation

ORISO AddonService

Connects ORISO with add-ons: optional services that bring their own backend and UI, are discovered by the platform and enabled per Träger. Design: ADR-031 (draft, digisucht-oriso-kickoff).

What it does

Route (behind /service/addons) Who What
GET /registry logged-in users Add-ons enabled in the request's context (see below), with only the apps whose slots the caller's role may see and the dynamic apps the add-on reports as visible
/{name}/api/** logged-in users Forwarded to the add-on's /api/** with a short-lived token signed by the AddonService instead of the Keycloak token
GET /{name}/ui/** anyone The add-on's bundle and assets (loaded with import(), which cannot send a token); SVGs with a CSP that blocks script
GET /public/registration?tenantId= anyone The add-on that takes over the agency selection of the registration for that Träger, or 204 (see Registration)
/{name}/public/api/** anyone, with X-Oriso-Tenant-Id Forwarded to the add-on's /public/api/** with an anonymous token, rate limited (see Registration)
GET /.well-known/jwks.json anyone Public key add-ons use to verify the token
GET /admin/addons?tenantId= admins of the Träger Add-ons with their switches: all for a SuperAdmin, for the admins of a Träger only those on globally in mode TENANT or ON. Each has manifest, source, discoveredAt, global, tenantId, enabled (Träger level on), mode, tenantCanSwitch, hasReadme, agencyOverrides
GET /admin/addons/{name}/tenants SuperAdmin Every Träger with a switch or agency overrides for the add-on: enabled, mode, updatedAt, updatedBy, agenciesEnabled, agenciesDisabled
PUT /admin/addons/{name}/global SuperAdmin Switch an add-on on or off for the whole platform (default off)
PUT /admin/addons/{name}/tenants/{tenantId}/mode SuperAdmin {"mode": "OFF|TENANT|ON|ON_HIDDEN"} for a Träger (see Enablement)
PUT /admin/addons/{name}/tenants/{tenantId} SuperAdmin, admins of the Träger in mode TENANT {"enabled": ...} for a Träger
PUT/DELETE /admin/addons/{name}/tenants/{tenantId}/agencies/{agencyId} admins of the Träger Override for one agency
GET/PUT /admin/addons/{name}/settings?tenantId=&agencyId= admins of the Träger Settings schema and stored values; PUT validates against the schema
GET /admin/addons/{name}/stats?tenantId= admins of the Träger The add-on's statistics with their labels
GET /admin/addons/{name}/readme?tenantId= admins of the Träger The add-on's README (text/markdown) with relative links and images made absolute; 404 without one, 502 if it cannot be fetched and none is cached
GET /admin/audit?tenantId=&addon=&from=&to=&page=&size= admins Audit entries of add-ons, newest first (see below)
GET /calendar?from=&to= logged-in users Calendar entries of the caller's add-ons (see below)
GET /host/settings add-on backends Effective settings (defaults, Träger, agency) for the add-on, Träger and agency of the add-on token
POST /host/notifications add-on backends Notification to the token's user or the session's client, delivered by UserService
POST /host/audit add-on backends Append-only audit entry
GET /host/gates add-on backends Core gates for the token's Träger: today the DPA gate (status, signed, newCounsellingAllowed, renewalGraceActive, signingDeadlineAt); the add-on decides what a closed gate means for it
GET /host/context?subject=self|asker add-on backends Sessions (agency, counsellor, status), agencies and counsellors of the token's user or client, from UserService; within the token's Träger and, with an agency in the token, that agency

ingress-nginx rewrites /service/addons/... to /addons/..., like the other services.

Enablement: off until a SuperAdmin switches an add-on on globally and gives a Träger a mode other than OFF. The global switch is off for newly discovered add-ons and turns the add-on off everywhere, whatever the Träger switches say. Modes, set by SuperAdmins only:

Mode On for the Träger Admins of the Träger
OFF (default) no do not see it
TENANT when they switch it on see it and switch it
ON yes see it, cannot switch it
ON_HIDDEN yes, for every agency do not see it

Within a Träger that is on, agencies can be switched off (or on again), except in ON_HIDDEN, where agency overrides are ignored. An agency switch alone has no effect. The admin endpoints of an add-on (agency overrides, settings, statistics, README) answer 404 to the admins of a Träger that do not see it. Switching to TENANT keeps whether the add-on is on; PUT .../tenants/{id} by a SuperAdmin outside TENANT sets ON (or keeps ON_HIDDEN) or OFF.

Agency context: when the web app sends X-Oriso-Agency-Id, the AddonService checks with UserService (/users/data, with the caller's token) that the caller belongs to that agency, applies the agency override and passes agencyId in the add-on token. A counsellor's agencies are agencies[].id of /users/data; a client's are sessions[].agencyId and consultingTypes.*.agency.id (UserService 2.0.15 sends no agencies list for clients).

Session context: when a request carries X-Oriso-Session-Id, the AddonService checks it. For a counsellor it asks UserService (/users/consultants/sessions/{id}, with the counsellor's token) whether the counsellor may see the session and passes sessionId and the client's askerId in the add-on token; for a client the session must be one of their own in their Träger (/users/addon-context, technical client) and sessionId is passed. Either way the session's agency decides enablement and is passed as agencyId. Without access the request gets 403.

Token for add-ons (RS256, audience = add-on name, 2 minutes): sub, username, roles, tenantId, agencyId, sessionId and askerId (if any). Cookies, the Keycloak token and client addresses are never forwarded. Add-on backends send this token to /host/**.

What an add-on serves besides its manifest and /api, /ui:

  • settings (manifest): path of a JSON Schema for its settings. Supported: an object with string (enum, maxLength), boolean, integer/number (minimum, maximum) properties, default, required, title, description.
  • GET /stats?tenantId=: called by the AddonService with a service token (role addon-service, tenantId), answers {"values": {"<stat id>": <number>}} for the stats declared in the manifest.
  • calendar (manifest): path such as /calendar, see below.
  • GET /visibility: needed when an app declares "visibility": "dynamic", see Registry.

The full contract for notifications, audit entries and calendar entries is in docs/contract-v1-notifications-audit-calendar.md; the registration slot, session menus, app icons and the events user.registered and session.interaction are in docs/contract-v1-registration-and-events.md.

Registration

An app in slot registration.agency-finder (at most one per add-on) can replace the agency selection of the core registration for visitors without an account. GET /public/registration?tenantId= answers with the add-on enabled for that Träger at Träger level (global switch, mode TENANT with the Träger switch on, ON or ON_HIDDEN; the first by name if several, with a warning), or 204. Its app calls complete({agencyId, topicId, postcode, consultingType, registrationRef}); UserService later publishes user.registered with the new user id and the ref.

/{name}/public/api/** needs X-Oriso-Tenant-Id (400 without) and is allowed only for an add-on offering that slot for the Träger (403). It is rate limited per client address (first hop of X-Forwarded-For) and add-on (429) and limits the body (413). The add-on gets an anonymous token: aud = add-on, tenantId, roles: ["anonymous"], no sub or user claims, short TTL. With it, the host API serves only /host/settings and /host/gates.

Registry

GET /registry takes the same optional headers as the gateway and decides in three stages:

  1. Enablement. With X-Oriso-Session-Id (counsellors only, verified with UserService) the session's agency decides and the agency header is not used; with X-Oriso-Agency-Id (verified membership) that agency decides; without either, the caller's own agencies decide and an add-on is listed if it is enabled for at least one of them. A caller without any agency (UserService reports none) sees what the Träger switch allows. If UserService cannot be asked for the caller's agencies, the answer is 502.
  2. Slot and role. Only apps with a slot the caller's role can open, and only those slots.
  3. App state. For every listed add-on with a "visibility": "dynamic" app the caller can see, the AddonService calls GET <add-on>/visibility in parallel with an add-on token for the caller (with agencyId, sessionId and askerId when the request had that context). The add-on answers {"apps": {"goals": {"visible": true, "badge": 1}}}. Dynamic apps missing from the answer or with visible other than true are hidden; on an error or after addons.visibility.timeout all dynamic apps of that add-on are hidden and its name is logged. A positive integer badge is passed on as badge of the app; static apps never have one. Answers are cached per user, add-on and context for addons.visibility.cache-ttl; failures are not cached. Forwarding a notification drops the cached answers of that add-on for the recipient, so a released tool appears on the next registry request.

Host API

Add-on backends call these with the add-on token of the request they are handling.

POST /host/notifications: recipient is self (the token's sub) or asker (the token's askerId; 403 without one). title (max 120) and text (max 500) are plain text per locale with de required. appId must be an app of the add-on (404 otherwise) and target.slot one of that app's slots that the recipient can open (asker means role user); consultant.session and consultant.asker-profile need a sessionId in the token, which is passed on. The AddonService forwards to UserService POST /users/event-notifications/addon with a Keycloak client-credentials token of the backend-technical client (cached until 30 s before it expires) and answers 202 {"id": ...} with UserService's id, or 502 if UserService or Keycloak fails.

recipient: "counsellors" (notifications): the counsellors of the token's client (a client's own token, or a counsellor's token with a verified session), within the token's agency and, with a session in the token, that session; one notification each, without the caller. Answers 202 {"ids": [...]}. Needs a slot counsellors can open.

GET /host/gates and GET /host/context read the TenantService (/tenantadmin/{id}/dpa/gate) and UserService (/users/addon-context) with the technical client token and cache the answers briefly (addons.tenant-service.cache-ttl, addons.user-service.context-cache-ttl).

Lifecycle events

With ADDONS_LIFECYCLE_ENABLED=true and SPRING_RABBITMQ_* set, the AddonService binds a durable queue (addons.lifecycle.queue, default addonservice.lifecycle) to the core's topic exchange oriso.lifecycle for user.deleted, session.deleted, user.registered and session.interaction. Each event is stored once per add-on that lists its type in the manifest's events (table addon_event_delivery) and delivered as POST <add-on>/events with a service token (role addon-service, the event's tenantId). A 2xx answer ends it; otherwise it is retried with growing pauses (30 s doubling, at most 6 h) and given up with an error log after 7 days. Handlers must be idempotent and accept unknown ids.

{"id":"…","type":"user.deleted","occurredAt":"…","tenantId":1,"userId":"…","role":"asker"}
{"id":"…","type":"session.deleted","occurredAt":"…","tenantId":1,"sessionId":16,"askerId":"…","agencyId":0}
{"id":"…","type":"user.registered","occurredAt":"…","tenantId":1,"userId":"…","registrationRef":"…"}
{"id":"…","type":"session.interaction","occurredAt":"…","tenantId":1,"sessionId":16,"agencyId":10,"consultantId":"…","interactionType":"message|call|video_call|appointment"}

For user.registered and session.interaction only these fields are forwarded; events without userId, without sessionId or with another interactionType are dropped.

POST /host/audit: action matches [a-z0-9._-]{1,64}, summary is plain text per locale (de required, max 300), subject is self, asker (403 without askerId in the token) or omitted, appId is optional (404 if unknown). The AddonService adds time, add-on, actor (id, username, roles), Träger, agency, session and subject id from the token and stores the entry in addon_audit_entry, which is never updated or deleted. Answers 201 {"id": ...}.

Audit log for admins

GET /admin/audit answers {"items": [...], "page", "size", "total"}, newest first; size is 1 to 200 (default 50), from (inclusive) and to (exclusive) are ISO instants.

  • SuperAdmin (tenant-admin of Träger 0): every Träger, or the one in tenantId.
  • tenant-admin / single-tenant-admin: their own Träger only (another tenantId is 403).
  • agency-admin / restricted-agency-admin: only entries written in their agencies, as UserService (/users/data) reports them.

Calendar

GET /calendar?from=&to= (from before to, at most 92 days) asks every add-on that declares calendar, is enabled for the caller's Träger (and agency, via X-Oriso-Agency-Id) and has an app the caller's role can see, in parallel with a token for the caller (no session), 3 s each: GET <calendar>?from=&to=. The add-on answers {"entries": [...]} with entries of the token's user. The AddonService keeps the first 200 per add-on, drops entries that are invalid (unknown app, kind other than appointment/deadline/reminder, title.de missing, bad start/end, link.slot not a slot of that app the caller can see) or outside the range, adds addon and answers {"entries": [...], "errors": ["<add-on that failed or timed out>"]} sorted by start.

Discovery

  • ADDONS_DISCOVERY_KUBERNETES=true: Services labelled oriso.io/addon=true in ADDONS_DISCOVERY_NAMESPACE (default addons). Port from the annotation oriso.io/addon-port, otherwise the first Service port. Needs get/list on Services in that namespace.
  • ADDONS_DISCOVERY_STATICADDONS: comma-separated base URLs, for local development.

Each add-on serves /.well-known/oriso-addon.json. Invalid manifests are logged and ignored.

Manifest

{
  "name": "digisucht-tools",
  "version": "1.0.0",
  "contract": "oriso-addon/v1",
  "react": "^19",
  "ui": "/ui/entry.js",
  "calendar": "/calendar",
  "readme": "https://raw.githubusercontent.com/BITS-GmbH/oriso-addon-digisucht-tools/main/docs/README.md",
  "apps": [
    { "id": "goals", "title": { "de": "Ausgangssituation und Ziele" }, "icon": "/ui/icons/goals.svg",
      "slots": ["asker.navigation", "consultant.session", "consultant.asker-profile"],
      "visibility": "dynamic",
      "screenshots": [
        { "slot": "consultant.session",
          "url": "https://raw.githubusercontent.com/BITS-GmbH/oriso-addon-digisucht-tools/main/docs/goals-session.png",
          "caption": { "de": "Ziele im Fall", "en": "Goals in the case" } }
      ] }
  ]
}

readme (optional) is an absolute https URL of a Markdown file on a host in addons.readme.allowed-hosts (default raw.githubusercontent.com), for example https://raw.githubusercontent.com/BITS-GmbH/oriso-addon-digisucht-tools/main/docs/README.md; otherwise the manifest is invalid. The AddonService fetches it for ORISO-Admin (5 s, at most 512 KB, redirects only on the same host), caches it per add-on and version for 10 minutes and passes the Markdown on unrendered; the admin UI sanitizes it.

screenshots (optional, per app, at most 6) show the app in one of its slots in ORISO-Admin: slot must be one of the app's slots, url an absolute https URL on a host in addons.readme.allowed-hosts like readme, caption an optional localized text. Otherwise the manifest is invalid. The browser of the admin loads the images directly from that host.

icon (optional, per app) is a monochrome SVG below /ui/ (ending in .svg, no .., at most 200 characters), served by the add-on and exposed in the registry and admin output as /service/addons/<name>/ui/icons/goals.svg.

visibility is static (default: the app is shown wherever its slot and the enablement allow) or dynamic (the add-on decides per user, see Registry).

Slots and who sees them:

Slot Roles
asker.navigation user
asker.session-menu user, with a verified own session
consultant.navigation consultant
consultant.session, consultant.session-menu, consultant.asker-profile consultant, with a verified session
admin.page tenant-admin, single-tenant-admin, agency-admin, restricted-agency-admin
registration.agency-finder visitors without an account (never in /registry)

Configuration

Variable Default
SPRING_SECURITY_OAUTH2_RESOURCESERVER_JWT_JWK_SET_URI Keycloak certs, internal URL
SPRING_SECURITY_OAUTH2_RESOURCESERVER_JWT_ISSUER_URI Public issuer as in the tokens
SPRING_DATASOURCE_URL / _USERNAME / _PASSWORD jdbc:mariadb://mariadb:3306/addonservice Schema created by Liquibase
ADDONS_TOKEN_PRIVATEKEYPEM generated per start PKCS#8 RSA key; set it, or tokens break on restart and differ between replicas
ADDONS_USERSERVICE_BASEURL http://userservice:8080
ADDONS_TECHNICALCLIENT_TOKENURL Keycloak token endpoint, internal URL, e.g. http://keycloak:8080/auth/realms/<realm>/protocol/openid-connect/token; needed for notifications
ADDONS_TECHNICALCLIENT_CLIENTID backend-technical Confidential client with the realm role technical
ADDONS_TECHNICALCLIENT_CLIENTSECRET Its secret
ADDONS_CALENDAR_TIMEOUT 3s Per add-on
ADDONS_VISIBILITY_TIMEOUT 2s GET /visibility, per add-on
ADDONS_VISIBILITY_CACHETTL 30s Cache of GET /visibility answers per user, add-on and context
ADDONS_README_ALLOWEDHOSTS raw.githubusercontent.com Comma-separated hosts a manifest readme and app screenshots may point to
ADDONS_README_TIMEOUT / _MAXSIZE / _CACHETTL 5s / 512KB / 10m Fetching the README
ADDONS_PUBLICGATEWAY_REQUESTSPERMINUTE 60 Public API requests per client address and add-on
ADDONS_PUBLICGATEWAY_TOKENTTL 1m Lifetime of the anonymous add-on token
ADDONS_PUBLICGATEWAY_MAXBODYSIZE 1MB Request body of the public API
ADDONS_PUBLICGATEWAY_CACHETTL 30s Cache of the registration add-on per Träger

Demo add-on

examples/demo-addon is a complete add-on without dependencies: manifest, a UI bundle that uses the host's React from globalThis.__ORISO_ADDON_SHARED__, and /api/hello, which verifies the AddonService token against the JWKS and echoes its claims. It offers one app in asker.navigation, consultant.navigation and consultant.asker-profile.

Development

./mvnw verify

Images: harbor.mybits.dev/digisucht/addonservice:<version>-<sha> from main.

About

ORISO AddonService: discovery, enablement and gateway for ORISO add-ons (ADR-031 draft)

Resources

Readme
AGPL-3.0 license
Activity
Custom properties

Stars

0 stars

Watchers

0 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.