datarobot_genai.dragent.inbound_token
inbound_token
Where the caller's IdP access token arrives.
One definition, two consumers -- frontends/claim_validation.py validates the token's
aud, plugins/okta_a2a_auth.py exchanges it. If they read different headers, a token
could skip validation and still be exchanged. Not configurable: the gateway picks the header
it forwards, so naming another one would just receive nothing.
Only x-datarobot-external-access-token carries an IdP token. The gateway populates it with
the external token it has already validated, so a value there is an IdP token by construction.
authorization carries DataRobot's own credentials instead -- an opaque API token, or a
DataRobot-issued JWT that decodes perfectly well and has nothing to do with the caller's IdP --
so it is never read here.
InboundTokenExpiredError
Bases: RuntimeError
The caller's IdP access token had expired when the agent tried to exchange it.
Raised before any call to the IdP, so the message is built here and never carries token material -- it is safe to show to operators and to the LLM. The agent cannot recover from this on its own: whoever calls the agent must forward a refreshed access token.
Source code in datarobot_genai/dragent/inbound_token.py
find_idp_token
Return the caller's IdP access token, or None.
Needs only case-insensitive get -- Starlette Headers and NAT context headers both
qualify. Reads only OAUTH_ACCESS_TOKEN_HEADER and returns it whatever its shape, since
that header carries nothing else; see the module docstring for why authorization is
never consulted.