DEV Community

DarkEdges
DarkEdges

Posted on Edited on

Building Certificate-Backed Agents: Part 4, Live Authorisation and Revocation

Source code and setup instructions: darkedges/udap-agent-trust-poc.

An agent has enrolled, obtained a certificate and authenticated with a signed assertion. The next question is whether it may perform the requested operation now.

This installment uses the POC’s document-read and recommendation-create operations to show the difference between identity proof, token issuance and a resource decision. The resource checks the authority on every request, so permission withdrawal is visible without waiting for token expiry.

Authorisation remains live after a token is issued

Successful authentication answers whether the agent has presented an acceptable identity proof. The scope decision answers which operations that agent may perform.

For a registered client, the request must fit this intersection:

certificate ceiling ∩ registered scopes ∩ current policy
Enter fullscreen mode Exit fullscreen mode

For the certificate-only path, it must fit:

certificate ceiling ∩ current policy
Enter fullscreen mode Exit fullscreen mode

The requested set must be nonempty and entirely contained in the applicable intersection. The POC rejects an excessive request rather than silently reducing it. Active agent status and certificate validity are additional gates, not extra scopes.

The decision view exposes the requested scopes, certificate ceiling, registration limit where applicable, current policy and resulting allowed set. This makes a denial explainable. A cryptographically valid certificate with an excessive scope request should produce a different explanation from an unknown signing certificate.

The authority then issues an opaque bearer token valid for 60 seconds. The JWT used for client authentication and the bearer token used for resource access are different artifacts. The first proves the client's control of a key. The second is a temporary credential that anyone possessing it can present during its validity period.

The resource service asks the authority about the token on every request. The POC uses its own authenticated introspection endpoint; it does not claim to implement every detail of a standard introspection profile. The authority resolves the token hash and checks expiry, current agent status, the associated certificate and live permissions.

Consider this demonstration. A token initially permits both document reading and recommendation creation. The administrator removes recommendations.create from live policy. The existing token still permits document reading, but a recommendation request fails. A new request for both scopes also fails.

Suspending the agent blocks resource access with existing tokens and prevents new token issuance. Reactivation restores eligibility, subject to the remaining checks. Revoking the certificate makes tokens tied to that certificate unusable and cannot be reversed by reactivating the agent.

Those effects come from the resource-time checks. Revoking a certificate does not magically recall bearer tokens from other systems. A resource server that checks only token expiry would have different behaviour. The POC makes its immediate-denial policy explicit by consulting the authority on every request.

The tradeoff is availability and latency. If the authority cannot answer, resource access fails closed. A production design would need to decide whether to retain this model, cache decisions for a bounded interval, distribute revocation events, or accept short periods of stale access. Each choice changes the meaning of “immediate revocation.”

Rotation exercises the same dependency chain. The operator generates a replacement key and CSR; an administrator approves a new certificate. Registered agents re-register with it while retaining their client ID. Certificate-only agents authenticate with it. After successful replacement, the flow revokes older certificates. The sequence is retryable, but it is not a distributed atomic transaction across both services.

Next in the series

The live check gives the demo a precise withdrawal policy, with an availability cost that should be visible to its audience. Part 5 turns those lifecycle decisions into repeatable operational and regression checks.

Top comments (0)