An API receives JWT access tokens from Microsoft Entra ID. Which two token properties should the API validate before accepting a request? The design must avoid adding custom operational scripts.
Trap 1: The user's display name is present
While a user's display name might be present in claims like `name` or `preferred_username`, its existence or specific value is not a security validation control for the token itself. The API's primary security concern is the token's cryptographic validity and authorization claims, not the presence of user-friendly attributes. An API should not reject a token solely because a display name is missing, nor trust it solely because one is present.
Trap 2: The token was sent in a query string
Transmitting sensitive JWT access tokens in a URL query string is a significant security vulnerability and should never be accepted. Query string parameters are often logged by web servers, proxies, and browser histories, making the token highly susceptible to exposure and interception. Bearer tokens must always be sent securely within the `Authorization` header using the `Bearer` scheme to prevent such leakage.
- A
Issuer and signature are valid for the trusted tenant
This validation is fundamental for establishing trust. The `iss` (issuer) claim in the JWT must precisely match the expected Microsoft Entra ID tenant URL, confirming the token's origin. Concurrently, the token's cryptographic signature is verified using public keys published by Microsoft Entra ID, ensuring the token's integrity and authenticity, proving it hasn't been tampered with since issuance.
- B
The user's display name is present
Why wrong: While a user's display name might be present in claims like `name` or `preferred_username`, its existence or specific value is not a security validation control for the token itself. The API's primary security concern is the token's cryptographic validity and authorization claims, not the presence of user-friendly attributes. An API should not reject a token solely because a display name is missing, nor trust it solely because one is present.
- C
Token audience matches the API application ID URI or client ID
The `aud` (audience) claim within the JWT specifies the intended recipient of the token, which must be the API itself. For an API receiving tokens from Microsoft Entra ID, this value must exactly match its registered Application ID URI or Client ID. This critical validation prevents a token issued for one application from being mistakenly or maliciously used to gain access to a different, unauthorized API.
- D
The token was sent in a query string
Why wrong: Transmitting sensitive JWT access tokens in a URL query string is a significant security vulnerability and should never be accepted. Query string parameters are often logged by web servers, proxies, and browser histories, making the token highly susceptible to exposure and interception. Bearer tokens must always be sent securely within the `Authorization` header using the `Bearer` scheme to prevent such leakage.