Replaced the WASM client-side authentication service with a new
SSR (Server-Side Rendering) authentication service to resolve
issues in SSR mode caused by self-referencing HTTP requests and
the lack of `HttpContext`.
Added `IEnvelopeAuthService` interface and its implementation
`EnvelopeAuthService`, which directly accesses `HttpContext.User`
to validate user authentication and claims. Registered the service
in the DI container with a scoped lifetime.
Updated `EnvelopeReceiverPage.razor` to use the new SSR service
for authentication checks and logout logic. Changes to the page
were reverted due to a merge conflict, with a detailed plan
provided for re-application.
Improved logging for debugging authentication issues and outlined
a migration checklist, including testing, unit tests, and
documentation updates. These changes improve performance, ensure
SSR compatibility, and eliminate unnecessary HTTP requests.
Updated SVG paths for improved icon rendering and appearance.
Reformatted code for consistent style, including moving braces
to new lines and improving indentation. Enhanced error handling
logic for `LoginResult` states with better readability. Updated
password input field toggle logic and replaced SVG icons for
show/hide functionality. Refactored `SubmitAsync` and
`OnKeyDownAsync` methods for clarity. Cleaned up unnecessary
whitespace and ensured overall maintainability.
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.
Updated the `$schema` URL to use HTTPS. Modified `iisSettings` with new `applicationUrl` and `sslPort`. Removed old profiles (`http`, `https`, `IIS Express`) and added new ones: `https (Blazor UI)`, `https (Swagger API)`, `http (Development)`, and updated `IIS Express`. Removed `inspectUri` from `IIS Express` profile.
A new Jenkins pipeline has been added to the `Jenkinsfile` with a 'Build' stage executing `dotnet build`. The `appsettings.Development.json` file has been reformatted for consistency. In `appsettings.json`, comments have been added to explain the "Content-Security-Policy" nonce usage, logging levels, and the naming format for resource files in the `Cultures` section, aiding in localization management.
Introduce `ReceiverClaimExtensions` and `SenderClaimExtensions` classes in the `EnvelopeGenerator.API.Extensions` namespace. These classes provide methods to extract specific claims from a `ClaimsPrincipal` object, aiding in user authentication.
In `ReceiverClaimExtensions.cs`, add methods to retrieve envelope-specific claims such as `EnvelopeUuid`, `ReceiverSignature`, `ReceiverMail`, `EnvelopeId`, and `ReceiverId`. Implement `GetRequiredClaimValue` to handle missing claims.
In `SenderClaimExtensions.cs`, add methods to extract sender-related claims like `GetId`, `GetUsername`, `GetName`, `GetPrename`, and `GetEmail`. Implement `GetRequiredClaimOfSender` for handling missing claims.
Both classes include XML documentation for clarity on method usage and exceptions.
Introduce AuthProxyDocumentFilter to enhance OpenAPI docs by
adding custom operations for login and envelope receiver
login. Implement methods to define POST operations at
`/api/auth` and `/api/Auth/envelope-receiver/{key}` paths,
including request parameters and response descriptions.
Include necessary using directives for OpenAPI support.
Introduce new classes and records in the `EnvelopeGenerator.API.Models` namespace to handle various functionalities:
- Add `Auth` record for managing authentication codes.
- Introduce `ContactLink` class for hyperlink management.
- Add `Culture` and `Cultures` classes for language and culture info.
- Implement `CustomImages` class for image management.
- Add `EnvelopeReceiverLogin` record for login requests.
- Introduce `ErrorViewModel` for error representation.
- Add `Image` class for image source and CSS management.
- Implement `Login` record for user authentication.
- Add `MainViewModel` with a nullable `Title` property.
- Introduce PDF annotation classes in `PsPdfKitAnnotation` namespace.
- Add `TFARegParams` class for 2FA registration parameters.
Introduced a new `AuthScheme` class for JWT authentication
schemes. Added `ExceptionHandlingMiddleware` for global
exception handling. Updated `Program.cs` to refactor service
registrations, including Blazor, API controllers, CORS, and
Swagger setup. Removed YARP reverse proxy and added a more
comprehensive configuration for authentication and caching.
Updated `appsettings.json` and `appsettings.Development.json`
with new sections for authentication, logging, and various
application-specific settings. Added new classes for handling
authentication tokens, connection strings, and cache options.
Removed `@rendermode="InteractiveAuto"` from `<HeadOutlet />` and `<Routes />` in `App.razor` to adjust rendering mode. Updated `EnvelopeReceiverPage_DxPdfViewer.razor` to use `DevExpress.Blazor.PdfViewer` instead of `DevExpress.Blazor`. Added `@using DevExpress.Blazor` to `_Imports.razor` for project-wide access to DevExpress components. Embedded `Resources\Invoice.pdf` in `EnvelopeGenerator.WebUI.csproj` and added the PDF file to the project.
Added `EnvelopeGenerator.WebUI.Client.Services` to the using directives. Registered `IHttpContextAccessor` to access HTTP context for request-specific information. Modified `HttpClient` setup to dynamically set the base address using the current request's host. Introduced several business services (`DocumentService`, `AuthService`, `AnnotationService`, `EnvelopeReceiverService`, `SignatureService`, `SignatureCacheService`, `AppVersionService`) to the service collection, indicating new features. Maintained existing YARP configuration. Noted the importance of DevExpress services for `DxPdfViewer`.
- Architecture overview (Blazor Auto Server+WASM hybrid)
- Critical development commands (both API and WebUI must run)
- Route structure with render mode requirements
- Coordinate system conversions (INCHES in DB)
- API architecture quirks and missing endpoints
- Status color coding from legacy VB.NET app
- Common mistakes to avoid
- Configuration locations and migration status
Migrate ReceiverUI to hybrid Blazor WebUI architecture
Migrated the `EnvelopeGenerator.ReceiverUI` project to a new
hybrid Blazor architecture (`EnvelopeGenerator.WebUI`) that
supports both Blazor Server and WebAssembly (WASM) modes.
- Added `WebUI` (server) and `WebUI.Client` (WASM) projects.
- Migrated client-side pages to `WebUI.Client` with
`@rendermode InteractiveWebAssembly`.
- Migrated server-side pages to `WebUI` with
`@rendermode InteractiveServer`.
- Added YARP reverse proxy (`yarp.json`) to `WebUI` for API
and Swagger routing.
- Registered DevExpress server-side services in `WebUI` to
enable backend rendering for `DxPdfViewer`.
- Migrated services, models, options, and data files to
`WebUI.Client` with updated namespaces.
- Merged static files (JS, CSS, configuration) from
`ReceiverUI/wwwroot` to `WebUI/wwwroot`.
- Retained `ReceiverUI` project for rollback safety.
This migration resolves the issue where the DevExpress
`DxPdfViewer` failed to render PDFs in a pure Blazor
WebAssembly environment due to missing server-side rendering
services.
The `using DevExpress.XtraReports.UI;` directive was modified in
both `Report.cs` and `ReportsFactory.cs` due to the addition of a
non-visible character (likely a Byte Order Mark or BOM) at the
beginning of the line. This change does not affect functionality
but may resolve potential issues with tools or version control
systems sensitive to such characters.
Enhanced `appsettings.json` with `ApiOptions` and `PdfViewerOptions` for better customization of rendering and zoom behaviors.
Added comprehensive styles in `envelope-viewer.css` for the layout, toolbar, thumbnails, and responsive design of the envelope viewer.
Introduced `receiver-signature.js` to manage signature functionality, including drawing, typed, and image-based signatures, as well as dynamic annotation checkboxes.
Integrated `Typed.js` (UMD version) for typing animations with configurable speeds, looping, and event hooks.
Added DevExpress WASM components for PDF and report viewing, including Blazor PDF Viewer and Report Viewer. Configured DevExpress Blazor Reporting for development mode and registered custom reporting services and trusted classes for deserialization.
Replaced default `HttpClient` with a scoped service using WebUI's YARP proxy. Introduced configuration options for `ApiOptions` and `PdfViewerOptions` and registered multiple business services in the DI container.
Added in-memory report storage and font loading functionality. Updated `_Imports.razor` with additional namespaces. Re-enabled and implemented previously commented-out configuration options and removed obsolete code.
Introduced several new classes in the `EnvelopeGenerator.WebUI.Client` namespace:
- Added `Adjustment` class for financial adjustments with deterministic randomization.
- Added `Customer` class to load customer data from a SQL data source with fallback.
- Added `DataItem` class to represent detailed billing data, including adjustments.
- Added `DataItemList` class implementing `IList` for dynamic `DataItem` generation.
- Added `DeterministicRandom` class for reproducible random value generation.
- Added `Term` struct to define payment terms.
- Added `ReportsFactory` class to manage predefined reports.
Updated `MIGRATION_CONTEXT.md` to document the completion of Phase 5 (Data & PredefinedReports Migration) and outline next steps for resolving DevExpress-related errors in Phase 7.
Introduced new models (`SignatureDto`, `SignatureCaptureDto`, `EnvelopeReceiverDto`) to support a signature-based workflow. Added services for handling API interactions (`SignatureService`, `AuthService`, `DocumentService`, `EnvelopeReceiverService`, `SignatureCacheService`).
Enhanced configuration with `ApiOptions` and `PdfViewerOptions`. Integrated DevExpress features with custom data connection providers, in-memory report storage, and font loading utilities.
Marked `AnnotationDto` and `AnnotationService` as `[Obsolete]` in favor of newer implementations. Added detailed documentation for coordinate systems, unit conversions, and usage scenarios.
Added `EnvelopeSenderPage.razor` as a placeholder for the sender's dashboard.
Updated `Index.razor` to include a homepage with a hero header, feature badges,
and dynamic description rendering using JavaScript interop.
Implemented `LoginReceiverPage.razor` for secure document access via access code,
with error handling and user feedback for various login states.
Implemented `LoginSenderPage.razor` for sender authentication, including error
handling, password visibility toggle, and redirection to the sender dashboard.
Added YARP reverse proxy for API routing and DevExpress Blazor components for advanced UI features, including PDF Viewer. Updated `EnvelopeGenerator.WebUI.csproj` to include necessary packages and ensure `yarp.json` is copied to the output directory. Modified `Program.cs` to configure YARP and DevExpress services, and adjusted the HTTP pipeline for proper routing. Updated `appsettings.json` with `ApiOptions` and `PdfViewerOptions`. Added `yarp.json` to define reverse proxy routes and clusters.
Migrated `EnvelopeGenerator.ReceiverUI` to a new hybrid
Blazor architecture (`EnvelopeGenerator.WebUI`) combining
Blazor Server and WebAssembly modes. This resolves the
issue with `DxPdfViewer` requiring server-side rendering.
Key changes:
- Introduced `WebUI` (Blazor Server) and `WebUI.Client`
(Blazor WebAssembly) projects.
- Added YARP reverse proxy to `WebUI` for API routing.
- Migrated client-side pages to `WebUI.Client` with
`@rendermode InteractiveWebAssembly`.
- Migrated server-side pages (e.g., PDF viewer) to `WebUI`
with `@rendermode InteractiveServer`.
- Copied services, models, and static files from `ReceiverUI`.
- Configured DevExpress server-side and WASM components.
Includes detailed migration documentation, rollback plan,
and testing strategies to ensure stability.
Introduced a new Blazor WebAssembly project (`EnvelopeGenerator.WebUI.Client`) targeting .NET 8.0 for client-side functionality.
Added a Blazor Server project (`EnvelopeGenerator.WebUI`) to host the application and enable server-side rendering.
Created essential Razor components (`MainLayout.razor`, `Home.razor`, `Routes.razor`, `Error.razor`, etc.) for layouts, routing, and error handling.
Configured project files, solution structure, and build settings. Added necessary styles, app settings, and launch profiles for development.
Modified the `[Authorize]` attribute on the `GetAsync` method in the `EnvelopeController` class to specify `AuthenticationSchemes = AuthScheme.Sender`. This change enforces a more specific authentication requirement, allowing access only to users authenticated under the `Sender` scheme.
The mapping for the `Envelope` entity to the `EnvelopeDto` was
modified to include a custom mapping for the `Receivers` property.
The `Receivers` property in `EnvelopeDto` is now populated by
mapping from the `EnvelopeReceivers` collection in the `Envelope`
entity, specifically selecting the `Receiver` property from each
`EnvelopeReceiver` object.
Enhanced the EnvelopeDto class by introducing a new `Receivers` property of type `IEnumerable<ReceiverDto>?` to support including recipient information in the envelope DTO.
Added necessary `using` directives for `EnvelopeReceiver` and `Receiver` DTOs to ensure proper namespace references. Updated the class to accommodate this new functionality.
The `UserId` property in `ReadEnvelopeQuery` was changed from `public` to `internal` to improve encapsulation. A new `Authorize` method was added to set the `UserId` property using the `with` expression.
In `ReadEnvelopeQueryHandler`, the LINQ query was updated to replace the inclusion of `Documents` with `EnvelopeReceivers` and their associated `Receiver`, reflecting a shift in the data being eagerly loaded to support updated functionality.