# Microsoft.AspNet.Identity.Owin

**Kind:** Service

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

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

NuGet package dependency

`Microsoft.AspNet.Identity.Owin` is a NuGet dependency in the legacy `Pams.Business` project that connects ASP.NET Identity with the OWIN request pipeline. It supports authentication middleware configuration and access to Identity managers through the OWIN context.

## Diagram

```mermaid
sequenceDiagram
    participant Client
    participant OWIN as OWIN Pipeline
    participant Identity as ASP.NET Identity
    participant App as Pams.Business

    Client->>OWIN: Send authenticated request
    OWIN->>Identity: Read authentication cookie or token
    Identity-->>OWIN: Resolve identity and claims
    OWIN->>App: Continue request with authenticated principal
    App-->>Client: Return response
```

## Usage

```ts
async function getCurrentUser() {
  const response = await fetch("/api/account/current", {
    credentials: "include",
    headers: {
      Accept: "application/json",
    },
  });

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

  return response.json();
}

getCurrentUser().then((user) => {
  console.log(user);
});
```

## AI Coding Instructions

- Keep `Microsoft.AspNet.Identity.Owin` package references aligned with the ASP.NET Identity and OWIN package versions used by `Pams.Business`.
- Configure Identity middleware before endpoints that require an authenticated user.
- Resolve Identity managers from the OWIN context rather than creating them directly during request handling.
- Treat this dependency as part of the legacy ASP.NET application pipeline; do not import it into TypeScript or browser code.

## 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
