Commit Graph

96 Commits

Author SHA1 Message Date
2f1777af4a Add routes for receiver-ui and register SignatureService
Expanded `yarp.json` with new routes for the `receiver-ui` cluster to handle paths for `appsettings.json`, `appsettings.Development.json`, styles, fonts, and images. These routes specify HTTP methods and execution order.

Registered `SignatureService` as a scoped dependency in `Program.cs` to support new functionality related to handling signatures.
2026-06-06 19:27:44 +02:00
11a5012ab7 Refactor: Move GetAnnotsOfReceiver to SignatureController
The `GetAnnotsOfReceiver` method was removed from the `AnnotationController` class and moved to a newly introduced `SignatureController` class. The `SignatureController` is now a dedicated controller for handling signature-related endpoints, decorated with `[ApiController]` and `[Route("api/[controller]")]`.

The method's implementation remains largely unchanged, retaining its logic for retrieving and filtering signatures for a specific receiver. Dependency injection for `IMediator` was added to the `SignatureController` to handle the `ReadDocumentQuery`.

Additional `using` directives were added to `SignatureController.cs` to include necessary namespaces. A `TODO` comment remains in the method, indicating potential future updates.
2026-06-06 18:31:04 +02:00
76ce8a44b3 Add GetAnnotsOfReceiver method to AnnotationController
Introduced the `GetAnnotsOfReceiver` method in `AnnotationController` to handle HTTP GET requests for retrieving receiver-specific annotations. The method enforces authorization using the `Receiver` policy, fetches the document via a mediator query, and filters signatures based on the current receiver. Returns appropriate HTTP responses for empty documents or missing signatures.

Added new `using` directives for required dependencies and reorganized imports for better readability. Included a `TODO` comment for potential future updates.
2026-06-06 18:07:03 +02:00
e52972ee9b Add ReceiverId claim handling to ReceiverClaimExtensions
Updated ReceiverClaimExtensions to include a new array,
`ReceiverIdClaimTypes`, for receiver ID claim types. Added
`GetReceiverIdOfReceiver` method to retrieve and validate
receiver ID claims. Modified the exception message in
`GetEnvelopeIdOfReceiver` to use a string literal for
clarity.
2026-06-06 18:06:20 +02:00
17ee715b46 Expand and restructure ReverseProxy routes
Added new routes to the `ReverseProxy` configuration, including
`receiver-ui-login`, `receiver-ui-sender`, `receiver-ui-envelope`,
and others to handle specific paths, HTTP methods, and transformations.

Removed outdated routes such as `receiver-ui-static-assets` and
`receiver-ui-annotation-fake` to streamline the configuration.

Introduced transformations for response headers (e.g., `Cache-Control`)
and updated `auth-login` and `auth-envelope-receiver-login` routes
with new path patterns and query parameters.

Reorganized `receiver-ui` cluster routes to better handle static
assets (CSS, JS, Blazor framework, and content) and fake data.
2026-06-06 18:05:53 +02:00
634043ebd9 Reformat Transforms in yarp.json for readability
Reformatted the `Transforms` sections in `yarp.json` to use
multi-line JSON objects instead of single-line objects.
This change improves the readability and maintainability
of the configuration file without altering its functionality.
2026-06-05 10:26:29 +02:00
1bf1c37296 Update receiver-ui-envelope route and add transforms
The `Path` matching rule for the `receiver-ui-envelope` route was updated to use `/envelope/{EnvelopeKey}` instead of the wildcard `/envelope/{**catch-all}` for more specific routing.

Additionally, a `Transforms` section was added to the route, which includes a transformation to set the path to `/index.html`.
2026-06-03 10:32:03 +02:00
ea6f3e61be Add GetDocumentOfReceiver method to DocumentController
The `GetDocumentOfReceiver` method was introduced to handle
retrieving a document for a specified envelope key. It is
secured with the `[Authorize(Policy = AuthPolicy.Receiver)]`
attribute and responds to HTTP GET requests with a route
parameter `envelopeKey`.

The previous logic for extracting and validating the
`envelopeId` from user claims was removed. This was replaced
with a call to `User.GetEnvelopeIdOfReceiver()` for improved
clarity and maintainability.

The method uses the `mediator` to send a `ReadDocumentQuery`
and returns a `NotFound` response if the document's `ByteData`
is empty.
2026-06-03 10:31:29 +02:00
0c446bba56 Enhance claim handling in ReceiverClaimExtensions
Refactor `ReceiverClaimExtensions` to support multiple claim
type variations by introducing arrays for envelope ID, UUID,
and receiver signature claim types. Updated the
`GetRequiredClaimOfReceiver` method to handle multiple claim
types and provide detailed error messages when claims are
missing. Refactored methods to use the new claim type arrays
for improved flexibility and robustness.
2026-06-03 10:31:14 +02:00
8d9dbbea19 Update receiver-ui cluster address in yarp.json
Replaced the `primary` destination address in the `receiver-ui`
cluster from `http://172.24.12.39:1234` to `https://localhost:52936`.
This change likely supports local development or testing by
switching to `localhost` with HTTPS and a different port.
2026-06-01 16:04:05 +02:00
6d254281f8 Update ReverseProxy config and adjust destination address
Added a new `ReverseProxy` section in `appsettings.Development.json` to define the `receiver-ui` cluster with a destination pointing to `https://localhost:52936`. Reformatted the `Logging` configuration without changing its values.

Updated the `yarp.json` file to modify the `receiver-ui` cluster's destination address from `https://localhost:52936` to `http://172.24.12.39:1234` to reflect the new backend service location.
2026-06-01 10:43:04 +02:00
5dc32a02a9 Update version to 1.3.1 and simplify YARP proxy logic
Updated the project version in `EnvelopeGenerator.API.csproj`
from `1.3.0` to `1.3.1`, including `<Version>`, `<FileVersion>`,
and `<AssemblyVersion>` properties, indicating a minor update.

Simplified the YARP proxy mapping in `Program.cs` by replacing
the conditional `app.MapWhen` logic with a direct call to
`app.MapReverseProxy()`, allowing all requests to be forwarded
through the reverse proxy without path filtering.
2026-06-01 10:39:44 +02:00
bca0b09cf4 Add IIS publish profile for .NET 8.0 deployment
A new publish profile `IISProfileNet8.pubxml` was added to configure deployment settings for a .NET project targeting the `net8.0` framework. Key settings include:

- `WebPublishMethod` set to `Package` for deployment packaging.
- `LastUsedBuildConfiguration` set to `Release`.
- `DesktopBuildPackageLocation` specifies the output path with a version placeholder.
- `PackageAsSingleFile` set to `true` for single-file packaging.
- `DeployIisAppPath` set to `EnvelopeGenerator` for IIS deployment.
- `TargetFramework` specified as `net8.0`.

This profile streamlines the deployment process and ensures compatibility with .NET 8.0.
2026-06-01 10:02:29 +02:00
a6ddc72df3 Update project version to 1.3.0
Updated `Version`, `FileVersion`, and `AssemblyVersion` in the `EnvelopeGenerator.API.csproj` file from `1.2.3` to `1.3.0`, indicating a minor version update with backward-compatible improvements or new features.
2026-06-01 05:00:35 +02:00
360a762fb9 Refactor return value in EnvelopeReceiverController
Modified the method to return a single item or null by using
`SingleOrDefault()` on the result of `await _mediator.Send(...)`.
This ensures the response is no longer a collection but a single
object, improving clarity and aligning with expected behavior.
2026-06-01 03:53:01 +02:00
a668dfa3eb Refactor envelope ID retrieval and error handling
Replaced hardcoded `envelopeId` with dynamic retrieval from
user claims. Reintroduced and updated error handling logic
to validate the `envelopeId` and log detailed errors when
parsing fails. Improved robustness by returning a 500 error
for invalid or missing envelope claims.
2026-05-31 16:15:00 +02:00
21c6b65318 Add no-cache headers to receiver-ui responses
Introduce a `Transforms` section in `yarp.json` for the `receiver-ui` route to enforce a no-cache policy. This includes setting the following response headers for all responses:
- `Cache-Control`: `no-cache, no-store, must-revalidate`
- `Pragma`: `no-cache`
- `Expires`: `0`

These changes ensure that client-side caching is disabled for the `receiver-ui` route.
2026-05-31 13:51:40 +02:00
5964ebc088 Add receiver-ui-annotation-fake route to yarp.json
Added a new route configuration `receiver-ui-annotation-fake` to the `yarp.json` file. This route is associated with the `receiver-ui` cluster, has an `Order` value of `10`, and matches requests to `/api/Annotation/{envelopeKey}` with `GET` and `HEAD` methods. A path transformation rewrites the route to `/fake-data/annotations.json`.
2026-05-31 11:11:58 +02:00
1c7ca765cb Add login route and enhance login page functionality
Added a new `/login/{**catch-all}` route in `yarp.json` for the `receiver-ui` cluster. Updated `Login.razor` with a modernized UI, including a gradient header, improved error handling, and a toggle for password visibility. Integrated `AuthService` for API-based login validation.

Refactored `Login.razor` logic to handle login outcomes (`Success`, `InvalidCode`, `NotFound`, `Error`) using the new `EnvelopeLoginResult` enum. Added `LoginEnvelopeReceiverAsync` method in `AuthService` to handle login requests via `POST /api/Auth/envelope-receiver/{key}`. Improved code maintainability and user experience.
2026-05-31 09:23:07 +02:00
b708343db0 Merge branch 'master' of http://git.dd:3000/AppStd/EnvelopeGenerator 2026-05-31 05:52:44 +02:00
b416823f38 configure for test case 2026-05-31 05:52:42 +02:00
0b73a90b15 Downgrade to net8.0 and update dependencies
The `<TargetFrameworks>` property in `EnvelopeGenerator.API.csproj` was downgraded from `net9.0` to `net8.0`. Conditional package references were added for `Microsoft.AspNetCore.OpenApi` and `Microsoft.EntityFrameworkCore.SqlServer` to support both `net8.0` and `net9.0`.

Added `itext` and `itext.bouncy-castle-adapter` (version 8.0.5) as new dependencies. Updated the project to include a reference to `EnvelopeGenerator.PdfEditor.csproj`. Removed unconditional `Microsoft.AspNetCore.OpenApi` reference and replaced it with conditional references based on the target framework.
2026-05-30 16:47:32 +02:00
76cfe4dc46 Add conditional MapOpenApi for .NET 9.0 or newer
Introduced a preprocessor directive `#if NET9_0_OR_GREATER` to conditionally include the `app.MapOpenApi();` method call. This ensures that the `MapOpenApi` functionality is only executed when the application targets .NET 9.0 or later, maintaining compatibility with earlier .NET versions.
2026-05-30 16:46:27 +02:00
c1a10cc0fa Add OpenAPI service for .NET 9.0 or newer
Introduced a conditional compilation directive (`#if NET9_0_OR_GREATER`) to register the `AddOpenApi` service only when the application is targeting .NET 9.0 or later. This ensures compatibility and avoids unnecessary service registration for earlier .NET versions.
2026-05-30 16:45:48 +02:00
b6b5ca52f2 Update yarp.json with granular routing rules
Renamed the route "receiver-ui" to "receiver-ui-receiver" and added new routes for more specific path handling:
- "receiver-ui-receiver" for `/receiver/{**catch-all}`.
- "receiver-ui-sender" for `/sender/{**catch-all}`.
- "receiver-ui-envelope" for `/envelope/{**catch-all}`.
- "receiver-ui-static-assets" for `{**catch-all}` as a fallback.

These changes improve routing granularity for the "receiver-ui" cluster.
2026-05-30 16:45:17 +02:00
5279731281 Refactor: Replace Authorize with WithAuth in CreateAsync
Updated the `CreateAsync` method in `EnvelopeController` to use
`WithAuth` instead of `Authorize` for handling authorization
within the `CreateEnvelopeCommand`. This change reflects a
refactor or update in the command's API to improve clarity or
functionality.
2026-05-30 16:42:59 +02:00
27ed3689f2 Adjust YARP proxy to exclude specific API paths
Updated the middleware pipeline in `Program.cs` to use `app.MapWhen()` for conditional routing. The reverse proxy now excludes requests to `/swagger`, `/scalar`, and `/openapi` paths, ensuring these endpoints are handled separately. This change replaces the direct `app.MapReverseProxy()` call with a more selective approach, improving request handling for specific API paths.
2026-05-29 18:44:10 +02:00
d4f23e0e82 Merge branch 'master' of http://git.dd:3000/AppStd/EnvelopeGenerator 2026-05-29 14:27:05 +02:00
618f899440 Add receiver-ui route and cluster to YARP configuration
Added a new `receiver-ui` route under the `ReverseProxy:Routes`
section in `yarp.json` to match all paths for `GET` and `HEAD`
methods. The route is associated with the `receiver-ui` cluster
and has an `Order` value of 100.

Configured a new `receiver-ui` cluster under the
`ReverseProxy:Clusters` section with a single destination
pointing to `https://localhost:52936`. This enables reverse
proxying for the `receiver-ui` service.
2026-05-29 14:26:53 +02:00
28df3f4ec1 Refactor document handling and improve file response
Refactored the handling of `senderDoc.ByteData` by replacing
the ternary operator with an explicit `if` statement for better
readability. Added a `Content-Disposition` header to ensure
the file is displayed inline with a proper filename. Updated
the MIME type of the file response from `application/octet-stream`
to `application/pdf` to reflect the expected content type.
2026-05-29 14:09:31 +02:00
b6e63841cd Disable automatic database migrations in appsettings.json
The `UseDbMigration` setting in the `appsettings.json` file was updated from `true` to `false`. This change disables automatic application of database migrations, potentially requiring manual intervention or an alternative approach for managing schema updates.
2026-05-29 13:47:11 +02:00
f051896296 Add API endpoint to retrieve envelope receiver by key
Added a new `GetEnvelopeReceiverOfReceiver` method in the
`EnvelopeReceiverController` to retrieve an envelope receiver
based on the provided `envelopeKey`. The method is secured
with the `Receiver` authorization policy and uses the
`_mediator.Send` method to process a `ReadEnvelopeReceiverQuery`.

Included the `Microsoft.Extensions.Options` namespace to
support potential configuration needs. Added XML documentation
placeholders for the new method.
2026-05-29 13:46:06 +02:00
92b93e862e Add GetDocumentOfReceiver endpoint and logging support
Updated DocumentController to include a new GetDocumentOfReceiver
endpoint for retrieving envelope documents. Added authorization
based on the Receiver policy and implemented error handling for
invalid or missing EnvelopeId claims. Integrated ILogger to log
errors and provide detailed diagnostics. Included necessary
namespace imports to support the new functionality.
2026-05-29 13:37:51 +02:00
8876f5c286 Add token validation for envelope key in request path
Enhanced token validation logic by introducing an `OnTokenValidated` event handler. This ensures the `envelopeKey` in the request path matches the token's subject (`sub` claim). Added `return Task.CompletedTask;` to complete asynchronous operations. These changes improve security by preventing mismatches or unauthorized access.
2026-05-29 13:10:42 +02:00
e93c7e8bc1 Add envelope-receiver login endpoint support
Added `AddEnvelopeReceiverLoginOperation` to `AuthProxyDocumentFilter` to define a new Swagger operation for the `/api/Auth/envelope-receiver/{key}` endpoint. Introduced the `EnvelopeReceiverLogin` record for the request body. Updated `yarp.json` to configure routing for the new endpoint, ensuring the `cookie` query parameter is always set to `true`. Modified `Apply` to include the new operation in Swagger documentation.
2026-05-29 12:44:51 +02:00
16493b4594 Add endpoints for envelope receiver logout functionality
Added two new endpoints to `AuthController`: `LogoutEnvelopeReceiver` for removing a specific per-envelope receiver cookie and `LogoutAllEnvelopeReceivers` for clearing all such cookies. Updated `DigitalData.Auth.Claims` package to version 1.0.3. Introduced new `using` directives to support the added functionality. Included XML documentation for the new endpoints to improve code clarity.
2026-05-29 12:44:26 +02:00
938504b2d1 Add per-envelope JWT authentication and validation
Introduced a new `EnvelopeReceiverJwt` authentication scheme to support per-envelope JWT validation using cookies specific to envelope keys. Added the `CheckEnvelopeReceiver` endpoint in `AuthController.cs` to validate these tokens, protected by the `AuthPolicy.Receiver` policy.

Configured the `EnvelopeReceiverJwt` scheme to dynamically resolve issuer signing keys and validate tokens. Enhanced `JwtBearerEvents.OnMessageReceived` to extract envelope keys from the request path and retrieve tokens from corresponding cookies.

Updated the `AuthPolicy.Receiver` policy to use the `EnvelopeReceiverJwt` scheme, ensuring isolated authentication for per-envelope scenarios. Added XML documentation for the `CheckEnvelopeReceiver` method.
2026-05-29 11:47:12 +02:00
3eb718f6ac Add CheckReceiver endpoint to AuthController
Introduce a new `CheckReceiver` action method in `AuthController`.
This method is protected by the `Receiver` authorization policy
and handles GET requests to the `check-receiver/{envelopeKey}` route.
It accepts an `envelopeKey` parameter from the route and currently
returns an HTTP 200 OK response.
2026-05-29 10:23:34 +02:00
99781aeb8a Enhance authentication and database configuration
- Added `using DigitalData.Auth.Claims` to support claims handling.
- Improved EF Core DbContext comment for better clarity.
- Added logic to dynamically select connection strings based on
  `MIGRATION_TEST_MODE` or `UseDbMigration` configuration.
- Updated `AuthPolicy.Receiver` to include the `"receiver"` role.
2026-05-29 10:02:25 +02:00
ffcd41f4dc Add DigitalData.Auth.Claims package dependency
Added a reference to the `DigitalData.Auth.Claims` package (version 1.0.1) in the `EnvelopeGenerator.API.csproj` file. This introduces functionality related to handling authentication claims in the project.
2026-05-29 10:02:11 +02:00
f5b0f25d96 Add ImageSharp dependency to all major projects
Added SixLabors.ImageSharp (v3.1.12) as a dependency to API, Application, Infrastructure, Jobs, Tests, Web, and WorkerService projects to enable advanced image processing capabilities across the solution. This prepares the codebase for features involving image manipulation or generation.
2026-02-17 13:51:07 +01:00
07f951ba98 Update Microsoft.Identity.Client to 4.82.1 across solution
Upgraded Microsoft.Identity.Client to version 4.82.1 in all projects, updated related assembly references and binding redirects, and ensured packages.config reflects the new version. Also updated Microsoft.IdentityModel.Abstractions to 8.14.0 and added System.Formats.Asn1 where required. These changes improve consistency and compatibility for authentication dependencies.
2026-02-17 11:54:47 +01:00
3336af0541 Update HtmlSanitizer to v9.0.892 across all projects
Upgraded HtmlSanitizer from 8.0.865 to 9.0.892 in all existing project references. Added HtmlSanitizer 9.0.892 as a new dependency to API, Infrastructure, Jobs, Tests, and WorkerService projects to ensure consistent and up-to-date usage throughout the solution.
2026-02-17 11:51:31 +01:00
9f59a17f63 Mark CreateAsync as obsolete; update Flag reference
Marked CreateAsync in ReadOnlyController as [Obsolete] to encourage use of MediatR. Simplified Flag.DataIntegrityIssue reference in EnvelopeMailService error handling.
2026-02-11 13:14:07 +01:00
06884fe809 Refactor Get method in EmailTemplateController
Simplified the Get method to always require a ReadEmailTemplateQuery and CancellationToken, delegating all queries to the mediator. Removed conditional logic for handling null or missing parameters. Updated XML documentation to reflect the new method signature.
2026-02-11 11:58:50 +01:00
03e3e0eaf4 Add IHasChangedWhen support and cleanup using statements
Introduced IHasChangedWhen interface to EnvelopeReceiver and History.
Added HasEmailAndName property to EnvelopeReceiver.
Updated AutoMapperAuditingExtensions to map ChangedWhen to UTC.
Removed redundant using statements and fixed formatting.
2026-02-11 10:31:22 +01:00
c8ca1ef22a Refactor EmailTemplate Update method signature and logic
Simplified XML docs and removed sample requests. Changed Update method to require UpdateEmailTemplateCommand and CancellationToken, eliminating optional query parameter. Streamlined logic to send update command directly, removing previous conditional handling for null values and template resets.
2026-02-11 10:24:54 +01:00
de36e29743 Update ReadEmailTemplateQuery to non-nullable return type
Refactored ReadEmailTemplateQuery and handler to use non-nullable EmailTemplateDto, throwing NotFoundException when no template is found. Updated namespaces and using statements for consistency. Added detailed XML docs for query properties. Controller updated to reference new query namespace.
2026-02-09 10:49:05 +01:00
ff094ebfe1 Refactor email template query to use interface
Replaced EmailTemplateQueryBase record with IEmailTemplateQuery interface for email template queries. Updated all relevant commands, queries, and controller methods to use the new interface. Removed EmailTemplateQueryBase and migrated properties to implementing classes. Improved documentation to clarify query structure and Type property usage.
2026-02-09 09:46:46 +01:00
1c948fcbf8 Simplify command imports in EmailTemplateController
Replaced specific Update command import with general Commands namespace import to streamline access to all command classes. No functional changes made.
2026-02-09 09:42:14 +01:00