---
id: identity-provider
name: Identity Provider
version: 1.0.0
summary: |
  External identity infrastructure that authenticates BookWorm users and
  provides OAuth-compatible identity verification for protected APIs.
scope: external
owners:
  - platform-engineering-team
services:
  - id: oauth-api
    version: 1.0.0
flows:
  - id: product-ingestion
    version: 1.0.0
  - id: user-checkout
    version: 1.0.0
actors:
  - id: customer
    name: Customer
    label: signs in and presents an access token to BookWorm
    direction: inbound
  - id: administrator
    name: Administrator
    label: signs in to access protected administrative operations
    direction: inbound
  - id: business-user
    name: Business User
    label: signs in to access protected business operations
    direction: inbound
badges:
  - content: External
    backgroundColor: purple
    textColor: purple
    icon: GlobeAltIcon
---

## System Purpose & Boundary

The Identity Provider system is BookWorm's external authentication and OAuth 2.0 / OpenID Connect (OIDC) boundary, backed by Microsoft Entra ID. It authenticates **Customers**, **Business Users**, and **Administrators**, issues JWT access tokens, and supports On-Behalf-Of (OBO) agent identity delegation across BookWorm services. Owning domain business data and making fine-grained resource authorization decisions are explicitly out of scope—each consuming BookWorm service enforces its own policies and ownership checks.

:::warning
Authentication is a prerequisite for protected operations, not a substitute for service-level authorization. Protected BookWorm APIs must **fail closed** when token validation or provider metadata fails, never falling back to anonymous access.
:::

## Contained Capabilities

| Service / Agent        | Role in System                                                                                | Primary Data Store          | Interaction Style (Sync / Async) |
| :--------------------- | :-------------------------------------------------------------------------------------------- | :-------------------------- | :------------------------------- |
| [[service\|oauth-api]] | External OAuth/OIDC provider issuing user tokens, agent identities, and verification metadata | External (Provider-managed) | Sync (HTTP / OAuth 2.0 / OIDC)   |

## External Interactions & Trust Boundaries

- **Human sign-in:** Customers, Business Users, and Administrators authenticate through Storefront and Backoffice sessions and present bearer tokens to protected BookWorm APIs.
- **Service token validation:** [[system|product-catalog-system]], [[system|cart-system]], [[system|order-system]], [[system|rating-system]], [[system|chat-system]], [[system|mcp-tools]], and [[system|scheduler-system]] validate issuer, audience, signing keys, expiry, roles, and scopes before executing protected operations.
- **Agent delegation:** Supports delegated OBO token exchange between [[system|chat-system]], [[system|rating-system]], and [[system|mcp-tools]].

## System Visualizations

### System Context

<ContextDiagram />

### Component Topology

<NodeGraph />

### Architecture Decisions

<ADRTable />

## Related Documentation

- [[service|oauth-api]] — App roles, service scopes, and Entra Agent Identity details.
- [[doc|platform/004-identity-and-rbac-matrix]] — Platform-wide Azure RBAC and Entra ID permissions matrix.
- [[flow|user-checkout]] — Authenticated customer checkout flow.
- [[flow|product-ingestion]] — Authenticated catalog authoring and scheduled ingestion flow.
