# Microsoft.Owin.Security

**Kind:** Service

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

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

NuGet package dependency

`Microsoft.Owin.Security` is a NuGet dependency referenced by `Pams.Core` for OWIN-based authentication and authorization components. It supports security middleware, identity handling, and protected request processing in the legacy project format.

## Diagram

```mermaid
sequenceDiagram
    participant Client
    participant Api as Pams API
    participant Owin as Microsoft.Owin.Security
    participant Resource as Protected Resource

    Client->>Api: Send request with Authorization header
    Api->>Owin: Pass request through security middleware
    Owin->>Owin: Validate authentication context
    Owin-->>Api: Authentication result
    Api->>Resource: Process authorized request
    Resource-->>Api: Return response
    Api-->>Client: Return HTTP response
```

## Usage

```ts
async function loadProtectedData(token: string) {
  const response = await fetch("/api/pams/data", {
    headers: {
      Authorization: `Bearer ${token}`,
      Accept: "application/json",
    },
  });

  if (!response.ok) {
    throw new Error(`Request failed: ${response.status}`);
  }

  return response.json();
}
```

## AI Coding Instructions

- Keep `Microsoft.Owin.Security` references aligned with the OWIN middleware configured by the host application.
- Check authentication middleware order when adding protected API routes or changing authorization behavior.
- Do not assume this package configures a specific authentication scheme; verify the application startup configuration.
- Preserve the legacy project dependency format unless the project is intentionally migrated to a newer package management approach.
