Commit Graph

2561 Commits

Author SHA1 Message Date
71e375d6ea Introduce SSR authentication service for EnvelopeReceiverPage
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.
2026-06-24 16:08:29 +02:00
05f64e2b61 Refactor LoginReceiverPage for readability and visuals
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.
2026-06-24 15:59:21 +02:00
ed17852542 Add EnvelopeAuthService for SSR authentication
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.
2026-06-24 15:57:06 +02:00
9947774ba8 Add YARP reverse proxy for auth request forwarding
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.
2026-06-24 15:55:56 +02:00
c6c1decd2a Refactor to use IHttpClientFactory and remove ApiOptions
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.
2026-06-24 10:01:19 +02:00
0fdaa1a38d Refactor HttpClient usage and simplify configuration
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.
2026-06-24 10:01:03 +02:00
5d66de9f32 Refactor HttpClient and HttpContextAccessor setup
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.
2026-06-24 10:00:43 +02:00
b6ec5307b6 Refactor HTTP client management and service lifetimes
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.
2026-06-22 17:35:00 +02:00
106e62a912 Refactor namespaces to EnvelopeGenerator.Server
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.
2026-06-22 16:14:11 +02:00
27940f5d34 Refactor project structure in solution
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.
2026-06-22 15:17:34 +02:00
e776c2edb4 Update launchSettings.json with new profiles and URLs
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.
2026-06-22 15:06:46 +02:00
3f0f5d7fb9 Add Jenkins pipeline and update JSON comments
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.
2026-06-22 14:57:53 +02:00
e11bc9df8e Add new controllers for envelope management
Introduced multiple controllers to enhance application functionality:
- `AnnotationController`: Manages annotations and signature lifecycle.
- `AuthController`: Handles user authentication and session management.
- `CacheController`: Manages cached data for receivers.
- `ConfigController`: Exposes client configuration data.
- `DocumentController`: Provides access to envelope documents.
- `EmailTemplateController`: Manages email templates.
- `EnvelopeController`: Manages envelope operations.
- `EnvelopeReceiverController`: Handles envelope receiver data.
- `EnvelopeTypeController`: Retrieves envelope types.
- `HistoryController`: Accesses envelope history.
- `IAuthController`: Defines authentication interface.
- `LocalizationController`: Manages localization settings.
- `ReadOnlyController`: Manages read-only envelope sharing.
- `ReceiverController`: Retrieves receiver data.
- `SignatureController`: Retrieves document signatures.
- `TfaRegistrationController`: Manages two-factor authentication.

These changes improve maintainability and scalability by organizing operations into dedicated controllers.
2026-06-22 14:57:26 +02:00
4dca17d39c Add claim extension methods for user authentication
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.
2026-06-22 14:56:57 +02:00
8baf6b5553 Add AuthProxyDocumentFilter for Swagger customization
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.
2026-06-22 14:56:21 +02:00
3ca99fdd83 Add models for auth, contact, culture, and annotations
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.
2026-06-22 14:56:03 +02:00
9e37bf1fe2 Enhance authentication and configuration setup
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.
2026-06-22 14:28:43 +02:00
9a0837caa9 Refactor rendering and add PDF resource
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.
2026-06-22 10:44:34 +02:00
030646f33d Enhance service configuration and DI setup
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`.
2026-06-18 16:15:00 +02:00
88317e40f5 Add AGENTS.md - Quick-start guide for AI agents
- 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
2026-06-18 13:33:21 +02:00
3a2fa77862 refactor(WebUI): configure HtpClient 2026-06-15 11:33:03 +02:00
cfa6dbd2de remove deprecated parameter 2026-06-15 11:18:34 +02:00
eb2603f389 remove wwwroot/app.css and add js and css dependencies 2026-06-15 11:04:35 +02:00
456178bee1 migrate shared components 2026-06-15 10:54:08 +02:00
2c41c74510 refactor(COPILOT_CONTEXT): update to be compatible with the migration from ReceiverUI to WebUI 2026-06-15 10:44:19 +02:00
bb73795d68 remove MIGRATION_CONTEXT.md
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.
2026-06-15 10:41:53 +02:00
207992d95a fix(WebUI.Client.Services): resolve doc comment icons 2026-06-15 10:27:51 +02:00
d6bafc64a6 Fix BOM issue in using directives in Report.cs and ReportsFactory.cs
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.
2026-06-15 10:18:31 +02:00
3090711892 resolve comment icons 2026-06-15 10:13:22 +02:00
9dbd8f7952 remove Home.razor 2026-06-15 09:59:42 +02:00
48a41f2987 refactor(wwwroot): move docs, fonts, fake-data, images and js files.
- update appsettings.json to fix
2026-06-15 09:59:18 +02:00
96688a951c refaactor: move css files to WebUI 2026-06-15 09:50:19 +02:00
6f07de3ec4 refactor(Pages): set the render mode of SSR pages as InteractiveServer 2026-06-15 09:40:41 +02:00
4611266224 fix(WebUI): resove referances 2026-06-15 09:30:00 +02:00
c529d03129 move ssr pages 2026-06-15 09:26:00 +02:00
829fab9647 Add PDF viewer, signature, and typing enhancements
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.
2026-06-15 09:20:12 +02:00
b2e3605b54 migrate pdf-viewer.js 2026-06-12 22:15:15 +02:00
8cbdee2491 Integrate DevExpress and enhance app services
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.
2026-06-12 21:52:52 +02:00
4281eaeb22 migrate predefined report to WebUI 2026-06-12 14:46:22 +02:00
150fca5f47 Add data models, randomization, and report factory setup
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.
2026-06-12 14:04:37 +02:00
1f889d8b58 Add signature workflow models, services, and configurations
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.
2026-06-12 14:02:55 +02:00
d599fe3156 Migrate initial YARP setup and client-side pages
- Added `yarp.json` for reverse proxy configuration.
- Updated `WebUI.csproj` with YARP and DevExpress packages.
- Modified `Program.cs` to load YARP config and register services.
- Migrated 4 client-side pages with `@rendermode InteractiveWebAssembly`.
- Migrated 13 services, 7 models, and 2 options classes.
- Updated namespaces to `EnvelopeGenerator.WebUI.Client.*`.
- Documented 43 expected DevExpress-related build errors.
- Pending migration of predefined reports and missing NuGet packages.
2026-06-12 13:56:12 +02:00
6c40c48ac8 Add pages for sender/receiver login and homepage UI
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.
2026-06-12 13:25:29 +02:00
536b8ef5da Integrate YARP and DevExpress Blazor components
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.
2026-06-12 13:10:17 +02:00
d35a35c75e feat(webui): migrate to hybrid Blazor architecture
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.
2026-06-12 12:48:32 +02:00
7fb1a87cf2 Add Blazor WebAssembly and Server projects
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.
2026-06-12 12:25:24 +02:00
a3b33637fd Update authorization scheme for GetAsync method
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.
2026-06-11 23:04:53 +02:00
bc3134a033 Update Envelope to EnvelopeDto mapping configuration
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.
2026-06-11 23:04:43 +02:00
f106255c6b Add Receivers property to EnvelopeDto
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.
2026-06-11 23:04:31 +02:00
cb103dcb69 Restrict UserId visibility and update query includes
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.
2026-06-11 23:04:05 +02:00