What you will learn
- Name the six claims Agent Manager reads in a user token and say what each one means
- Explain how AMS checks a token is genuine without calling ThunderID each time
- Say what happens to a token with a good signature but the wrong audience
- Tell a JWT from an opaque proxy key and say which one has claims
Before you start
- What is Choreo Agent Manager? Not started In progress Done
On this page
Calls to Agent Manager’s main API carry a TokenA small signed piece of text that proves who is calling and what they may do. Calls to Agent Manager's main API carry one.See it in the glossary. AMS has no user table and no login session, so the token is the only thing it knows about you. This lesson opens the token and shows what is inside and how it is checked.
What is inside a JWT
A JWT (JSON Web Token)A signed token whose contents, called claims, say who you are and which organisation you belong to. Anyone with the public key can check the signature.See it in the glossary is a signed token. Its contents are called ClaimOne named fact inside a token, such as who the token is for (sub), which organisation unit they are in (ouId) or what they may do (scope).Analogy:One printed line on a passport: name, nationality, expiry date.See it in the glossary. A token that ThunderIDThe open source identity server Agent Manager uses to sign people and services in and to issue signed tokens. The older name Thunder survives in some chart and folder names.Analogy:The passport office that issues the signed documents every checkpoint reads.See it in the glossary issues to a person carries six claims that matter to AMS.
| Claim | What it says |
|---|---|
sub | The subject: who the token was issued to |
scope | The permissions the token carries, one per ScopeA named permission carried in a token. In Agent Manager it has the form amp:resource:action, for example amp:agent:create.Analogy:One key on a key ring. Each door checks for the one key it needs.See it in the glossary |
ouId and ouHandle | Your organisation unit, as an id and a short name (ouId and ouHandleTwo claims in a token that name your organisation unit, an id and a short name. Agent Manager takes your organisation from them, never from the request path.See it in the glossary) |
aud | The audience: who the token is meant for |
iss | The issuer: who signed it |
The values you see in the inspector below are placeholders. The claim names are the real ones.
Three questions AMS asks
Is the signature genuine?
AMS reads the token from the Authorization header (the default name) and accepts only RSA signatures. The token must name a key with a
kid. AMS fetches ThunderID’s public keys, called a JWKS (JSON Web Key Set)A public list of the keys an identity server signs tokens with. Anyone can fetch it to check a signature. Agent Manager keeps a copy for one hour.Analogy:The specimen book of official signatures that the border officer compares against.See it in the glossary, and uses the matching key to check the signature. It keeps the keys for one hour, and can refresh them early when it meets a key id it does not know.Is it from the right issuer and meant for this service?
The Issuer (iss)The claim that names who signed the token. Agent Manager accepts a token only when its issuer is on a configured list and matches exactly.See it in the glossary must be on a configured list and match exactly. The Audience (aud)The claim that names who the token is meant for. Agent Manager accepts a token only when its audience is on a configured list.See it in the glossary must be one of a configured list too. The chart’s default list includes
urn:wso2:ampandamp-console-client, and an entry that ends in*matches by prefix.What may the caller do?
AMS stores the claims and splits the space separated
scopeclaim into a set. Later steps compare it with the permission each route needs. The next two lessons follow that check.
A missing header gets 401 with a message that starts missing header. A token that fails these checks, or has expired, gets 401 with the message invalid jwt.
Where the audience comes from
When you sign in, the console can send an optional resource value on the sign-in request, an OAuth way to say which service the token is for. When it is set, the token’s audience is that resource, for example urn:wso2:amp, instead of the client id. That is why AMS’s accepted audience list must include it.
Some tokens are not JWTs
Agent Manager uses three token shapes in this batch of lessons. Open each one in the inspector.
- User access token. A JWT signed by ThunderID. It carries the six claims above.
- Agent token. A JWT that AMS signs itself so an agent can send traces. Besides the standard claims it carries
component_uid,environment_uid,project_uid,org_idandnamespace, so it names one agent in one environment. The gateway checks it before it forwards traces. - Proxy key. An opaque string, not a JWT. It has no claims. An agent shows it to an LLM proxyA project level entry point that points at one LLM provider and has its own API key. Agents call the proxy and never see the vendor key.Analogy:A purchase card issued to one project. It can be cancelled without touching the contract.See it in the glossary, and it works for that proxy only.
Your turn
Under Try it, open the token inspector and switch between the three tokens. For the user token, find the claim that names your organisation and the claim that lists your permissions. For the proxy key, notice what is missing. Then play the matcher to pair each claim with its meaning.
Recap
- AMS reads six claims from a user token:
sub,scope,ouId,ouHandle,audandiss. - It checks the signature with ThunderID’s public keys (a JWKS), then the issuer and the audience against configured lists.
- A token that fails a check gets
401 invalid jwt. - The console may send a
resourcevalue, which becomes the token’s audience. - An agent token is a JWT that AMS signs. A proxy key is opaque and has no claims.
Wrap up
Recap
Tick each one when you could explain it to a colleague.
Finished?
Chapter complete. Every lesson in this chapter is done.
Progress cannot be saved in this browser, so it will be forgotten when you leave this page.
Quick check
Spotted something wrong or unclear in this lesson? Report an inaccuracy (opens GitHub in a new tab)