Introduced `EnvelopeAuthService` and `IEnvelopeAuthService` to handle server-side authentication for envelope receiver pages.
- Registered `IEnvelopeAuthService` as a scoped service in `Program.cs`.
- Implemented `EnvelopeAuthService` to validate user authentication and envelope key matching using `IHttpContextAccessor` and JWT claims.
- Added methods to retrieve the authenticated envelope key and current user (`ClaimsPrincipal`).
- Prioritized `NameIdentifier` claim for envelope key extraction, with fallback to `sub` claim.
- Documented the service and interface with XML comments for clarity.
This centralizes authentication logic, ensuring reusability and adherence to SSR best practices.
Added the `Yarp.ReverseProxy` package and configured the app to use
YARP for forwarding specific authentication-related API requests
to an external service (`auth-hub`). Updated `Program.cs` to load
YARP configuration from a new `yarp.json` file and added middleware
to map unmatched requests to the reverse proxy.
Replaced old routes and clusters with new routes (`auth-login`,
`auth-envelope-receiver-login`) and a new cluster (`auth-hub`)
pointing to `https://localhost:9090`. Configured route
transformations for path and query parameter adjustments.
These changes improve modularity and scalability by enabling
dynamic reverse proxy configuration and external service
integration.
Replaced direct injection of HttpClient with IHttpClientFactory
across the codebase to improve HTTP client management and align
with best practices. Removed dependency on ApiOptions and
IOptions<ApiOptions> in multiple services, simplifying constructors
and reducing configuration complexity.
Updated FontLoader to use IHttpClientFactory for font loading
with relative paths. Adjusted comments and documentation to
reflect these changes. Cleaned up unused using directives
related to ApiOptions.
Updated HttpClient setup to use named clients for API calls
and DevExpress components, improving resource management
and scalability. Scoped a default HttpClient for PdfViewer
requirements. Removed ApiOptions configuration binding for
simplification. Updated FontLoader to use IHttpClientFactory
to align with modern best practices.
Moved HttpContextAccessor registration into the configuration
of the named HttpClient ("EnvelopeGenerator.Server") to support
server-side rendering (SSR) scenarios. Updated the HttpClient
to dynamically set its BaseAddress based on the current request's
scheme and host using HttpContextAccessor. Removed standalone
HttpContextAccessor registration and updated related comments.
Updated DependencyInjection.cs to change ISmsSender and
IEnvelopeSmsHandler lifetimes from Singleton to Scoped,
ensuring per-request instantiation. Added Microsoft.Extensions.Http
package to EnvelopeGenerator.Server.Client.csproj for enhanced
HttpClient handling. Refactored AnnotationService, AuthService,
DocumentService, EnvelopeReceiverService, SignatureCacheService,
and SignatureService to use IHttpClientFactory, improving
flexibility and testability. Introduced a named HttpClient
"EnvelopeGenerator.Server" in Program.cs for internal API calls,
and removed the previous HttpClient setup using HttpContextAccessor.
Added necessary using directives for System.Net.Http across
service files to support these changes.
Renamed namespaces and related identifiers from EnvelopeGenerator.WebUI
to EnvelopeGenerator.Server across the project. This change affects
data models, services, controllers, and configuration files to ensure
consistency with the new architecture.
Updated @using directives in Razor components and other files to
reflect the new namespace structure. Adjusted project references in
EnvelopeGenerator.Server.csproj to point to the new
EnvelopeGenerator.Server.Client project.
Modified middleware and logging configurations to use the new
EnvelopeGenerator.Server namespace, including changes in Program.cs
and appsettings.json.
Updated resource and file references to use the new
EnvelopeGenerator.Server path, ensuring correct resource loading.
Adjusted configuration options in Program.cs to use the new namespace
for options classes, such as ApiOptions and PdfViewerOptions.
Updated authentication scheme names and related constants to align
with the new namespace structure.
Revised comments and documentation to reflect the new namespace,
ensuring clarity and consistency in the codebase.
Replaced "EnvelopeGenerator.WebUI" with "EnvelopeGenerator.Server" and "EnvelopeGenerator.WebUI.Client" with "EnvelopeGenerator.Server.Client". Updated project entries, solution configuration platforms, and nested projects to reflect these changes.