Skip to content

Microsoft.Owin.Security

reference
1 min readUpdated

Kind: Service

Source: Pams/Core/Pams.Security/Pams.Security.csproj (line 1)

Part of: Pams

NuGet package dependency

Microsoft.Owin.Security is a NuGet package dependency declared by Pams.Security.csproj. It supports OWIN authentication middleware, identity handling, and authentication challenge behavior within the Pams security layer.

Diagram

mermaid
flowchart TD
    Client[JavaScript client] -->|Sends request with credentials| Application[Application endpoint]
    Application -->|Passes request through| Owin[OWIN security middleware]
    Owin -->|Reads authentication state| Identity[Authenticated identity]
    Identity -->|Allows or rejects access| Application
    Application -->|Returns response| Client

Usage

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

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

  return response.json();
}

loadCurrentUser()
  .then((user) => console.log(user))
  .catch((error) => console.error(error));

AI Coding Instructions

  • Keep OWIN authentication configuration in the .NET security project that references Microsoft.Owin.Security.
  • Treat this package as server-side middleware; browser code should call protected application endpoints rather than import it.
  • Preserve the existing authentication middleware order when changing startup configuration.
  • Check authentication state before returning protected application data.
  • Update package references through Pams.Security.csproj when changing this dependency.

Was this page helpful?

Download as PDF