Skip to content

feat(client): Manage Access Token When Transport with Header - #175

Merged
mckaragoz merged 17 commits into
CodeBeamOrg:devfrom
mckaragoz:TokenManagement
Nov 25, 2026
Merged

mckaragoz merged 17 commits into
CodeBeamOrg:devfrom
mckaragoz:TokenManagement

Conversation

@mckaragoz

@mckaragoz mckaragoz commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

Overview

This PR introduces unified login transport selection and client-side access token lifecycle management across UltimateAuth authentication modes and application profiles.

Clients can now automatically select the appropriate login transport based on effective server-side credential delivery configuration, without requiring applications to manually manage authentication tokens.

What's Changed

Login Transport

  • Introduced automatic, fetch-based, and navigation-based login transports.
  • Added server-side login transport discovery.
  • Unified programmatic and native browser form login completion.
  • Prevented navigation-based login when header-delivered credentials require an observable response.
  • Added response-aware login and logout handling.

Access Token Lifecycle

  • Introduced scoped in-memory access token management.
  • Automatically capture and store header-delivered access tokens.
  • Attach valid access tokens to outgoing requests.
  • Replace access tokens during successful refresh operations.
  • Remove expired credentials and clear tokens after confirmed logout.
  • Added initial authentication recovery for applications with an existing refresh credential.

Hybrid Authentication

  • Use JWT access tokens alongside stateful session credentials.
  • Preserve session-authoritative authentication and validation.
  • Ensure session validation remains independent of accompanying Authorization headers.
  • Align credential issuance with effective authentication mode and delivery configuration.

PKCE and UAuthHub

  • Support fetch-based PKCE completion.
  • Preserve credential ownership by the initiating application.
  • Prevent Hub-local authentication state from being modified during PKCE handoff.
  • Validate handoff destinations against the expected return URL.

Resource API

  • Introduced client-side Resource API request support.
  • Support configurable browser credential inclusion and automatic access token forwarding.
  • Default Resource API authentication to Hybrid with remote session validation.
  • Isolate forwarded session credentials from unrelated incoming cookies.
  • Disable automatic cookie handling and redirects for remote session validation requests.

Documentation and Samples

  • Updated authentication mode, credential delivery, login, refresh, logout, and Resource API documentation.
  • Updated the v0.2.0 migration guide.
  • Updated sample applications and Identity Lab configuration.

Tests

  • Added regression coverage for login transport selection and enforcement.
  • Added access token parsing and lifecycle tests.
  • Added PKCE handoff and redirect validation tests.
  • Added logout, refresh rotation, and authentication recovery tests.
  • Added Hybrid session validation and JWT issuance regression tests.
  • Extended JavaScript interop and endpoint coverage.

@codecov

codecov Bot commented Nov 23, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 84.32203% with 111 lines in your changes missing coverage. Please review.
✅ Project coverage is 88.11%. Comparing base (7b4190a) to head (9abf447).

Files with missing lines Patch % Lines
...am.UltimateAuth.Client/Services/UAuthFlowClient.cs 82.95% 28 Missing and 10 partials ⚠️
...h.Client.Blazor/Components/UAuthLoginForm.razor.cs 70.37% 10 Missing and 6 partials ⚠️
...Client.Blazor/Infrastructure/UAuthRequestClient.cs 85.22% 7 Missing and 6 partials ⚠️
...UltimateAuth.Client/AuthState/UAuthStateManager.cs 74.00% 9 Missing and 4 partials ⚠️
...eAuth.Server/ResourceApi/RemoteSessionValidator.cs 84.90% 6 Missing and 2 partials ⚠️
...Auth.Client/Infrastructure/UAuthLoginCompletion.cs 89.36% 0 Missing and 5 partials ⚠️
...astructure/Credentials/CredentialResponseWriter.cs 77.77% 2 Missing and 2 partials ⚠️
...imateAuth.Server/Endpoints/LoginEndpointHandler.cs 85.71% 0 Missing and 3 partials ⚠️
...lazor/Infrastructure/UAuthResourceRequestClient.cs 57.14% 2 Missing and 1 partial ⚠️
...timateAuth.Server/Endpoints/PkceEndpointHandler.cs 90.90% 0 Missing and 2 partials ⚠️
... and 4 more
Additional details and impacted files
@@            Coverage Diff             @@
##              dev     #175      +/-   ##
==========================================
- Coverage   88.20%   88.11%   -0.09%     
==========================================
  Files         610      615       +5     
  Lines       20416    20838     +422     
  Branches     2456     2525      +69     
==========================================
+ Hits        18007    18361     +354     
- Misses       1545     1589      +44     
- Partials      864      888      +24     
Flag Coverage Δ
framework 88.11% <84.32%> (-0.09%) ⬇️

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.

@mckaragoz
mckaragoz merged commit c9ce54a into CodeBeamOrg:dev Nov 25, 2026
16 checks passed
mckaragoz added a commit that referenced this pull request Nov 25, 2026
* feat(reliability): Add Device Limits - #171⁠

feat(reliability): Add Device Limits

* Add cryptography keys to Docker Compose configuration

* feat(production): Implement PureJwt Authentication & Unify Authentication Architecture (#172)

* feat(production): Introduce PureJwt Auth Mode

* Login Implementation

* Fix Tests

* Add Tests

* Independent and Per ClientProfile AuthMode Options Design

* User Validation Arrangement & Tests

* Stateless Flow Arrangements

* Fix & Add Tests

* Validate & Logout Flow

* New Design of Mode Options

* Fix Grant Resolvers

* Fix Validate Snapshot

* JWT & Refresh Token Signing/Hashing Key Seperation

* PureJwt Refresh Implementation - Part 1

* PureJwt Refresh Implementation - Part 2

* Fix & Add Tests

* Try Resource API Support in PureJwt Auth Mode

* Resource API Implementation - Part 2

* Fix Tests

* Fix Refresh Chain Revoke on Logout on PureJwt

* Device Mismatch Arrangements & Add Tests for Missing Coverage

* More Breaking Changes

* More Improvements

* Fix Authorization & Add Tests

* Add Tests

* DX Improvements

* Add Docs

* Identity Lab Crypthography Implementation

* Last Arrangements

* Added Some Other Migration Explanation

* feat(client): Manage Access Token When Transport with Header (#175)

* feat(client): Manage Access Token When Transport with Header

* Add Transport Protocol for Bearer Token

* Add SendJson Token Transport

* Fix Antiforgery

* Login Arrangements

* Fix Tests

* Fix javascript Tests

* Add Authentication Recovery

* Fix Diagnostics on Login

* Add CORS Options

* PKCE Login Token Implementation

* Arrange ApplicationProfile Defaults

* Fix Tests

* Add Docs

* Implement Smoke Test Failure Fixes

* Add Tests

* Add Tests

* .NET 11 Support (#178)

* .NET 11 Support

* Fix CI

* Update Docs Builder

* Update Client JsMinifier

* Some Arrangements

* Fix Test

* Update 0.2.0-preview.4
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