Declare service and event access
Managed applications declare permission-service access, NATS subject access, and transport on their component in the platform bundle. Use the environment field supported by the component’s chart:- Velocity
- Minestom (grounds-gamemode)
snapshot:read allows the workload to fetch player snapshots.
catalog:register allows it to replace manifests only for the listed source
IDs. These are application-level bundle declarations, not the environment
variables or volumes rendered into the pod.
The platform projection turns services.permissions.access into the private
REST endpoint, token-file path, and exact REST authorization. It turns
events: into NATS subject authorization enforced by a projected workload
identity. The chart-specific helm.env or helm.extraEnv entry separately
passes the shared broker endpoint as NATS_URL. Declaring an event never
configures NATS_URL by itself.
A permissions service declaration without an access entry grants no
permission-service access, even when the event subscription is present.
Configuration
The integration is enabled when both
PERMISSIONS_SERVICE_URL and
PERMISSIONS_TOKEN_FILE are present. Supplying only one fails startup. Managed
workloads receive both values from the platform; do not override them to call a
central instance or an instance assigned to another project.
The client reads the projected token file for every request, so routine token
rotation does not require a workload restart. Never copy the token into a
manifest, environment variable, or log message. The bundle declares access and
the broker endpoint; the platform projection injects the resulting token-file
paths. Put only token-file paths in configuration, never token values.
Velocity
Install the Velocity permissions plugin with your proxy. At proxy startup it registers the REST snapshot client, loads player snapshots during login, refreshes online players on the configured interval, and exposes the localPermissions service to your plugin code.
Use the shared API for an unscoped check:
Minestom
Add the Minestom permissions module to the Grounds module runtime. The module registersPermissions in GroundsServerContext.services while it is
installed. Discover and select its grounds.permissions provider, then resolve
the service from the code that handles your player action.
GROUNDS_PERMISSION_SERVER_TYPE, it uses the Grounds server type from the
module context.
Snapshot lifecycle and outages
- The runtime fetches a snapshot through the private runtime REST API during player login.
- For an online player, the runtime receives a NATS invalidation containing only the schema version and Minecraft UUID.
- The runtime force-fetches the authoritative snapshot through private REST and atomically replaces its local snapshot after a successful response.
- A failed invalidation refresh keeps the previous snapshot. Once
refreshAfterpasses, the periodic sweep retries the assigned permission instance while that snapshot remains usable. - Snapshot expiry remains the fail-closed boundary: an expired snapshot makes
every check return
false. - If login cannot obtain a valid snapshot, the runtime denies that login.
snapshot:read
REST request. Events for offline players do not trigger a fetch because their
next login loads the current snapshot.
If NATS is unavailable during startup or reconnect, the runtime continues to
serve from valid local snapshots. Login loading, the periodic refreshAfter
sweep, and expiry provide recovery without making event transport part of the
authorization decision.
This fail-closed behavior prevents a temporary service outage from granting
unverified permissions. Handle a false result as an ordinary authorization
denial rather than retrying a remote call.
