Refactored the deployment architecture to include two distinct
presentation projects: `EnvelopeGenerator.API` (ASP.NET Core Web
API with YARP Reverse Proxy) and `EnvelopeGenerator.ReceiverUI`
(Blazor WebAssembly). The API now acts as the single entry point,
proxying requests to the ReceiverUI and external authentication
services.
Redefined the route structure for clarity, introducing sender
routes (`/sender/login`, `/sender`) and receiver routes
(`/envelope/login/{EnvelopeKey}`, `/envelope/{EnvelopeKey}`).
Added multi-envelope support with per-envelope cookies for
simultaneous authentication.
Renamed `EnvelopeViewer` to `EnvelopeReceiver` to reflect its
expanded functionality for viewing and signing envelopes.
Replaced iText7 and PSPDFKit with PDF.js 3.11.174 for document
viewing and signing, with configurable quality settings.
Updated `AuthService` and `SignatureCacheService` to support the
new route structure and multi-envelope authentication. Adjusted
sender login flow to redirect to `/sender` upon success.
Updated documentation to reflect the new architecture, route
structure, and file renames. Deprecated libraries and past
mistakes were documented to avoid repetition.
Updated the login route from `/login/{EnvelopeKey}` to
`/envelope/login/{EnvelopeKey}` across the application, including
navigation paths in `EnvelopeReceiver.razor` and the `@page` directive
in `LoginReceiver.razor`.
Refactored `_dotNetRef` in `EnvelopeReceiver.razor` to use
`DotNetObjectReference<enveloperece>?` instead of
`DotNetObjectReference<EnvelopeReceiver>?` to reflect a change in the
referenced type.
Added a new `EnvelopeSender.razor` component with the route `/sender`.
Updated the route for `LoginSender.razor` from `/login` to `/sender/login`.
Modified navigation logic in `LoginSender.razor` to redirect to
`/sender` after a successful login instead of the root route.
The `_pdfLoaded` variable was initialized to `false` in the `EnvelopeReceiver.razor` file. Additionally, the type of `_dotNetRef` was changed from `DotNetObjectReference<EnvelopeViewer>?` to `DotNetObjectReference<EnvelopeReceiver>?` to reflect the correct object reference.
Updated documentation to reflect the transition to a unified Blazor WASM frontend for both Senders and Receivers. Removed references to PSPDFKit and legacy components, emphasizing the use of PDF.js and DevExpress.
Key changes include:
- Revised purpose and architecture sections.
- Updated solution structure to mark `EnvelopeGenerator.Web` as deprecated.
- Enhanced coordinate system explanation with conversion formulas.
- Documented new `EnvelopeViewer` features and signature workflows.
- Added details on signature caching and login flows for Senders and Receivers.
- Expanded "Mistakes History" to highlight lessons learned.
- Added quick reference for debugging and development consistency.
These changes improve clarity, maintainability, and alignment with the current system architecture.
Implemented a new `LoginSender.razor` component to provide a login page for "Sender" users. The page includes:
- A responsive card layout with a header, input fields for "Username" and "Password," and a submit button with a loading spinner.
- Error handling for invalid credentials and server errors, with appropriate alerts.
- A password visibility toggle for better user experience.
- Integration with `AuthService` for authentication and `NavigationManager` for redirection.
Added Blazor code-behind logic to manage state, handle login submission, and trigger login on "Enter" key press. The page is styled with a custom theme and includes a footer for support information.
Added a `SenderLoginResult` enum to represent outcomes of sender login attempts.
Implemented the `LoginSenderAsync` method in `AuthService` to authenticate sender users via the `/api/auth?cookie=true` endpoint.
The method handles HTTP response codes and returns appropriate `SenderLoginResult` values.
Included the `System.Net.Http.Json` namespace to support JSON-based HTTP requests.
Updated `AuthScheme` to introduce a distinct `Sender` scheme
and renamed the `Receiver` scheme for clarity. Updated
`Program.cs` to use the new `Sender` scheme in JWT
authentication and explicitly associate authentication
schemes with `Sender` and `Receiver` policies. Removed the
deprecated `AuthPolicy.ReceiverTFA` policy. These changes
improve the separation and maintainability of authentication
and authorization logic.
Replaced hardcoded per-envelope receiver JWT auth scheme string with a new `AuthScheme` static class containing a `Receiver` constant. Updated `Program.cs` to use `AuthScheme.Receiver` for authentication and policy configuration. Removed redundant comments and unused constants. Added necessary `using` directive for `AuthScheme`.
Reformatted the `AddAuthorizationBuilder()` method for improved readability and consistency. Updated `AuthPolicy.Receiver` to include an additional role, `"receiver"`, in the `RequireRole` method. No functional changes were made to other policies. These changes enhance code maintainability and introduce a minor adjustment to the `AuthPolicy.Receiver` policy.
Updated SaveSignatureBehavior.cs to improve functionality:
- Added new dependencies: AutoMapper, IRepository, and EF Core.
- Enhanced constructor to initialize new dependencies.
- Updated Handle method to validate signatures and handle errors.
- Introduced repository operations for querying and updating elements.
- Improved error handling with BadRequestException.
- Cleaned up redundant code and resolved namespace conflicts.
Added a new `ReceiverAppType` property to the `SigningCommand`
record, initialized to `ReceiverAppType.ReceiverUI`. Introduced
a `ReceiverAppType` enum with values `ReceiverUI` and `LegacyWeb`.
Updated `SignCommandHandler` to reflect these changes without
modifying its functionality.
Updated `using` directives to include `DigitalData.Core.Exceptions` for enhanced exception handling. Updated the `[Obsolete]` attribute message to reflect PSPDFKit library deprecation. Renamed `cancellationToken` to `cancel` for consistency.
Added validation to ensure `PsPdfKitAnnotation` is only supported for the `LegacyWeb` receiver type. Introduced stricter checks for missing or invalid annotation data, throwing `BadRequestException` when necessary. Updated `await next` calls to use the renamed parameter.
These changes improve code clarity, enforce stricter validation, and enhance error handling.
The `ElementId` property in the `Signature` record was renamed to `Id`. This change simplifies the property name, making it more concise and aligning with standard naming conventions or domain terminology.
Updated `MappingProfile` to map `Signature.DataUrl` to
`DocReceiverElement.Ink` using the new `MapDataUrlToRequiredBytes`
extension method. Added `MapDataUrlToRequiredBytes` to handle
base64-encoded data URLs, converting them to byte arrays.
Introduced a `using System;` directive in `AutoMapperAuditingExtensions.cs`
to support `DateTime`. Retained `MapChangedWhen` functionality while
extending mapping capabilities for handling base64 data URLs.
Replaced the `SignatureDto` record with a new `Signature` record to provide a more robust representation of signature data. Updated `MappingProfile` to map `Signature` to `DocReceiverElement` and removed the old `SignatureDto` mapping. Updated `SigningCommand` to use `IEnumerable<Signature>` instead of `IEnumerable<SignatureDto>`. Removed the old `MappingProfile` class and adjusted namespaces and `using` directives accordingly. These changes improve maintainability and streamline signature handling.
Updated the `@page` directives in `DocumentViewer.razor`,
`ReportDesigner.razor`, `ReportViewer.razor`, and `TestViewer.razor`
to prepend the `/example` prefix to their respective routes.
This change modifies the URL paths for accessing these components
to better organize or namespace the routes under the `/example`
prefix. No functional or structural changes were made to the
components themselves.
Introduced `ReadDocReceiverElementQuery` for retrieving document receiver elements and its corresponding handler. Added necessary `using` directives for dependencies like `AutoMapper`, `MediatR`, and `Microsoft.EntityFrameworkCore`.
The handler dynamically filters `DocReceiverElement` data based on optional query parameters (e.g., `Envelope.Id`, `Envelope.Uuid`, `Receiver.Id`, `Receiver.Signature`) using LINQ. Data is fetched asynchronously and mapped to DTOs using `AutoMapper`.
Introduced the `SaveSignatureBehavior` class as a pipeline behavior for handling `SigningCommand` requests. Added necessary `using` directives to include required namespaces. Resolved merge conflicts in `using` directives between `net8.0` and `net9.0` project versions. Implemented the `Handle` method to delegate request processing.
Added a new `SignatureDto` record to represent captured signatures with metadata, including properties like `ElementId`, `DataUrl`, `FullName`, `Position`, and `Place`. Updated `SigningCommand` to include a `Signatures` property for handling multiple signatures, deprecating `PsPdfKitAnnotation`.
Introduced a `MappingProfile` class to map `SignatureDto` to `DocReceiverElement` using AutoMapper. Added necessary `using` directives to support the new mapping configuration.
Updated the codebase to replace the `Signature` record with the new `DocReceiverElementCreateDto` record for better alignment with the domain model.
- Updated `EnvelopeReceiverController` to use `DocReceiverElements` instead of `Signatures` when iterating over `Receivers`.
- Replaced the `Signature` record with `DocReceiverElementCreateDto` in `CreateEnvelopeReceiverCommand`.
- Updated `ReceiverGetOrCreateCommand` to use a `DocReceiverElements` property instead of `Signatures`.
These changes ensure consistency and reflect a shift in how document-related data is represented.
Renamed `SignatureDto` to `DocReceiverElementDto` across the codebase to better reflect its purpose as a DTO for document receiver elements.
Updated all references, including:
- `SignatureController.cs`: Changed `doc.Elements` type to `IEnumerable<DocReceiverElementDto>`.
- `DocumentDto.cs`: Updated `Elements` property type.
- `MappingProfile.cs`: Adjusted mappings for the renamed DTO.
- `IDocumentReceiverElementService.cs` and `DocumentReceiverElementService.cs`: Updated interfaces and services to use the new DTO.
- `TestDocumentReceiverElementController.cs`: Updated generic type parameters.
These changes improve clarity, align naming with the domain model, and ensure consistency throughout the application.
Updated all references to `SignCommand` to use the new `SigningCommand` name for consistency and clarity. This includes changes to class definitions, method signatures, and pipeline behaviors in the following files:
- `DependencyInjection.cs`: Updated pipeline behaviors to use `SigningCommand`.
- `AnnotationBehavior.cs`: Updated class definition and methods to use `SigningCommand`. Marked `SignCommand` as `[Obsolete]`.
- `DocStatusBehavior.cs`, `EnvelopeReceiverResolutionBehavior.cs`, `HistoryBehavior.cs`, `SendSignedMailBehavior.cs`: Updated class definitions and methods to use `SigningCommand`.
- `SendSignedMailBehavior.cs`: Updated `CreatePlaceHolders` method to accept `SigningCommand`.
- `SigningCommand.cs`: Renamed `SignCommand` record to `SigningCommand` and updated internal methods and properties. Renamed `SignCommandHandler` to `SigningCommandHandler`.
Marked `SignCommand` as `[Obsolete]` where applicable to indicate deprecation. These changes improve code readability and align the command name with its purpose in the signing process.
Added EnvelopeReceiverResolutionBehavior as the first pipeline
behavior for SignCommand. Updated execution order of existing
behaviors: AnnotationBehavior (2nd), DocStatusBehavior (3rd),
and HistoryBehavior (4th). SendSignedMailBehavior remains last.
Updated comments to reflect the new execution order.
Introduced a new pipeline behavior class `EnvelopeReceiverResolutionBehavior` to resolve and validate the `EnvelopeReceiver` during the signing process.
- Added necessary `using` directives for dependencies such as `AutoMapper`, `MediatR`, and `IRepository`.
- Implemented the `Handle` method to query the database for `EnvelopeReceiver` if not provided in the `SignCommand` request.
- Throws a `NotFoundException` if the `EnvelopeReceiver` is not found.
- Maps the retrieved entity to a DTO and sets it in the request.
- Ensures the behavior executes before other signing process behaviors.
Refactored the `SignCommand` class to inherit from `EnvelopeReceiverQueryBase` and introduced a private backing field `_envelopeReceiver` for better encapsulation. Added an internal method `SetEnvelopeReceiver` to manage the envelope receiver data. Updated the `EnvelopeReceiver` property to use the backing field and removed the `required` modifier for more controlled initialization.
Clarified comments in `SignCommandHandler` to emphasize that all processing is handled by pipeline behaviors, leaving the handler intentionally empty. Made minor adjustments to comments for improved clarity and consistency.
Removed the `EmailAddress` property from the `SignCommand` class, which previously retrieved the receiver's email address and threw an exception if the receiver was null. This change eliminates reliance on `EnvelopeReceiver`.
Removed the `ToJson` extension method usage and the associated `using EnvelopeGenerator.Application.Common.Extensions;` directive, as well as the unused `using EnvelopeGenerator.Domain.Constants;` directive.
Marked the `PsPdfKitAnnotation` property as `[Obsolete]`, directing users to use `Signature.Commands.SignCommand` instead, signaling a transition to a newer implementation.
Updated the `EmailAddress` and `ReferenceString` properties
of the `EmailOut` object in `SendSignedMailBehavior` to use
`request.EnvelopeReceiver.Receiver!.EmailAddress` instead of
`request.EmailAddress`. This ensures the values are derived
from the `EnvelopeReceiver.Receiver` object for improved
accuracy and consistency.
Updated the `Handle` method in multiple classes implementing
`IPipelineBehavior<SignCommand, Unit>` to pass the `cancellationToken`
parameter to the `next()` method. This change ensures consistent
propagation of the `cancellationToken` through the pipeline, enabling
proper handling of cancellation requests during asynchronous operations.
Modified files:
- AnnotationBehavior.cs
- DocStatusBehavior.cs
- HistoryBehavior.cs
- SendSignedMailBehavior.cs
The `PsPdfKitAnnotation` property in the `SignCommand` class has been marked as `[Obsolete]` with a deprecation message suggesting the use of `Signature.Commands.SignCommand` instead.
The `TemplateType` property, which returned the `EmailTemplateType.DocumentSigned` value, has been removed from the `SignCommand` class.
Added an [Obsolete] attribute to the PsPdfKitAnnotation property
in the DocSignedNotification class, indicating that the PSPDFKit
library is deprecated.
Reorganized using directives in DocumentReceiverElementService.cs
to improve consistency and maintain code readability.
Updated namespaces from `Signature` to `Signatures` for consistency and clarity across the application. Simplified pipeline behavior registrations in `DependencyInjection.cs` by using shorter references. Added `Microsoft.Extensions.Configuration` to `DependencyInjection.cs` to support configuration functionality. Ensured all references to `SignCommand` and related behaviors align with the new namespace structure.
Added `[Obsolete]` attributes to classes, methods, and properties related to the deprecated PSPDFKit library and notifications.
- Marked `AnnotationHandler`, `DocStatusHandler`, `AnnotationBehavior`, and `DocStatusBehavior` as obsolete.
- Marked `Handle` methods in `DocStatusHandler` and `DocStatusBehavior` as obsolete.
- Marked `PsPdfKitAnnotation` property in `SignCommand` as obsolete.
- Marked `CreateOrUpdate` method in `AnnotationController` as obsolete.
- Added `Handle` methods in `DocStatusHandler` and `DocStatusBehavior` to send `CreateDocStatusCommand`.
- Updated `AnnotationController` dependencies to include `EnvelopeGenerator.Application.Common.Dto`.
These changes indicate a transition to `Signature.Commands.SignCommand` and deprecate PSPDFKit-related functionality.
Introduced four new pipeline behaviors (`AnnotationBehavior`,
`DocStatusBehavior`, `HistoryBehavior`, and `SendSignedMailBehavior`)
to modularize the signing process. These behaviors handle annotation
persistence, document status creation, history recording, and signed
mail notifications, respectively.
- `AnnotationBehavior`: Saves annotations using `IRepository`.
- `DocStatusBehavior`: Creates document status via `ISender`.
- `HistoryBehavior`: Records signing history and validates receiver
information.
- `SendSignedMailBehavior`: Sends signed mail notifications using
email templates and dynamic placeholder replacement.
Added error handling for missing data in `HistoryBehavior` and
`SendSignedMailBehavior`. Updated the signing pipeline to execute
these behaviors sequentially, ensuring a structured and extensible
workflow.
Introduced MediatR to the project by adding the `using MediatR;` directive in `DependencyInjection.cs`. Registered pipeline behaviors for the `Signature.Commands.SignCommand` to enforce a structured execution order:
1. AnnotationBehavior: Saves annotations.
2. DocStatusBehavior: Creates document status.
3. HistoryBehavior: Records history.
4. SendSignedMailBehavior: Sends notification email (executes last).
These changes improve the command handling pipeline by ensuring sequential and reliable execution of behaviors.
Added `using` directives for namespaces related to DTOs,
envelope receivers, and document signing notifications.
These changes enable the use of new functionality or
tests for document signing notifications.
Added `using` directives for additional namespaces to support
application DTOs, extensions, services, notifications, and
envelope receiver queries. These changes introduce new
functionality and dependencies to the `AnnotationController`
class.
Marked `DocSignedNotification` as `[Obsolete]` with a note to use `Signature.Commands.SignCommand` instead. Removed the `PsPdfKitAnnotation` record and its associated `using` directives from `DocSignedNotification.cs`.
Added missing `using EnvelopeGenerator.Application.Common.Dto;` to `AnnotationHandler.cs` and `DocStatusHandler.cs` to ensure proper DTO support.
Introduce `SignCommand` and `SignCommandHandler` in the `EnvelopeGenerator.Application.Signature.Commands` namespace.
- `SignCommand` is a CQRS command that encapsulates the envelope receiver's information (`EnvelopeReceiverDto`) and optional PSPDFKit annotation data.
- Added computed properties for email template type (`TemplateType`) and receiver's email address (`EmailAddress`), with validation for null receivers.
- `SignCommandHandler` implements the `IRequestHandler<SignCommand>` interface, with a placeholder `Handle` method delegating processing to pipeline behaviors.
- Added necessary `using` directives for MediatR, DTOs, extensions, and constants.
Introduced a new `PsPdfKitAnnotation` record in the namespace
`EnvelopeGenerator.Application.Common.Dto` to represent PSPDFKit
annotation data. The record includes two parameters: `Instant`
of type `ExpandoObject` and `Structured` of type
`IEnumerable<AnnotationCreateDto>`.
Marked the record with the `[Obsolete]` attribute to indicate
that the PSPDFKit library is deprecated. Added a summary XML
comment to describe the purpose of the record. Also added a
`using` directive for `System.Dynamic` to support `ExpandoObject`.
Renamed the method `GetAnnotsOfReceiver` to `Get` in the
`SignatureController` class. This change simplifies the method
name, making it more generic and potentially aligning with
naming conventions or broader use cases.
Added the `System.ComponentModel.DataAnnotations.Schema` namespace.
Introduced new properties to the `SignatureDto` class:
- `FullName` (string?) for the full name of the signature entity.
- `Position` (string?) for the position of the signature entity.
- `Place` (string?) for the place associated with the signature entity.
- `Ink` (byte[]?) for the ink data of the signature entity.
Replaced non-English comments with English equivalents across
`EnvelopeViewer.razor` and `pdf-viewer.js` to improve code
readability and maintainability. Updated comments to clarify
the purpose of variables, methods, and DOM manipulation logic
without altering functionality. These changes ensure the
codebase is more accessible to a broader audience.