# Microsoft.IdentityModel.Tokens

**Kind:** Service

**Source:** `Pams/Logic/Pams.Business/Pams.Business.csproj` (line 1)

**Part of:** [Pams](subsystem-pams)

NuGet package dependency

`Microsoft.IdentityModel.Tokens` is a NuGet package dependency referenced by `Pams.Business.csproj`. It provides token, signing key, and validation types used by the business layer when working with identity tokens and authentication configuration.

## Diagram

```mermaid
sequenceDiagram
    participant Client
    participant Api as PAMS API
    participant Business as Pams.Business
    participant Tokens as Microsoft.IdentityModel.Tokens

    Client->>Api: Send request with bearer token
    Api->>Business: Forward authentication context
    Business->>Tokens: Validate token signing key and parameters
    Tokens-->>Business: Return validation result
    Business-->>Api: Allow or reject request
    Api-->>Client: Return response
```

## Usage

```typescript
async function loadCurrentUser(accessToken: string) {
  const response = await fetch("/api/users/current", {
    headers: {
      Authorization: `Bearer ${accessToken}`,
    },
  });

  if (!response.ok) {
    throw new Error("Authentication failed");
  }

  return response.json();
}
```

## AI Coding Instructions

- Keep `Microsoft.IdentityModel.Tokens` references in the `.csproj` package dependency list.
- Use token validation parameters and signing key types supplied by this package in server-side authentication code.
- Do not expose signing keys, token validation settings, or token-generation logic to browser code.
- Check existing authentication middleware and configuration before changing token validation behavior.

## Used by

2 references from 2 files. Each is a place in this repository where the symbol is actually used — go read one rather than trusting an example.

### Injected or called by (2)

- `Pams.API` — `Pams/API/Pams.API/Pams.API.csproj`:1
- `Pams.Business` — `Pams/Logic/Pams.Business/Pams.Business.csproj`:1
