Kind: Service
Source: Pams/API/Pams.API/Pams.API.csproj (line 1)
Part of: Pams
NuGet package dependency
Microsoft.IdentityModel.JsonWebTokens is a NuGet package dependency in the Pams API project for reading, creating, and validating JSON Web Tokens. The API uses it within authentication flows to inspect token claims and enforce token validation rules.
Diagram
mermaidsequenceDiagram participant Client participant API as Pams API participant JWT as Microsoft.IdentityModel.JsonWebTokens Client->>API: Request with Bearer token API->>JWT: Read and validate token JWT-->>API: Claims or validation failure API-->>Client: Authorized response or unauthorized response
Usage
typescriptconst response = await fetch("/api/pams", {
headers: {
Authorization: `Bearer ${accessToken}`,
},
});
if (!response.ok) {
throw new Error("Request was not authorized");
}
const data = await response.json();
console.log(data);
AI Coding Instructions
- Keep
Microsoft.IdentityModel.JsonWebTokensconfiguration in the Pams API authentication pipeline rather than client-side code. - Validate token issuer, audience, signing key, and expiry before accepting claims from a token.
- Treat token claims as untrusted until token validation succeeds.
- When updating the NuGet package reference in
Pams.API.csproj, verify compatibility with the existing authentication and identity model packages.
Was this page helpful?