Skip to content

refactor(architecture): Introduce Surrogate Model and Consolidate Authentication Architecture - #187

Open
mckaragoz wants to merge 3 commits into
CodeBeamOrg:devfrom
mckaragoz:SurrogateModel
Open

mckaragoz wants to merge 3 commits into
CodeBeamOrg:devfrom
mckaragoz:SurrogateModel

Conversation

@mckaragoz

Copy link
Copy Markdown
Contributor

Overview

This PR consolidates UltimateAuth's authentication architecture before the 0.2.0 stable release by introducing the Surrogate concept, unifying authentication terminology, and eliminating redundant abstractions.

A surrogate is secondary authentication data issued by an authentication authority to maintain authentication continuity without repeatedly exposing the original credential. Surrogates are represented by tokens, including authentication-capable session identifiers, access tokens, and refresh tokens.

The established token terminology is retained where it provides a familiar and intuitive developer experience.

Changes

Authentication Domain

  • Introduce SurrogateKind as the unified authentication artifact classification.
  • Remove redundant primary token, transport credential, and grant classifications.
  • Retire grant terminology from the authentication data model.
  • Preserve the distinction between credentials, surrogates, tokens, and metadata-only identifiers.

Authentication Modes

  • Centralize intrinsic authentication mode characteristics.
  • Remove unnecessary primary token resolution services.
  • Simplify mode-dependent authentication behavior across server and resource applications.

Transport and Resolution

  • Consolidate surrogate transport, resolution, and response-writing terminology.
  • Reduce duplicated authentication data resolution logic.
  • Clarify the distinction between incoming surrogate acceptance and outgoing surrogate delivery.
  • Preserve mode-specific validation and security requirements.

Configuration and Cleanup

  • Simplify public configuration APIs.
  • Retain familiar token configuration and issuance terminology.
  • Remove obsolete types, unused abstractions, and legacy implementations.
  • Update affected tests, samples, and client integrations.

Documentation

  • Introduce a Core Concepts page under Fundamentals.
  • Establish consistent authentication terminology throughout the documentation.
  • Update configuration examples and the 0.2.0 migration guide.

Breaking Changes

This PR intentionally introduces breaking API changes to establish a consistent and maintainable architectural foundation before the 0.2.0 stable release.

Obsolete APIs and redundant abstractions are removed rather than retained as compatibility layers.

Security

The architectural consolidation must preserve existing authentication guarantees, including tenant and device binding, session lineage validation, refresh token rotation, transport collision detection, CSRF protection, and metadata-only session identifier restrictions.

Goals

  • Establish stable authentication terminology.
  • Reduce architectural complexity and duplicated responsibilities.
  • Improve developer experience and API discoverability.
  • Provide a consistent foundation for future security and scalability features.

@codecov

codecov Bot commented Dec 3, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 89.80892% with 48 lines in your changes missing coverage. Please review.
✅ Project coverage is 88.74%. Comparing base (78b4e35) to head (f4c8bf2).

Files with missing lines Patch % Lines
...eAuth.Server/Auth/Response/AuthResponseResolver.cs 73.75% 13 Missing and 8 partials ⚠️
...r/ResourceApi/ResourceSurrogateTransportFactory.cs 78.78% 4 Missing and 3 partials ⚠️
...rastructure/Credentials/SurrogateResponseWriter.cs 88.67% 3 Missing and 3 partials ⚠️
...Auth.Server/Flows/Refresh/RefreshResponsePolicy.cs 33.33% 4 Missing ⚠️
...ateAuth.Server/Endpoints/RefreshEndpointHandler.cs 50.00% 1 Missing and 2 partials ⚠️
...ltimateAuth.Core/Extensions/UAuthModeExtensions.cs 97.40% 1 Missing and 1 partial ⚠️
...n/AspNetCore/UAuthResourceAuthenticationHandler.cs 93.54% 1 Missing and 1 partial ⚠️
...ltimateAuth.Server/Auth/Context/AuthFlowContext.cs 66.66% 1 Missing ⚠️
...ntication/AspNetCore/UAuthAuthenticationHandler.cs 66.66% 0 Missing and 1 partial ⚠️
...mateAuth.Server/Endpoints/LogoutEndpointHandler.cs 75.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##              dev     #187      +/-   ##
==========================================
+ Coverage   88.68%   88.74%   +0.06%     
==========================================
  Files         621      622       +1     
  Lines       21970    21950      -20     
  Branches     2673     2677       +4     
==========================================
- Hits        19483    19480       -3     
+ Misses       1557     1533      -24     
- Partials      930      937       +7     
Flag Coverage Δ
framework 88.74% <89.80%> (+0.06%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant