Commit Graph

2296 Commits

Author SHA1 Message Date
de8d363c27 Add authentication for secure document access
Introduced a new login page (`Login.razor`) to handle user authentication via access codes. Implemented `AuthService` to validate access codes through an API. Updated `ReportViewer.razor` to check user access and redirect unauthorized users to the login page. Modified `Program.cs` to register `AuthService` for dependency injection. Enhanced document fetching in `ReportViewer.razor` to ensure secure access control.
2026-05-31 09:01:02 +02:00
390f2d2cae Replace DxPdfViewer with DxReportViewer for PDF handling
Replaced `DxPdfViewer` with `DxReportViewer` to unify handling of
both PDF and report rendering. Removed conditional logic for
`PdfBytes` and directly initialized `XtraReport` with PDF content
using `XRPdfContent`. Simplified `OnInitializedAsync` to fetch
PDF content, create a report, and store it in `ReportStorage`.
Removed unused fields (`PdfViewerUrl`, `PdfBytes`, and
`SignedPdfBytes`) and redundant code related to PDF handling.
2026-05-31 08:14:07 +02:00
697f85f805 Refactor signature handling and PDF export logic
Refactored the signature handling process by introducing a new
`Report` instance creation step in the `SignatureApplied` block
to streamline signed report generation. Added a validation check
in `ExportSignedPdfAsync` to ensure the `Report` object is not
null before proceeding with export. Removed redundant code for
manual signed report creation and simplified the export logic
by directly invoking `reportViewer!.ExportToAsync`. Incremented
`ViewerKey` to refresh the report viewer after signing.
2026-05-31 08:01:10 +02:00
d97172b9cf Add condition to bypass document fetching logic
Updated the `OnInitializedAsync` method in `ReportViewer.razor`
to include a check for `AppOptions.Value.ForceToUseFakeDocument`.
This ensures that the application can bypass fetching the
actual document when the configuration option is enabled.
2026-05-31 07:46:51 +02:00
72cbccab8c Add ForceToUseFakeDocument option for document loading
Introduced a new `ForceToUseFakeDocument` property in `ApiOptions` to control whether the application uses a fake document for testing or bypasses certain conditions for document loading. Updated `ReportViewer.razor` to respect this configuration, including changes to conditional rendering logic and dependency injection for `IOptions<ApiOptions>`.

Removed test code that forced `EnvelopeKey` to `null` during initialization. Updated `appsettings.json` to include the new `ForceToUseFakeDocument` property with a default value of `true`. Added necessary `using` directives and dependencies for the updated functionality.
2026-05-31 07:30:23 +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
5bdc552492 Add DocumentService for fetching PDF documents
Introduced a new `DocumentService` class to handle fetching
PDF document bytes from an API endpoint. The service uses
`HttpClient` for HTTP communication and `IOptions<ApiOptions>`
for accessing API configuration. Added the `GetDocumentAsync`
method to perform the HTTP GET request, handle responses, and
return the document bytes along with the HTTP status code.
Included necessary `using` directives and encapsulated the
service in the `EnvelopeGenerator.ReceiverUI.Services` namespace.
2026-05-30 17:03:25 +02:00
cdf34a262b Add ApiOptions and configure API settings
Added a new `ApiOptions` class to encapsulate API configuration,
including the `BaseUrl` property and `SectionName` constant.
Registered `ApiOptions` in the dependency injection container
in `Program.cs` and bound it to the "Api" section in the
configuration file. Updated `appsettings.json` to include the
"Api" section with a `BaseUrl` value of "https://localhost:8088".
2026-05-30 17:02:57 +02:00
4c84b28034 Add DevExpress reporting and PDF viewer services
Integrated DevExpress WebAssembly Blazor Report Viewer and PDF Viewer to enable report and PDF rendering in the application.

Registered `EnvelopeGenerator.ReceiverUI.Services.DocumentService` for document handling. Configured `DevExpress Blazor Reporting WebAssembly` in development mode.

Added a custom implementation of `IDataSourceWizardJsonConnectionStorage` to manage JSON data connections in the data source wizard.
2026-05-30 16:51:42 +02:00
b70f902190 Update DevExpress packages and add PdfViewer support
Upgraded DevExpress package references in `EnvelopeGenerator.ReceiverUI.csproj` from version 25.2.3 to 25.2.7, including:
- `DevExpress.Drawing.Skia`
- `DevExpress.Blazor.Reporting.JSBasedControls`
- `DevExpress.Blazor.Reporting.Viewer`

Added a new package reference for `DevExpress.Blazor.PdfViewer` (version 25.2.7) to enable PDF viewing functionality.

Updated `_Imports.razor` to include `@using DevExpress.Blazor.PdfViewer` for PdfViewer component support.
2026-05-30 16:51:11 +02:00
094c87eb88 Refactor CreateEnvelopeCommand and remove ConstantsTests
Refactored the `CreateEnvelopeCommand` method in `Fake.cs` to delegate user authentication logic to the `WithAuth` method. Added a new `CreateEnvelopeCommands` method to generate multiple commands for a set of user IDs.

Removed `ConstantsTests.cs`, which contained tests for the `Normalize` method of the `EnvelopeSigningType` enumeration, as the method or its tests are no longer relevant.
2026-05-30 16:50:21 +02:00
9b2539e378 Refactor CreateEnvelopeCommand authorization method
Replaced the `Authorize` method with a new `WithAuth` method
in the `CreateEnvelopeCommand` class. The new method sets
the `UserId` property and returns the current instance,
enabling method chaining and improving usability.
2026-05-30 16:47:51 +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
2eb258d236 Merge branch 'master' of http://git.dd:3000/AppStd/EnvelopeGenerator 2026-05-29 14:09:37 +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
3e37dc1eff Merge branch 'master' of http://git.dd:3000/AppStd/EnvelopeGenerator 2026-05-29 14:07:19 +02:00
5fd8637913 Add DependencyInjection and ReceiverUI projects
Added the `EnvelopeGenerator.DependencyInjection` project to the solution, including its build configurations for Debug and Release modes.

Also added build configurations for the existing `EnvelopeGenerator.ReceiverUI` project.

Both projects were associated with the parent project in the NestedProjects section.
2026-05-29 14:07:14 +02:00
31db160fba Add signature panel and layout updates for ReportViewer
Enhanced `ReportViewer.razor` with a new layout structure:
- Added `receiver-page-layout` with `receiver-signature-panel` and `receiver-viewer-wrapper` for better organization.
- Introduced a button to export signed PDFs, conditionally enabled based on `SignatureApplied`.
- Added a `DxPopup` for capturing signatures with a "Close" button.

Updated `MainLayout.razor` to remove unnecessary padding from `<article>`.

Refined `app.css`:
- Defined styles for `receiver-page-layout`, `receiver-signature-panel`, and `receiver-viewer-wrapper` to improve layout flexibility.
- Adjusted `article` to use flexbox and ensure hidden overflow.
2026-05-29 14:06:59 +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
a7ed9be1de Update version and improve build process for packaging
Updated project version to 1.2.0.3 in `EnvelopeGenerator.DependencyInjection.csproj`.
Replaced line endings in `_DepDlls` for consistency. Added a new
`RebuildDependenciesBeforePack` target to ensure all dependencies
are rebuilt for `net7.0`, `net8.0`, and `net9.0` before packaging.
Improved formatting in `BundleReferencedDlls` for better readability.
2026-05-29 08:45:56 +02:00
32fbf782fa Update project version to 1.2.0
Bump the project version from 1.1.1 to 1.2.0 in the `EnvelopeGenerator.DependencyInjection.csproj` file. Updated the `<Version>`, `<AssemblyVersion>`, and `<FileVersion>` properties to reflect the new version.
2026-05-28 23:47:02 +02:00
bfae72529c Add query for sensitive envelope receiver data
Introduced `ReadEnvelopeReceiverSecretQuery` to fetch sensitive
fields (e.g., access code, phone number) for envelope receivers.
Added extension methods for dispatching the query via `IMediator`
and implemented `ReadEnvelopeReceiverSecretQueryHandler` to
process the query using repositories and AutoMapper.

Updated `EnvelopeController` with a new HTTP GET endpoint
`EnvelopeReceiverWithSecretByMediatr` to expose the query
functionality. This endpoint returns sensitive data as
`EnvelopeReceiverSecretDto` or a 404 response if no match is found.

These changes improve modularity, testability, and separation of
concerns by leveraging MediatR and CQRS patterns.
2026-05-28 23:46:31 +02:00
33c52bcef8 Add signature panel and layout updates for ReportViewer
Enhanced `ReportViewer.razor` with a new layout structure:
- Added `receiver-page-layout` with `receiver-signature-panel` and `receiver-viewer-wrapper` for better organization.
- Introduced a button to export signed PDFs, conditionally enabled based on `SignatureApplied`.
- Added a `DxPopup` for capturing signatures with a "Close" button.

Updated `MainLayout.razor` to remove unnecessary padding from `<article>`.

Refined `app.css`:
- Defined styles for `receiver-page-layout`, `receiver-signature-panel`, and `receiver-viewer-wrapper` to improve layout flexibility.
- Adjusted `article` to use flexbox and ensure hidden overflow.
2026-05-28 23:37:20 +02:00
40c5e1d044 Update navigation and remove sidebar in MainLayout
Updated the `OnAfterRenderAsync` method in `Index.razor` to navigate to `/receiver` instead of `/reportviewer`. Removed the sidebar containing the `<NavMenu />` component in `MainLayout.razor` and adjusted the `<main>` tag to directly contain the content.
2026-05-28 23:36:22 +02:00
67e6f288eb Bump version to 1.1.1
Updated project version from 1.1.0 to 1.1.1 in `EnvelopeGenerator.DependencyInjection.csproj`. This includes changes to `<Version>`, `<AssemblyVersion>`, and `<FileVersion>` properties. The update reflects minor improvements or bug fixes while maintaining backward compatibility.
2026-05-28 22:52:40 +02:00
823bafeeb9 Refactor project dependencies and add TFM-specific packages
Restructured `EnvelopeGenerator.DependencyInjection.csproj` to:
- Add multiple `PackageReference` entries for application services, ORM/Database, security/identity, utilities, and DI abstractions.
- Introduce conditional `ItemGroup` sections for `net7.0`, `net8.0`, and `net9.0` with framework-specific package versions.
- Move `UserManager` package reference to align with the updated dependency structure.
- Update comments for clarity, including replacing a Turkish comment with an English one.
- Add a comment explaining the rationale for centralizing `PackageReference` declarations to ensure correct `.nuspec` generation and simplify consumption.
2026-05-28 22:50:45 +02:00
750b9f1b57 Bump project version to 1.1.0
Updated the project version from 1.0.1 to 1.1.0 in the `EnvelopeGenerator.DependencyInjection.csproj` file. This includes changes to the `<Version>`, `<AssemblyVersion>`, and `<FileVersion>` properties, reflecting the addition of new features or improvements.
2026-05-28 21:57:19 +02:00
0a4daccc0f Refactor service registration for modularity
Introduced `EnvelopeGeneratorOptions` and `SqlCacheOptions` to enable fine-grained control over optional service registrations in `AddEnvelopeGenerator`. Updated `AddEnvelopeGenerator` to conditionally register services like `HttpContextAccessor`, `DistributedSqlServerCache`, `Dispatcher`, `MemoryCache`, and `UserManager` based on these options.

Updated `DependencyInjection.csproj` to include necessary framework references and package dependencies. Simplified `Program.cs` by consolidating service registrations into `AddEnvelopeGenerator`, reducing boilerplate and improving maintainability.

Improved extensibility by centralizing service registration logic, allowing consuming projects to customize configurations without modifying the core library. Updated documentation and removed unused directives.
2026-05-28 21:57:03 +02:00
bc4905d2f4 Refactor DI setup and simplify service registration
Centralized dependency injection setup by adding a reference to
`EnvelopeGenerator.DependencyInjection` in the project file and
replacing multiple `using` directives with a single one.

Replaced obsolete `AddEnvelopeGeneratorInfrastructureServices`
and `AddEnvelopeGeneratorServices` methods with the new
`AddEnvelopeGenerator` method, consolidating service and
infrastructure setup.

Encapsulated `EGDbContext` configuration within
`AddEnvelopeGenerator` and removed obsolete `#pragma` directives.

Simplified mail service registration by replacing manual
`IEnvelopeMailService` setup with `AddEnvelopeMailService`.

These changes improve maintainability, reduce redundancy, and
modernize the codebase.
2026-05-28 20:23:14 +02:00
533d646211 Update routes and navigation links for sender/receiver UI
Updated the `@page` directives in `ReportDesigner.razor` and
`ReportViewer.razor` to change routes from `/reportdesigner`
to `/sender` and `/reportviewer` to `/receiver`, respectively.

Modified `NavMenu.razor` to update navigation links to reflect
the new routes. Updated the displayed text for the links to
"Empfänger-UI" (Receiver UI) and "Umschlag-UI" (Envelope UI).
2026-05-28 20:17:42 +02:00
7c737ee6ad Update project versioning and dependency handling
Updated project version to 1.0.1, including `<Version>`, `<AssemblyVersion>`, and `<FileVersion>`. Added `<PrivateAssets>all</PrivateAssets>` to `<ProjectReference>` elements to prevent exposing referenced projects' assets. Introduced `IncludeDependencyDlls` and `BundleReferencedDlls` targets to include and bundle dependent project DLLs for multiple target frameworks (`net7.0`, `net8.0`, `net9.0`). Removed redundant `<ProjectReference>` entries and improved packaging to ensure proper handling of dependencies.
2026-05-28 20:13:51 +02:00
7aa08cf8e9 Enable Wasm native build and refactor signature layout
Updated EnvelopeGenerator.ReceiverUI.csproj to enable native WebAssembly builds and load all globalization data for improved localization support.

Refactored ReportViewer.razor to enhance layout calculations for the signature section:
- Introduced constants for better readability and maintainability.
- Dynamically adjusted band height and padding to fit content without overlap.
- Updated control positioning and sizing using calculated values.
- Changed font style of the signature label to regular and reordered control additions for clarity.
2026-05-28 19:43:03 +02:00
4144d2abde Disable native Wasm build in ReceiverUI project
The `<WasmBuildNative>` property in the `EnvelopeGenerator.ReceiverUI.csproj` file was changed from `true` to `false`. This disables the native WebAssembly (Wasm) build, potentially simplifying the build process, reducing build time, or addressing compatibility issues.
2026-05-28 19:42:47 +02:00