# Microsoft.Owin.Security.Cookies

**Kind:** Service

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

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

NuGet package dependency

`Microsoft.Owin.Security.Cookies` is a NuGet package dependency declared by the Pams.Business project. It supports cookie-based authentication in the legacy OWIN application pipeline by issuing, reading, and validating authentication cookies.

## Diagram

```mermaid
sequenceDiagram
    participant Client
    participant PamsBusiness as Pams.Business
    participant CookieAuth as Microsoft.Owin.Security.Cookies

    Client->>PamsBusiness: Send authenticated request
    PamsBusiness->>CookieAuth: Read authentication cookie
    CookieAuth-->>PamsBusiness: Return identity or authentication failure
    PamsBusiness-->>Client: Return protected response or sign-in result
```

## Usage

```ts
async function getProtectedData() {
  const response = await fetch("/api/protected-data", {
    method: "GET",
    credentials: "include",
  });

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

  return response.json();
}
```

## AI Coding Instructions

- Treat this package as a server-side OWIN dependency; client code should send cookies with `credentials: "include"` when required.
- Keep cookie authentication middleware configuration aligned with the application sign-in and sign-out endpoints.
- Do not replace or remove the package without checking OWIN pipeline configuration and existing authentication flows.
- Verify cookie settings such as domain, path, secure transport, and expiration when changing authentication behavior.

## Used by

3 references from 3 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 (3)

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