# duendesoftware/foss architecture

> Architecture diagram of the GitHub repository duendesoftware/foss, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/duendesoftware/foss
- Repository: https://github.com/duendesoftware/foss

## Overview

##### Main Components Identification

a. Access Token Management
- Token handling and lifecycle management
- Integration with OpenID Connect
- Client credential management
- Blazor and Web client support

b. Identity Model
- Core OAuth 2.0 and OpenID Connect functionality
- HTTP client extensions
- JWT and claims handling
- Certificate management

c. OIDC Client
- Native client implementations
- Browser integration
- Platform-specific implementations (Windows, MAUI, etc.)

**[Identity Model Core]**
- Claims handling
- JWT processing
- Certificate management

**[OAuth 2.0 / OpenID Connect Protocol Handlers]**
- Token endpoints
- Authorization endpoints
- Discovery services

**[Client Libraries]**
- Browser integration
- Native clients
- Token management

##### Relationship Visualization

Use the following connection types:

##### Implementation Details

a. Token Management:
**[Access Token Management]**
**↓**
**[Token Store] ← [Token Refresh Logic]**
**↓**
**[Client Credentials] ← [Authentication Handlers]**

b. Protocol Implementation:
**[OIDC Protocol Layer]**
**↓**
**[Discovery] → [Authentication] → [Token Management]**

c. Client Integration:
**[Native Clients]**
**↓**
**[Browser Integration] → [Token Handling]**
**↓**
**[Platform Specific Implementation]**

##### External Integration Points

Connections to:
- Identity Providers
- Token Endpoints
- Resource Servers
- Client Applications

##### Notes Section

Implementation notes for:
- Security considerations
- Configuration requirements
- Platform compatibility
- Integration patterns

Remember to include version compatibility information and any critical dependencies between components. This will help developers understand how to properly implement and integrate these libraries into their applications.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Core["Core Components"]
        IM["Identity Model"]:::core
        JWT["JWT/JWK Processing"]:::core
        Cert["Certificate Management"]:::core
        Claims["Claims Handling"]:::core
        
        IM --> JWT
        IM --> Cert
        IM --> Claims
    end

    subgraph Protocol["Protocol Layer"]
        TokenEP["Token Endpoints"]:::protocol
        AuthEP["Authorization Endpoints"]:::protocol
        Discovery["Discovery Services"]:::protocol
        
        Discovery --> TokenEP
        Discovery --> AuthEP
    end

    subgraph TokenMgmt["Token Management"]
        ATM["Access Token Management"]:::token
        TokenStore["Token Store"]:::token
        TokenRefresh["Token Refresh Logic"]:::token
        ClientCred["Client Credentials"]:::token
        
        ATM --> TokenStore
        ATM --> TokenRefresh
        ATM --> ClientCred
    end

    subgraph Client["Client Integration"]
        OIDC["OIDC Client"]:::client
        Browser["Browser Integration"]:::client
        Native["Native Clients"]:::client
        Web["Web Integration"]:::client
        Blazor["Blazor Integration"]:::client
        DPoP["DPoP Extensions"]:::client
        
        OIDC --> Browser
        OIDC --> Native
        OIDC --> Web
        OIDC --> Blazor
        OIDC --> DPoP
    end

    Protocol --> TokenMgmt
    Core --> Protocol
    TokenMgmt --> Client
    
    %% External Systems
    IDP["Identity Provider"]:::external
    RS["Resource Server"]:::external
    
    Client --> IDP
    Client --> RS
    
    %% Click Events
    click IM "https://github.com/DuendeSoftware/foss/tree/main/identity-model/src/IdentityModel"
    click JWT "https://github.com/DuendeSoftware/foss/tree/main/identity-model/src/IdentityModel/Jwk"
    click TokenEP "https://github.com/DuendeSoftware/foss/tree/main/identity-model/src/IdentityModel/Client/Messages"
    click Discovery "https://github.com/DuendeSoftware/foss/blob/main/identity-model/src/IdentityModel/Client/Messages/DiscoveryDocumentResponse.cs"
    click AuthEP "https://github.com/DuendeSoftware/foss/blob/main/identity-model-oidc-client/src/IdentityModel.OidcClient/AuthorizeClient.cs"
    click ATM "https://github.com/DuendeSoftware/foss/tree/main/access-token-management/src/AccessTokenManagement"
    click OIDC "https://github.com/DuendeSoftware/foss/blob/main/identity-model-oidc-client/src/IdentityModel.OidcClient"
    click Browser "https://github.com/DuendeSoftware/foss/tree/main/identity-model-oidc-client/src/IdentityModel.OidcClient/Browser"
    click Native "https://github.com/DuendeSoftware/foss/tree/main/identity-model-oidc-client/samples/ConsoleClientWithBrowser"
    click Web "https://github.com/DuendeSoftware/foss/tree/main/access-token-management/samples/Web"
    click Blazor "https://github.com/DuendeSoftware/foss/tree/main/access-token-management/samples/BlazorServer"
    click DPoP "https://github.com/DuendeSoftware/foss/tree/main/identity-model-oidc-client/src/IdentityModel.OidcClient.Extensions/DPoP"

    %% Styling
    classDef core fill:#2374ab
    classDef protocol fill:#ff7f50
    classDef token fill:#4caf50
    classDef client fill:#9c27b0
    classDef external fill:#gray

    %% Legend
    subgraph Legend
        L1["Core Components"]:::core
        L2["Protocol Handlers"]:::protocol
        L3["Token Management"]:::token
        L4["Client Integration"]:::client
        L5["External Systems"]:::external
    end
```
