# Microsoft.Owin.Security

**Kind:** Service

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

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

NuGet package dependency

`Microsoft.Owin.Security` is a NuGet package dependency declared in `Pams.Business.csproj`. It supplies OWIN security abstractions that the Pams.Business application can use to authenticate requests and establish a request identity.

## Diagram

```mermaid
sequenceDiagram
    participant Client
    participant Application as Pams.Business Application
    participant Owin as Microsoft.Owin.Security
    participant IdentityProvider

    Client->>Application: Send request with credentials
    Application->>Owin: Run authentication middleware
    Owin->>IdentityProvider: Validate credentials or token
    IdentityProvider-->>Owin: Return identity result
    Owin-->>Application: Set authenticated principal
    Application-->>Client: Return protected response
```

## Usage

```ts
async function loadPamsData(accessToken: string) {
  const response = await fetch("/api/pams", {
    headers: {
      Authorization: `Bearer ${accessToken}`,
    },
  });

  if (!response.ok) {
    throw new Error("The Pams.Business service rejected the request.");
  }

  return response.json();
}
```

## AI Coding Instructions

- Treat `Microsoft.Owin.Security` as a dependency of the legacy `Pams.Business.csproj` project rather than a TypeScript runtime package.
- Configure authentication middleware during OWIN application startup before routes that require an authenticated user.
- Pair this base security package with the authentication provider package required by the configured identity flow.
- Preserve the authenticated OWIN principal when adding middleware so downstream application code can read the request identity.
- Keep client requests aligned with the authentication scheme configured by the OWIN application.

## Used by

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

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