Commit Graph

2605 Commits

Author SHA1 Message Date
7456babe0d Merge branch 'master' into bugfix/devexpress-pdf-not-displaying 2026-06-24 16:17:40 +02:00
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
6fe99d0cd0 docs: add culture management migration warnings for Server/Auto
Prepare for Blazor Server/Auto migration by documenting current
WASM-specific culture initialization approach and providing
detailed migration checklist in COPILOT_CONTEXT.md.
2026-06-18 12:50:45 +02:00
45018d04b1 Refactor culture initialization logic
Moved culture initialization from App.razor to Program.cs to ensure culture settings are applied before the app starts. Removed CultureService injection and OnInitializedAsync method from App.razor. Updated LanguageSelector.razor to change language without page reload, enhancing user experience. Added System.Globalization to Program.cs for culture support.
2026-06-18 12:43:56 +02:00
b5af3e61ed Improve language display in LanguageSelector
Replaced the placeholder arrow in the language selector button with the current language name using the new `GetLanguageName` method. Added `GetLanguageName` to map culture codes to language names. Fixed encoding issue by correcting "Fran�ais" to "Français" in the French language option.
2026-06-18 10:34:05 +02:00
314608f27f Fix duplicate root route entry in ReceiverUI docs
Removed a redundant entry for the root route (`/`) in the
`ReceiverUI Route Structure` section of the documentation.
Both entries referenced the same file (`Index.razor`) and
served the same purpose, making the duplication unnecessary.
2026-06-17 17:04:52 +02:00
ba9f233993 Add Language Selector component to footer
Introduced a Language Selector component (`LanguageSelector.razor`) to enable users to switch between German, English, and French. The component includes a dropdown UI with flag icons and language labels, along with logic for toggling the dropdown and changing the app's culture.

Injected `IJSRuntime`, `NavigationManager`, and `CultureService` into the component to handle culture changes and navigation updates.

Updated `MainLayout.razor` to include the Language Selector in the footer. Refactored footer layout in `MainLayout.razor.css` to use flexbox for better alignment and spacing.

Added styles for the Language Selector in `app.css` to ensure a clean and responsive design. Integrated the `flag-icons` library in `index.html` to display flag icons for language representation.
2026-06-17 16:57:39 +02:00
9d962708c4 Initialize culture settings in App.razor
Added dependency injection for `CultureService` in `App.razor` to dynamically initialize culture settings during the component's lifecycle.

Included `System.Globalization` and `EnvelopeGenerator.ReceiverUI.Services` namespaces to support culture-related functionality.

Injected `CultureService` and added an `OnInitializedAsync` method to set `CultureInfo.DefaultThreadCurrentCulture` and `CultureInfo.DefaultThreadCurrentUICulture` based on the service's initialization.

Reformatted surrounding `<Router>` code for clarity.
2026-06-17 16:55:44 +02:00
c93a056ca5 Add CultureService and localization support
Added a new `CultureService` to manage application culture and
localization. The service supports retrieving and setting the
application culture, storing it in `localStorage`, and initializing
it based on stored values, browser settings, or a default fallback.

Registered `CultureService` in the dependency injection container
and added localization support in `Program.cs` using
`builder.Services.AddLocalization()`.
2026-06-17 16:54:40 +02:00
a88a26c248 Remove EGDbContextFactory and related configuration code
The `EGDbContextFactory` class, which implemented the
`IDesignTimeDbContextFactory<EGDbContext>` interface, has been
removed. This includes the `CreateDbContext` method, which handled
design-time DbContext creation by loading configuration from
`appsettings.migration.json`, setting up `DbContextOptions`, and
constructing `DbTriggerParams`.

Additionally, the `#if NET` preprocessor directive and its
corresponding `#endif` have been removed, along with all associated
`using` directives. This change suggests that the factory is no
longer needed due to a shift in the application's architecture or
design-time DbContext handling.
2026-06-17 16:26:24 +02:00
1e963ea215 Add support for JWT authentication
Added `Microsoft.AspNetCore.Authentication.JwtBearer` package to the project to enable JWT authentication. Updated `Program.cs` to include the necessary `using` directive for JWT authentication. No functional changes were made beyond the integration of the new package.
2026-06-17 16:25:57 +02:00
02b857382c Replace SignatureService with DocReceiverElementService
Refactor EnvelopeReceiverPage.razor to inject
DocReceiverElementService instead of SignatureService.

Update Program.cs to remove SignatureService from the
dependency injection configuration and add
DocReceiverElementService as a scoped service.

This change reflects a shift in architecture where
DocReceiverElementService now handles functionality
previously managed by SignatureService.
2026-06-17 16:09:57 +02:00
ca4ec7cb6f Rename SignatureController to DocReceiverElementController
The class `SignatureController` has been renamed to `DocReceiverElementController` to better reflect its purpose. The constructor and its XML documentation have been updated accordingly. The `[Authorize]`, `[ApiController]`, and `[Route]` attributes remain unchanged. A `TODO` comment has been added to indicate future updates for using a signature query.
2026-06-17 16:09:26 +02:00
f2356b3ce4 Refactor SignatureService to DocReceiverElementService
Renamed the `SignatureService` class to `DocReceiverElementService` to reflect its updated purpose. Updated the `GetAsync` method to use the `DocReceiverElement` API endpoint (`/api/DocReceiverElement/{envelopeKey}`) instead of the `Signature` API endpoint. These changes align the service with the new `DocReceiverElement` context.
2026-06-17 16:07:43 +02:00
d61fe79613 Add localization support to the application
Added a package reference for `Microsoft.Extensions.Localization`
to enable localization support. Registered localization services
in `Program.cs` using `builder.Services.AddLocalization()`.
Introduced the `Microsoft.Extensions.Localization` and
`EnvelopeGenerator.Application.Resources` namespaces to support
localized resources. These changes allow the application to
provide content in multiple languages or regions.
2026-06-17 16:05:26 +02:00
714cb9555f feat(i18n): add sender-side UI resources and extension methods
- Added 46 resource strings (de-DE, en-US, fr-FR) for sender UI
- Added corresponding extension methods in Resource.cs
- Migrated from Form app for ReceiverUI sender pages
2026-06-17 15:58:30 +02:00
315a022cb8 feat: Add sender-side UI resource strings for all languages
Added 46 new localized strings to support sender-side UI implementation:

Resources added:
- Resource.de-DE.resx (German)
- Resource.en-US.resx (English)
- Resource.fr-FR.resx (French)

Categories covered:
- Dashboard actions (NewEnvelope, LoadEnvelope, DeleteEnvelope, etc.)
- Grid columns (Receivers, Status, Type, CreatedOn, etc.)
- Toolbar actions (RefreshData, ShowDocument, ResendInvitation, etc.)
- Envelope editor (AddFile, MergeFiles, EditFields, SendEnvelope, etc.)
- Settings (Language, UseAccessCode, TwoFactorEnabled, etc.)
- Reminders & expiry (FirstReminderDays, ExpiresWhenDays, etc.)

Source: Migrated from EnvelopeGenerator.Form resx files
Purpose: Support upcoming ReceiverUI sender pages implementation
2026-06-17 15:55:13 +02:00
746635979b Ensure _allEnvelopes is never null after assignment
Modified the assignment of `_allEnvelopes` to use the result of
`EnvelopeService.GetAsync()` or an empty list (`[]`) if the
result is null. This change prevents potential null reference
issues when `_allEnvelopes` is used later in the code.
2026-06-17 15:10:31 +02:00
31548728cd Refactor EnvelopeStatus to shared domain library
Moved the `EnvelopeStatus` enum and its extension methods
from `ReceiverUI.Models` to `Domain.Constants` to improve
code reuse and maintainability. Updated `EnvelopeSenderPage.razor`
to reference the new namespace.
2026-06-17 15:10:17 +02:00
06c8af2ed8 Remove EnvelopeGenerator.Dto project from solution
The `EnvelopeGenerator.Dto.csproj` file has been removed entirely, including its `<Project>` XML structure.

References to `EnvelopeGenerator.Dto` have been removed from `EnvelopeGenerator.sln`, including the project declaration, build configurations in `SolutionConfigurationPlatforms`, and nested project mappings in `NestedProjects`.

This change fully removes the `EnvelopeGenerator.Dto` project from the solution.
2026-06-17 14:38:30 +02:00
9f57baf2e5 refactor(ReceiverUI/Models): update to use Application layer's DTO 2026-06-17 14:05:01 +02:00
73d793f0a0 remove ApiExplorerSettings attribute 2026-06-17 11:53:01 +02:00
65bb68feef Update DevExpress package versions to 25.2.8
Updated the following DevExpress package references in the project:
- `DevExpress.Blazor.PdfViewer` from 25.2.3 to 25.2.8
- `DevExpress.Blazor.Reporting.JSBasedControls` from 25.2.3 to 25.2.8
- `DevExpress.Blazor.Reporting.Viewer` from 25.2.3 to 25.2.8
- `DevExpress.Drawing.Skia` from 25.2.3 to 25.2.8

No changes were made to other package references or the `NativeFileReference` entry.
2026-06-17 11:05:53 +02:00
c5e97ee30b move dto to common dir 2026-06-17 09:46:27 +02:00
3a4f449b59 Add EnvelopeGenerator.Dto project to the solution
Introduce a new project, `EnvelopeGenerator.Dto`, targeting .NET 8.0.
The project is configured with implicit `using` directives and nullable
reference types enabled. Update the solution file to include the new
project, its build configurations (Debug/Release for Any CPU), and its
hierarchical relationship in the `NestedProjects` section.
2026-06-17 09:45:22 +02:00
6ca7767e4d Enhance grid functionality in EnvelopeSenderPage
Added support for column reordering, sorting, and resizing in the grid:
- Enabled `AllowColumnReorder` for column reordering.
- Enabled `AllowSort` to allow sorting of grid columns.
- Set `ColumnResizeMode` to `GridColumnResizeMode.ColumnsContainer` for improved column resizing behavior.
2026-06-17 09:41:46 +02:00
4237f0a815 Add CellDisplayTemplate for ID column in grid
Updated the `DxGridDataColumn` for the `Id` field in
`EnvelopeSenderPage.razor` to include a `CellDisplayTemplate`.
This enables customized rendering of the `Id` property from
the `EnvelopeDto` object, allowing for additional formatting
or logic during display.
2026-06-16 17:01:38 +02:00
3302be9348 Refactor grid columns and improve UI styling
Removed fixed column widths in `EnvelopeSenderPage.razor` for dynamic sizing. Added `CellDisplayTemplate` to `Title`, `Status`, and `EnvelopeReceivers` columns for custom data rendering. Fixed gradient typo in progress bar CSS.

Added a new CSS rule to hide empty DevExpress grid cells and updated `sender-page.css` to include this rule while preserving existing styles.
2026-06-16 16:47:11 +02:00
4572e20c51 Restrict Logout method to Sender auth scheme
The `[Authorize]` attribute on the `Logout` method in the
`AuthController` class was updated to use the
`AuthenticationSchemes = AuthScheme.Sender` instead of the
`Policy = AuthPolicy.SenderOrReceiver`. This change narrows
the authorization requirement, ensuring only users under the
`Sender` authentication scheme can access the `Logout`
functionality.
2026-06-16 16:32:53 +02:00
b3a70d7259 Add sender authentication check to EnvelopeSenderPage
Added an authentication check in `EnvelopeSenderPage.razor` to verify sender access before loading envelopes. Redirects unauthorized users to the sender login page.

Introduced `CheckSenderAsync` in `AuthService` to validate sender tokens via the `/api/auth/check` endpoint. Updated `OnInitializedAsync` to use this method, enhancing security by ensuring only authorized users can access envelope-related functionality.
2026-06-16 15:55:59 +02:00
bb81920d44 Refactor sender page styles and add versioned URLs
Moved inline styles from `EnvelopeSenderPage.razor` to a new
`sender-page.css` file for better maintainability and separation
of concerns. Updated `EnvelopeSenderPage.razor` to use versioned
URLs for stylesheets via the newly injected `AppVersionService`,
enabling cache-busting. Added responsive design support in
`sender-page.css` to improve layout on smaller screens.
2026-06-16 15:05:00 +02:00