ON-PREM CHOREO CLOUD BOTH

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

On this page

Calls to Agent Manager’s main API carry a . 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 is a signed token. Its contents are called . A token that issues to a person carries six claims that matter to AMS.

ClaimWhat it says
subThe subject: who the token was issued to
scopeThe permissions the token carries, one per
ouId and ouHandleYour organisation unit, as an id and a short name ()
audThe audience: who the token is meant for
issThe 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

  1. 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 , 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.

  2. Is it from the right issuer and meant for this service?

    The must be on a configured list and match exactly. The must be one of a configured list too. The chart’s default list includes urn:wso2:amp and amp-console-client, and an entry that ends in * matches by prefix.

  3. What may the caller do?

    AMS stores the claims and splits the space separated scope claim 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_id and namespace, 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 , 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, aud and iss.
  • 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 resource value, which becomes the token’s audience.
  • An agent token is a JWT that AMS signs. A proxy key is opaque and has no claims.

Try it

Token inspector

What to do: pick a token, then click a claim to see what it means and who checks it.

Loading the token examples...

Match them up

What to do: pick an item on the left, then its partner on the right.

Loading the matching game...

Wrap up

Recap

Tick each one when you could explain it to a colleague.

Finished?

Quick check

Loading the quick check...

Spotted something wrong or unclear in this lesson? Report an inaccuracy (opens GitHub in a new tab)