Commit Graph

23 Commits

Author SHA1 Message Date
e34b5ddbbe Update render mode in EnvelopeSenderPage.razor
Replaced the default `InteractiveWebAssembly` render mode with a custom `InteractiveWebAssemblyRenderMode` instance, explicitly setting `prerender` to `false`. This change disables prerendering to adjust the page's rendering behavior, potentially optimizing performance or meeting specific rendering requirements.
2026-06-28 22:05:16 +02:00
b56f906848 Refine authorization and rendering mechanisms
Updated `EnvelopeSenderPage.razor` to replace the `[Authorize]`
attribute with the `@rendermode InteractiveWebAssembly` directive,
indicating a shift in how authorization or rendering is handled.

Modified the `Check` method in `AuthController.cs` to specify
`AuthenticationSchemes = AuthScheme.Sender` in the `[Authorize]`
attribute, enforcing a more specific authentication scheme for
this endpoint.
2026-06-28 21:39:33 +02:00
fe09c5c7ae Update auth-hub primary destination address in yarp.json
Replaced the `Address` value for the `primary` destination in the
`auth-hub` cluster within `yarp.json`. The previous value
(`https://localhost:9090`) was updated to
`http://172.24.12.39:9090`, reflecting a move from a local
development environment to a specific networked environment.
The protocol was also changed from `https` to `http`.
2026-06-28 20:31:52 +02:00
0763d82f6e Refactor services to use IHttpClientFactory
Refactored `DocReceiverElementService` and `EnvelopeService` to use `IHttpClientFactory` instead of directly injecting `HttpClient`, improving flexibility and testability.

Updated constructors to accept `IHttpClientFactory` and replaced direct `HttpClient` usage with named clients (`"EnvelopeGenerator.Server"`). Adjusted methods to use the factory-created clients for HTTP requests.

Added `using Microsoft.Extensions.Options;` in `Program.cs` and registered `EnvelopeService` and `DocReceiverElementService` in the dependency injection container for proper resolution. Clarified their usage in SSR scenarios with comments.

Removed redundant `using` directives and aligned imports with the updated implementation.

These changes enhance maintainability, scalability, and testability by leveraging `IHttpClientFactory` for better HTTP client management and dependency injection.
2026-06-28 20:31:30 +02:00
5a30bc050b Refactor services to remove ApiOptions dependency
Simplified `DocReceiverElementService` and `EnvelopeService` by removing the `ApiOptions` dependency. Updated constructors to eliminate the `IOptions<ApiOptions>` parameter and switched to using relative URLs directly for API requests.

Removed unused `BaseUrl` and `UsePredefinedReports` properties from `ApiOptions`. Cleaned up redundant fields, constructor logic, and unused `using` directives in affected services.

Registered `EnvelopeService` in `Program.cs` with `AddScoped`. These changes improve maintainability, reduce configuration overhead, and make the services more self-contained.
2026-06-28 20:16:34 +02:00
a4b218b9f3 Add new namespaces to EnvelopeService.cs
Included `EnvelopeGenerator.Application.Common.Dto`, `EnvelopeGenerator.Server.Client.Models`, `EnvelopeGenerator.Server.Client.Options`, and `Microsoft.AspNetCore.WebUtilities` to support new functionality or dependencies in the `EnvelopeService.cs` file.
2026-06-25 15:35:36 +02:00
67798b35da Simplify GetDocument authorization logic
Refactor `DocumentController.GetDocument` to exclusively support the "Sender" role by removing logic for the "Receiver" role. Update the `[Authorize]` attribute to enforce the `AuthPolicy.Sender` policy instead of `AuthPolicy.SenderOrReceiver`.

Remove the `AuthPolicy.SenderOrReceiver` policy from `Program.cs` authorization configuration, reflecting the decision to separate role-based access more explicitly. The application now defines distinct policies for "Sender" and "Receiver" roles without combining them.
2026-06-25 15:18:20 +02:00
b5bb2bbaae Refactor sender page and auth service logic
- Added project reference to `EnvelopeGenerator.Application` in the client project.
- Updated imports and injected services in `EnvelopeSenderPage.razor`.
- Improved null handling for `EnvelopeReceivers` and updated email display logic.
- Replaced `CheckSenderAsync` with `CheckSenderAccessAsync` for authorization.
- Refactored `GetStatusInfo` to use `EnvelopeStatus` enum directly.
- Added `CheckSenderAccessAsync` and `LogoutSenderAsync` methods in `AuthService`.
- Simplified `Logout` logic in `AuthController` to remove redundant checks.
2026-06-25 15:17:57 +02:00
de9c9da176 Add Microsoft.AspNetCore.WebUtilities package
Added a new package reference for `Microsoft.AspNetCore.WebUtilities` (version 8.0.28) to the `EnvelopeGenerator.Server.Client.csproj` file. This package provides utilities for handling web-related functionality, such as query string parsing and encoding, and may support new features or dependencies in the project.
2026-06-25 13:37:21 +02:00
f4571320ce Mark Auth record as obsolete with replacement guidance
The `Auth` record in the `EnvelopeGenerator.Server.Models`
namespace has been marked as `[Obsolete]` with the message
"Use auth DTO" to indicate it is outdated and should be
replaced with a newer implementation.

The `Auth` record includes the following properties:
- `AccessCode`, `SmsCode`, `AuthenticatorCode` (nullable strings)
- `UserSelectSMS` (boolean)

Additionally, it defines computed properties `HasAccessCode`
and `HasSmsCode` to check for the presence of `AccessCode`
and `SmsCode`, respectively.
2026-06-25 13:37:05 +02:00
2abfffdeba Remove @rendermode and fix German special characters
The `@rendermode InteractiveWebAssembly` directive was removed from `IndexPage.razor` to simplify the page setup.

Additionally, the `HomePageDescription` constant was updated to replace improperly encoded characters with their correct Unicode equivalents. This ensures proper rendering of German umlauts and special characters in the text.
2026-06-25 13:22:38 +02:00
bfd1a9d060 Enhance EnvelopeSenderPage with new layout and features
Redesigned `EnvelopeSenderPage.razor` to include a structured
dashboard layout with a sender action bar and dynamic content
area. Added authorization enforcement with the `@attribute`
directive and dependency injection for services like
`EnvelopeService` and `AuthService`.

Introduced a tabbed interface for managing "Active" and
"Completed" envelopes, with a `DxGrid` component for displaying
envelope details. Added support for filtering, searching, and
row selection, along with detailed row templates for receiver
information.

Implemented methods for loading, refreshing, creating, editing,
and deleting envelopes, as well as logging out. Enhanced error
handling and state management, and added console logging for
debugging. Integrated external stylesheets for improved UI.
2026-06-25 13:22:09 +02:00
78ed49a077 Refactor AuthService and add new service classes
Refactored `AuthService` to introduce a reusable `CreateDefaultClient` method, reducing code duplication. Updated all relevant methods in `AuthService` to use this new method.

Added `CultureService` to manage application culture/localization, including support for setting, getting, and initializing culture from `localStorage` or browser settings.

Introduced `DocReceiverElementService` for retrieving document receiver elements (signatures) and `EnvelopeService` for managing envelope data retrieval with optional filters. Both services include error handling and consistent JSON deserialization.

These changes improve code maintainability, reusability, and adhere to the single responsibility principle.
2026-06-25 13:16:57 +02:00
6aa97adf84 Refactor and enhance EnvelopeReceiverPage UI/UX
- Replaced `SignatureService` with `DocReceiverElementService` in DI.
- Refactored `envelope-action-bar` for better readability and added badges for `2FA`, `Access Code`, and `Signature Count`.
- Improved error handling and loading states with clearer messages.
- Enhanced PDF viewer toolbar with better navigation, zoom, and signature controls.
- Added resizable thumbnail sidebar with persistent width settings.
- Refactored signature popup to support draw, text, and image tabs with validation.
- Improved JavaScript interop for PDF rendering and signature handling.
- Introduced DevExpress PDF Viewer as an alternative implementation.
- Consolidated state management and improved code readability.
2026-06-25 13:10:32 +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