Compare commits
20 Commits
bugfix/sig
...
396c6014fb
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
396c6014fb | ||
|
|
06175b0c95 | ||
|
|
5375d89d5b | ||
|
|
abd1807b18 | ||
|
|
3f33be452c | ||
|
|
9a4931781a | ||
|
|
b3a2e1559a | ||
|
|
261d1b3db9 | ||
|
|
401d03aac2 | ||
|
|
7871bf72f6 | ||
|
|
7e07afa384 | ||
|
|
251420134a | ||
|
|
701b26289b | ||
|
|
754e3ddc7a | ||
|
|
a0e8cc6989 | ||
|
|
b9f25a0ac4 | ||
|
|
f40ee49977 | ||
|
|
d08e93cbef | ||
|
|
4a48bbb3e2 | ||
|
|
9725e2a729 |
@@ -1,7 +1,7 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<TargetFrameworks>net7.0;net8.0;net9.0</TargetFrameworks>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
@@ -17,6 +17,7 @@
|
||||
<PackageReference Include="DigitalData.Core.Client" Version="2.0.3" />
|
||||
<PackageReference Include="DigitalData.Core.DTO" Version="2.0.0" />
|
||||
<PackageReference Include="DigitalData.EmailProfilerDispatcher" Version="2.0.0" />
|
||||
<PackageReference Include="MediatR" Version="11.1.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="7.0.18" />
|
||||
<PackageReference Include="Otp.NET" Version="1.4.0" />
|
||||
<PackageReference Include="QRCoder" Version="1.6.0" />
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
using MediatR;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace EnvelopeGenerator.Application.EnvelopeReceivers.Commands.Create;
|
||||
|
||||
#region DTOs
|
||||
/// <summary>
|
||||
/// Signaturposition auf einem Dokument.
|
||||
/// </summary>
|
||||
/// <param name="X">X-Position</param>
|
||||
/// <param name="Y">Y-Position</param>
|
||||
/// <param name="Page">Seite, auf der sie sich befindet</param>
|
||||
public record Signature([Required] int X, [Required] int Y, [Required] int Page);
|
||||
|
||||
/// <summary>
|
||||
/// DTO für Empfänger, die erstellt oder abgerufen werden sollen.
|
||||
/// Wenn nicht, wird sie erstellt und mit einer Signatur versehen.
|
||||
/// </summary>
|
||||
/// <param name="Signatures">Unterschriften auf Dokumenten.</param>
|
||||
/// <param name="Name">Der Name, mit dem der Käufer angesprochen werden soll. Bei Null oder keinem Wert wird der zuletzt verwendete Name verwendet.</param>
|
||||
/// <param name="PhoneNumber">Sollte mit Vorwahl geschrieben werden</param>
|
||||
public record ReceiverGetOrCreateDto([Required] IEnumerable<Signature> Signatures, string? Name = null, string? PhoneNumber = null)
|
||||
{
|
||||
private string _emailAddress = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// E-Mail-Adresse des Empfängers.
|
||||
/// </summary>
|
||||
[Required]
|
||||
public required string EmailAddress { get => _emailAddress.ToLower(); init => _emailAddress.ToLower(); }
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// DTO für die Erstellung eines Dokuments.
|
||||
/// </summary>
|
||||
public record DocumentCreateDto(byte[]? DataAsByte = null, string? DataAsBase64 = null);
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Befehl zur Erstellung eines Umschlags.
|
||||
/// </summary>
|
||||
public record CreateEnvelopeCommand(
|
||||
[Required] string Title,
|
||||
[Required] string Message,
|
||||
[Required] DocumentCreateDto Document,
|
||||
[Required] IEnumerable<ReceiverGetOrCreateDto> Receivers,
|
||||
string Language = "de-DE",
|
||||
DateTime? ExpiresWhen = null,
|
||||
DateTime? ExpiresWarningWhen = null,
|
||||
int ContractType = (int)Common.Constants.ContractType.Contract,
|
||||
bool TFAEnabled = false
|
||||
) : IRequest;
|
||||
@@ -0,0 +1,16 @@
|
||||
using EnvelopeGenerator.Application.Envelopes.Queries.Read;
|
||||
using EnvelopeGenerator.Application.Receivers.Queries.Read;
|
||||
|
||||
namespace EnvelopeGenerator.Application.EnvelopeReceivers;
|
||||
|
||||
/// <summary>
|
||||
/// Stellt eine Abfrage zum Lesen eines Envelope-Empfängers dar.
|
||||
/// </summary>
|
||||
/// <param name="MinStatus"></param>
|
||||
/// <param name="MaxStatus"></param>
|
||||
/// <param name="IgnoreStatus"></param>
|
||||
/// <param name="Receiver"></param>
|
||||
public record EnvelopeReceiverQuery(
|
||||
int? MinStatus = null,
|
||||
int? MaxStatus = null,
|
||||
int[]? IgnoreStatus = null);
|
||||
@@ -0,0 +1,15 @@
|
||||
using EnvelopeGenerator.Application.Envelopes.Queries.Read;
|
||||
using EnvelopeGenerator.Application.Receivers.Queries.Read;
|
||||
using MediatR;
|
||||
|
||||
namespace EnvelopeGenerator.Application.EnvelopeReceivers.Queries.Read;
|
||||
|
||||
/// <summary>
|
||||
/// Stellt eine Abfrage zum Lesen eines Envelope-Empfängers dar.
|
||||
/// </summary>
|
||||
public record ReadEnvelopeReceiverQuery : EnvelopeReceiverQuery, IRequest<ReadEnvelopeReceiverResponse>
|
||||
{
|
||||
public ReadEnvelopeQuery? Envelope { get; init; }
|
||||
|
||||
public ReadReceiverQuery? Receiver { get; init; }
|
||||
};
|
||||
@@ -0,0 +1,46 @@
|
||||
using DigitalData.EmailProfilerDispatcher.Abstraction.Attributes;
|
||||
using EnvelopeGenerator.Application.Envelopes.Queries.Read;
|
||||
using EnvelopeGenerator.Application.Receivers.Queries.Read;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace EnvelopeGenerator.Application.EnvelopeReceivers.Queries.Read;
|
||||
|
||||
/// <summary>
|
||||
/// Stellt eine Antwort auf die Abfrage zum Lesen eines Envelope-Empfängers dar.
|
||||
/// </summary>
|
||||
/// <param name="Receiver">Der angeforderte Empfänger.</param>
|
||||
public record ReadEnvelopeReceiverResponse(int UserId, int Status)
|
||||
{
|
||||
[NotMapped]
|
||||
public (int Envelope, int Receiver) Id => (Envelope: EnvelopeId, Receiver: ReceiverId);
|
||||
|
||||
[Required]
|
||||
public int EnvelopeId { get; init; }
|
||||
|
||||
[Required]
|
||||
public int ReceiverId { get; init; }
|
||||
|
||||
public int Sequence { get; init; }
|
||||
|
||||
[TemplatePlaceholder("[NAME_RECEIVER]")]
|
||||
public string? Name { get; init; }
|
||||
|
||||
public string? JobTitle { get; init; }
|
||||
|
||||
public string? CompanyName { get; init; }
|
||||
|
||||
public string? PrivateMessage { get; init; }
|
||||
|
||||
public DateTime AddedWhen { get; init; }
|
||||
|
||||
public DateTime? ChangedWhen { get; init; }
|
||||
|
||||
public bool HasPhoneNumber { get; init; }
|
||||
|
||||
[Required]
|
||||
public required ReadEnvelopeResponse Envelope { get; init; }
|
||||
|
||||
[Required]
|
||||
public IEnumerable<ReadReceiverResponse> Receiver { get; init; } = new List<ReadReceiverResponse>();
|
||||
}
|
||||
20
EnvelopeGenerator.Application/Envelopes/EnvelopeQuery.cs
Normal file
20
EnvelopeGenerator.Application/Envelopes/EnvelopeQuery.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using MediatR;
|
||||
|
||||
namespace EnvelopeGenerator.Application.Envelopes;
|
||||
|
||||
/// <summary>
|
||||
/// Repräsentiert eine Abfrage für Umschläge.
|
||||
/// </summary>
|
||||
/// <param name="Id">Die eindeutige Kennung des Umschlags.</param>
|
||||
/// <param name="UserId">Die Kennung des Benutzers, der den Umschlag erstellt hat.</param>
|
||||
/// <param name="Username">Der Benutzername des Benutzers, der den Umschlag erstellt hat.</param>
|
||||
/// <param name="Email">Die E-Mail-Adresse des Benutzers, der den Umschlag erstellt hat.</param>
|
||||
/// <param name="Status">Der Status des Umschlags.</param>
|
||||
/// <param name="Uuid">Die universell eindeutige Kennung des Umschlags.</param>
|
||||
public record EnvelopeQuery(
|
||||
int? Id = null,
|
||||
int? UserId = null,
|
||||
string? Username = null,
|
||||
string? Email = null,
|
||||
int? Status = null,
|
||||
string? Uuid = null) : IRequest;
|
||||
@@ -0,0 +1,8 @@
|
||||
namespace EnvelopeGenerator.Application.Envelopes.Queries.Read;
|
||||
|
||||
/// <summary>
|
||||
/// Stellt eine Abfrage zum Lesen von Briefumschlägen dar.
|
||||
/// </summary>
|
||||
public record ReadEnvelopeQuery : EnvelopeQuery
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
using EnvelopeGenerator.Common;
|
||||
|
||||
namespace EnvelopeGenerator.Application.Envelopes.Queries.Read;
|
||||
|
||||
public record ReadEnvelopeResponse(int Id, int UserId, int Status, string Uuid, string? Message, DateTime AddedWhen, DateTime? ChangedWhen, string? Title, string Language, bool TFAEnabled, DigitalData.UserManager.Domain.Entities.User User)
|
||||
{
|
||||
public string StatusName => ((Constants.EnvelopeStatus)Status).ToString();
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
namespace EnvelopeGenerator.Application.Receivers.Queries.Read;
|
||||
|
||||
public record ReadReceiverQuery : ReceiverQuery
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
namespace EnvelopeGenerator.Application.Receivers.Queries.Read;
|
||||
|
||||
public record ReadReceiverResponse(int Id, string EmailAddress, DateTime AddedWhen, string Signature)
|
||||
{
|
||||
}
|
||||
9
EnvelopeGenerator.Application/Receivers/ReceiverQuery.cs
Normal file
9
EnvelopeGenerator.Application/Receivers/ReceiverQuery.cs
Normal file
@@ -0,0 +1,9 @@
|
||||
namespace EnvelopeGenerator.Application.Receivers;
|
||||
|
||||
/// <summary>
|
||||
/// Empfänger des Umschlags
|
||||
/// </summary>
|
||||
/// <param name="Id">ID des Empfängers</param>
|
||||
/// <param name="EmailAddress">E-Mail Adresse des Empfängers</param>
|
||||
/// <param name="Signature">Eindeutige Signatur des Empfängers</param>
|
||||
public record ReceiverQuery(int? Id = null, string? EmailAddress = null, string? Signature = null);
|
||||
@@ -1,7 +1,7 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<TargetFrameworks>net7.0;net8.0;net9.0</TargetFrameworks>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
@@ -156,11 +156,7 @@ Public Class EnvelopeEditorController
|
||||
|
||||
Public Async Function CreateDocument(pDocumentFilePath As String) As Threading.Tasks.Task(Of EnvelopeDocument)
|
||||
Try
|
||||
Dim oFixedPath = FixPageRotation.FixPageRotation(pDocumentFilePath)
|
||||
If oFixedPath <> pDocumentFilePath Then
|
||||
Logger.Info("PageRotation has been reseted to 0.")
|
||||
End If
|
||||
Dim oFileInfo = New FileInfo(oFixedPath)
|
||||
Dim oFileInfo = New FileInfo(pDocumentFilePath)
|
||||
Dim oTempFiles As New TempFiles(State.LogConfig)
|
||||
Dim oTempFilePath = Path.Combine(oTempFiles._TempPath, Guid.NewGuid().ToString + oFileInfo.Extension)
|
||||
|
||||
@@ -176,7 +172,7 @@ Public Class EnvelopeEditorController
|
||||
.FileNameOriginal = oFileInfo.Name,
|
||||
.Thumbnail = Thumbnail.GetThumbnailFromPDFFile(oTempFilePath),
|
||||
.PageCount = Thumbnail.GetPageCount(oTempFilePath),
|
||||
.Byte_Data = ReadFile(oFixedPath)
|
||||
.Byte_Data = ReadFile(pDocumentFilePath)
|
||||
}
|
||||
|
||||
Return oDocument
|
||||
|
||||
@@ -77,8 +77,8 @@
|
||||
<Reference Include="DevExpress.XtraNavBar.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" />
|
||||
<Reference Include="DevExpress.XtraPrinting.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
|
||||
<Reference Include="DevExpress.XtraTreeList.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
|
||||
<Reference Include="DigitalData.Controls.DocumentViewer, Version=1.9.8.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\DigitalData.Controls.DocumentViewer.1.9.8\lib\net462\DigitalData.Controls.DocumentViewer.dll</HintPath>
|
||||
<Reference Include="DigitalData.Controls.DocumentViewer, Version=1.9.7.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\DigitalData.Controls.DocumentViewer.1.9.7\lib\net462\DigitalData.Controls.DocumentViewer.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DigitalData.GUIs.Common">
|
||||
<HintPath>..\..\2_DLL Projekte\DDMonorepo\GUIs.Common\bin\Debug\DigitalData.GUIs.Common.dll</HintPath>
|
||||
@@ -116,6 +116,9 @@
|
||||
<Reference Include="EntityFramework.SqlServer, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\EntityFramework.6.4.4\lib\net45\EntityFramework.SqlServer.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="EnvelopeGenerator.Common, Version=2.4.2.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\EnvelopeGenerator.Common.2.4.2\lib\net462\EnvelopeGenerator.Common.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="FirebirdSql.Data.FirebirdClient, Version=7.5.0.0, Culture=neutral, PublicKeyToken=3750abcc3150b00c, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\FirebirdSql.Data.FirebirdClient.7.5.0\lib\net452\FirebirdSql.Data.FirebirdClient.dll</HintPath>
|
||||
</Reference>
|
||||
@@ -183,9 +186,6 @@
|
||||
<HintPath>..\packages\GdPicture.14.3.3\lib\net462\GdPicture.NET.14.wia.gateway.dll</HintPath>
|
||||
<EmbedInteropTypes>True</EmbedInteropTypes>
|
||||
</Reference>
|
||||
<Reference Include="Mail">
|
||||
<HintPath>P:\Projekte DIGITAL DATA\DIGITAL DATA - Entwicklung\DLL_Bibliotheken\Limilabs\Mail.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Bcl.AsyncInterfaces, Version=9.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Bcl.AsyncInterfaces.9.0.0\lib\net462\Microsoft.Bcl.AsyncInterfaces.dll</HintPath>
|
||||
</Reference>
|
||||
@@ -362,7 +362,6 @@
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Helper\Encryption.vb" />
|
||||
<Compile Include="Helper\FixPageRotation.vb" />
|
||||
<Compile Include="Helper\RefreshHelper.vb" />
|
||||
<Compile Include="Helper\TempFiles.vb" />
|
||||
<Compile Include="Helper\Thumbnail.vb" />
|
||||
@@ -465,7 +464,10 @@
|
||||
<Content Include="GdPicture.NET.14.machine.vision.dll" />
|
||||
<Content Include="GdPicture.NET.14.twain.client.64.dll" />
|
||||
<Content Include="GdPicture.NET.14.twain.client.dll" />
|
||||
<Content Include="MailLicense.xml" />
|
||||
<Content Include="Images\circle.svg" />
|
||||
<Content Include="MailLicense.xml">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="README.txt" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
@@ -473,10 +475,6 @@
|
||||
<Project>{6EA0C51F-C2B1-4462-8198-3DE0B32B74F8}</Project>
|
||||
<Name>EnvelopeGenerator.Common</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\EnvelopeGenerator.Common\EnvelopeGenerator.Common.vbproj">
|
||||
<Project>{6ea0c51f-c2b1-4462-8198-3de0b32b74f8}</Project>
|
||||
<Name>EnvelopeGenerator.Common</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
|
||||
@@ -1,48 +0,0 @@
|
||||
Imports System.IO
|
||||
Imports GdPicture14
|
||||
|
||||
Public Class FixPageRotation
|
||||
''' <summary>
|
||||
''' Checks if there are any rotations in the document. If so, normalizes the page rotation to 0 without affecting its visual appearance.
|
||||
''' Creates and uses a new document with the corrected properties.
|
||||
''' Fixes the issue of annotations being rotated to match the page's rotation.
|
||||
''' </summary>
|
||||
''' <param name="pFilePath"></param>
|
||||
''' <returns></returns>
|
||||
Public Shared Function FixPageRotation(pFilePath As String) As String
|
||||
|
||||
Dim oFolder As String = Path.GetDirectoryName(pFilePath)
|
||||
Dim oChanged As Boolean = False
|
||||
|
||||
Using gdpicturePDF As New GdPicturePDF()
|
||||
|
||||
Dim status As GdPictureStatus = gdpicturePDF.LoadFromFile(pFilePath, True)
|
||||
If status = GdPictureStatus.OK Then
|
||||
|
||||
Dim count As Integer = gdpicturePDF.GetPageCount()
|
||||
For i As Integer = 1 To count
|
||||
If gdpicturePDF.SelectPage(i) = GdPictureStatus.OK Then
|
||||
Dim rotation As Integer = gdpicturePDF.GetPageRotation()
|
||||
If rotation <> 0 Then
|
||||
gdpicturePDF.NormalizePage()
|
||||
oChanged = True
|
||||
End If
|
||||
End If
|
||||
Next
|
||||
|
||||
End If
|
||||
|
||||
If oChanged Then
|
||||
Dim newFilesPath As String = Path.Combine(oFolder, "RotationFixed_" & Path.GetFileName(pFilePath))
|
||||
If gdpicturePDF.SaveToFile(newFilesPath) = GdPictureStatus.OK Then
|
||||
Return newFilesPath
|
||||
End If
|
||||
End If
|
||||
|
||||
End Using
|
||||
|
||||
Return pFilePath
|
||||
|
||||
End Function
|
||||
|
||||
End Class
|
||||
3
EnvelopeGenerator.Form/Images/circle.svg
Normal file
3
EnvelopeGenerator.Form/Images/circle.svg
Normal file
@@ -0,0 +1,3 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-circle-fill" viewBox="0 0 16 16">
|
||||
<circle cx="8" cy="8" r="8"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 168 B |
@@ -568,6 +568,10 @@ Partial Public Class frmEnvelopeEditor
|
||||
RibbonPageGroupAddSignature_Enabled()
|
||||
End Sub
|
||||
Dim CellValueChanged As Boolean = False
|
||||
Private Sub ViewReceivers_ColumnPositionChanged(sender As Object, e As EventArgs) Handles ViewReceivers.ColumnPositionChanged
|
||||
|
||||
|
||||
End Sub
|
||||
Private Sub ViewReceivers_CellValueChanged(sender As Object, e As Views.Base.CellValueChangedEventArgs) Handles ViewReceivers.CellValueChanged
|
||||
|
||||
If e.Column.FieldName = COL_EMAIL And CellValueChanged = False Then
|
||||
@@ -583,22 +587,17 @@ Partial Public Class frmEnvelopeEditor
|
||||
Dim oEmailAdress As String = DirectCast(e.Value.ToString.ToLower, String)
|
||||
oEmailAdress = Trim(oEmailAdress)
|
||||
If IsValidEmailAddress(oEmailAdress) = True Then
|
||||
Dim oAccessCode As String = ""
|
||||
Dim oLastName As String = Controller.GetLastNameByEmailAdress(oEmailAdress)
|
||||
'oAccessCode = Helpers.GetAccessCode()
|
||||
Dim oAccessCode As String = Helpers.GetAccessCode()
|
||||
Dim oPhoneNumber As String = Controller.GetLastPhoneByEmailAdress(oEmailAdress)
|
||||
ViewReceivers.SetRowCellValue(e.RowHandle, ViewReceivers.Columns.Item(COL_EMAIL), oEmailAdress)
|
||||
ViewReceivers.SetRowCellValue(e.RowHandle, ViewReceivers.Columns.Item(COL_NAME), oLastName)
|
||||
CheckAccesscode(e.RowHandle, oAccessCode)
|
||||
' ViewReceivers.SetRowCellValue(e.RowHandle, ViewReceivers.Columns.Item(COL_CODE), oAccessCode)
|
||||
ViewReceivers.SetRowCellValue(e.RowHandle, ViewReceivers.Columns.Item(COL_CODE), oAccessCode)
|
||||
If Envelope.TFA_Enabled AndAlso DEF_TF_ENABLED_WITH_PHONE Then
|
||||
ViewReceivers.SetRowCellValue(e.RowHandle, ViewReceivers.Columns.Item(COL_PHONE), oPhoneNumber)
|
||||
End If
|
||||
If ViewReceivers.GetRowCellValue(e.RowHandle, ViewReceivers.Columns.Item(COL_CODE)) = String.Empty Then
|
||||
CheckAccesscode(e.RowHandle, oAccessCode)
|
||||
End If
|
||||
Else
|
||||
Dim oMsg = Resources.Envelope.Error_email_Validation
|
||||
Dim oMsg = Resources.Envelope.Error_email_Validation
|
||||
oMsg = oMsg.Replace("@Mail", oEmailAdress)
|
||||
MsgBox(oMsg, MsgBoxStyle.Exclamation, Text)
|
||||
ViewReceivers.DeleteRow(ViewReceivers.FocusedRowHandle)
|
||||
@@ -621,12 +620,6 @@ Partial Public Class frmEnvelopeEditor
|
||||
CellValueChanged = False
|
||||
End If
|
||||
End Sub
|
||||
Private Function CheckAccesscode(pRowHandle As Integer, pAccessCode As String) As Boolean
|
||||
If pAccessCode = "" Then
|
||||
pAccessCode = Helpers.GetAccessCode()
|
||||
ViewReceivers.SetRowCellValue(pRowHandle, ViewReceivers.Columns.Item(COL_CODE), pAccessCode)
|
||||
End If
|
||||
End Function
|
||||
Private Function IsValidEmailAddress(pEmailAddress As String) As Boolean
|
||||
Try
|
||||
If pEmailAddress.Contains("@") Then
|
||||
|
||||
@@ -282,7 +282,6 @@
|
||||
'
|
||||
'frmFieldEditor
|
||||
'
|
||||
Me.Appearance.Options.UseFont = True
|
||||
resources.ApplyResources(Me, "$this")
|
||||
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
|
||||
Me.Controls.Add(Me.SplitContainerControl1)
|
||||
|
||||
@@ -123,7 +123,7 @@
|
||||
</data>
|
||||
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<data name="SplitContainerControl1.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>0, 59</value>
|
||||
<value>0, 132</value>
|
||||
</data>
|
||||
<data name="ThumbnailEx2.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
|
||||
<value>Fill</value>
|
||||
@@ -132,7 +132,7 @@
|
||||
<value>0, 0</value>
|
||||
</data>
|
||||
<data name="ThumbnailEx2.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>199, 600</value>
|
||||
<value>199, 526</value>
|
||||
</data>
|
||||
<assembly alias="mscorlib" name="mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<data name="ThumbnailEx2.TabIndex" type="System.Int32, mscorlib">
|
||||
@@ -142,7 +142,7 @@
|
||||
<value>ThumbnailEx2</value>
|
||||
</data>
|
||||
<data name=">>ThumbnailEx2.Type" xml:space="preserve">
|
||||
<value>GdPicture14.ThumbnailEx, GdPicture.NET.14, Version=14.3.3.0, Culture=neutral, PublicKeyToken=f52a2e60ad468dbb</value>
|
||||
<value>GdPicture14.ThumbnailEx, GdPicture.NET.14, Version=14.1.0.152, Culture=neutral, PublicKeyToken=f52a2e60ad468dbb</value>
|
||||
</data>
|
||||
<data name=">>ThumbnailEx2.Parent" xml:space="preserve">
|
||||
<value>SplitContainerControl1.Panel1</value>
|
||||
@@ -172,7 +172,7 @@
|
||||
<value>0, 0</value>
|
||||
</data>
|
||||
<data name="DocumentViewer1.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>917, 600</value>
|
||||
<value>916, 526</value>
|
||||
</data>
|
||||
<data name="DocumentViewer1.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>3</value>
|
||||
@@ -181,7 +181,7 @@
|
||||
<value>DocumentViewer1</value>
|
||||
</data>
|
||||
<data name=">>DocumentViewer1.Type" xml:space="preserve">
|
||||
<value>DigitalData.Controls.DocumentViewer.DocumentViewer, DigitalData.Controls.DocumentViewer, Version=1.9.8.0, Culture=neutral, PublicKeyToken=null</value>
|
||||
<value>DigitalData.Controls.DocumentViewer.DocumentViewer, DigitalData.Controls.DocumentViewer, Version=1.9.2.0, Culture=neutral, PublicKeyToken=null</value>
|
||||
</data>
|
||||
<data name=">>DocumentViewer1.Parent" xml:space="preserve">
|
||||
<value>SplitContainerControl1.Panel2</value>
|
||||
@@ -205,7 +205,7 @@
|
||||
<value>1</value>
|
||||
</data>
|
||||
<data name="SplitContainerControl1.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>1126, 600</value>
|
||||
<value>1125, 526</value>
|
||||
</data>
|
||||
<data name="SplitContainerControl1.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>15</value>
|
||||
@@ -397,7 +397,7 @@
|
||||
<value>Combo</value>
|
||||
</data>
|
||||
<data name="ribbonControl1.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>1126, 88</value>
|
||||
<value>1125, 132</value>
|
||||
</data>
|
||||
<data name=">>ribbonControl1.Name" xml:space="preserve">
|
||||
<value>ribbonControl1</value>
|
||||
@@ -427,7 +427,7 @@
|
||||
<value>0, 0</value>
|
||||
</data>
|
||||
<data name="barDockControlTop.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>1126, 0</value>
|
||||
<value>1125, 0</value>
|
||||
</data>
|
||||
<data name=">>barDockControlTop.Name" xml:space="preserve">
|
||||
<value>barDockControlTop</value>
|
||||
@@ -445,10 +445,10 @@
|
||||
<value>Bottom</value>
|
||||
</data>
|
||||
<data name="barDockControlBottom.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>0, 659</value>
|
||||
<value>0, 658</value>
|
||||
</data>
|
||||
<data name="barDockControlBottom.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>1126, 0</value>
|
||||
<value>1125, 0</value>
|
||||
</data>
|
||||
<data name=">>barDockControlBottom.Name" xml:space="preserve">
|
||||
<value>barDockControlBottom</value>
|
||||
@@ -469,7 +469,7 @@
|
||||
<value>0, 0</value>
|
||||
</data>
|
||||
<data name="barDockControlLeft.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>0, 659</value>
|
||||
<value>0, 658</value>
|
||||
</data>
|
||||
<data name=">>barDockControlLeft.Name" xml:space="preserve">
|
||||
<value>barDockControlLeft</value>
|
||||
@@ -487,10 +487,10 @@
|
||||
<value>Right</value>
|
||||
</data>
|
||||
<data name="barDockControlRight.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>1126, 0</value>
|
||||
<value>1125, 0</value>
|
||||
</data>
|
||||
<data name="barDockControlRight.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>0, 659</value>
|
||||
<value>0, 658</value>
|
||||
</data>
|
||||
<data name=">>barDockControlRight.Name" xml:space="preserve">
|
||||
<value>barDockControlRight</value>
|
||||
@@ -511,7 +511,7 @@
|
||||
<value>6, 13</value>
|
||||
</data>
|
||||
<data name="$this.ClientSize" type="System.Drawing.Size, System.Drawing">
|
||||
<value>1689, 988</value>
|
||||
<value>1125, 658</value>
|
||||
</data>
|
||||
<data name="$this.Font" type="System.Drawing.Font, System.Drawing">
|
||||
<value>Segoe UI, 8.25pt</value>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="BouncyCastle.Cryptography" version="2.5.0" targetFramework="net462" />
|
||||
<package id="DigitalData.Controls.DocumentViewer" version="1.9.8" targetFramework="net462" />
|
||||
<package id="DigitalData.Controls.DocumentViewer" version="1.9.7" targetFramework="net462" />
|
||||
<package id="DigitalData.Modules.Base" version="1.3.8" targetFramework="net462" />
|
||||
<package id="DigitalData.Modules.Config" version="1.3.0" targetFramework="net462" />
|
||||
<package id="DigitalData.Modules.Database" version="2.3.5.4" targetFramework="net462" />
|
||||
@@ -12,6 +12,7 @@
|
||||
<package id="DocumentFormat.OpenXml.Framework" version="3.2.0" targetFramework="net462" />
|
||||
<package id="EntityFramework" version="6.4.4" targetFramework="net462" />
|
||||
<package id="EntityFramework.Firebird" version="6.4.0" targetFramework="net462" />
|
||||
<package id="EnvelopeGenerator.Common" version="2.4.2" targetFramework="net462" />
|
||||
<package id="FirebirdSql.Data.FirebirdClient" version="7.5.0" targetFramework="net462" />
|
||||
<package id="GdPicture" version="14.3.3" targetFramework="net462" />
|
||||
<package id="GdPicture.runtimes.windows" version="14.3.3" targetFramework="net462" />
|
||||
|
||||
13
EnvelopeGenerator.GeneratorAPI/.config/dotnet-tools.json
Normal file
13
EnvelopeGenerator.GeneratorAPI/.config/dotnet-tools.json
Normal file
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"version": 1,
|
||||
"isRoot": true,
|
||||
"tools": {
|
||||
"dotnet-ef": {
|
||||
"version": "9.0.3",
|
||||
"commands": [
|
||||
"dotnet-ef"
|
||||
],
|
||||
"rollForward": false
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7,17 +7,27 @@ using Microsoft.AspNetCore.Mvc;
|
||||
using System.Security.Claims;
|
||||
using DigitalData.UserManager.Application.DTOs.Auth;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using EnvelopeGenerator.GeneratorAPI.Models;
|
||||
|
||||
namespace EnvelopeGenerator.GeneratorAPI.Controllers
|
||||
{
|
||||
/// <summary>
|
||||
/// Controller verantwortlich für die Benutzer-Authentifizierung, einschließlich Anmelden, Abmelden und Überprüfung des Authentifizierungsstatus.
|
||||
/// </summary>
|
||||
[Route("api/[controller]")]
|
||||
[ApiController]
|
||||
public class AuthController : ControllerBase
|
||||
public partial class AuthController : ControllerBase
|
||||
{
|
||||
private readonly ILogger<AuthController> _logger;
|
||||
private readonly IUserService _userService;
|
||||
private readonly IDirectorySearchService _dirSearchService;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="AuthController"/> class.
|
||||
/// </summary>
|
||||
/// <param name="logger">The logger instance.</param>
|
||||
/// <param name="userService">The user service instance.</param>
|
||||
/// <param name="dirSearchService">The directory search service instance.</param>
|
||||
public AuthController(ILogger<AuthController> logger, IUserService userService, IDirectorySearchService dirSearchService)
|
||||
{
|
||||
_logger = logger;
|
||||
@@ -25,10 +35,31 @@ namespace EnvelopeGenerator.GeneratorAPI.Controllers
|
||||
_dirSearchService = dirSearchService;
|
||||
}
|
||||
|
||||
//TODO: When a user group is created for signFlow, add a process to check if the user is in this group (like "PM_USER")
|
||||
/// <summary>
|
||||
/// Authentifiziert einen Benutzer und generiert ein JWT-Token. Wenn 'cookie' wahr ist, wird das Token als HTTP-Only-Cookie zurückgegeben.
|
||||
/// </summary>
|
||||
/// <param name="login">Benutzeranmeldedaten (Benutzername und Passwort).</param>
|
||||
/// <param name="cookie">Wenn wahr, wird das JWT-Token auch als HTTP-Only-Cookie gesendet.</param>
|
||||
/// <returns>
|
||||
/// Gibt eine HTTP 200 oder 401.
|
||||
/// </returns>
|
||||
/// <remarks>
|
||||
/// Sample request:
|
||||
///
|
||||
/// POST /api/auth?cookie=true
|
||||
/// {
|
||||
/// "username": "MaxMustermann",
|
||||
/// "password": "Geheim123!"
|
||||
/// }
|
||||
///
|
||||
/// </remarks>
|
||||
/// <response code="200">Erfolgreiche Anmeldung. Gibt das JWT-Token im Antwortkörper oder als Cookie zurück, wenn 'cookie' wahr ist.</response>
|
||||
/// <response code="401">Unbefugt. Ungültiger Benutzername oder Passwort.</response>
|
||||
[ProducesResponseType(typeof(string), StatusCodes.Status200OK, "text/javascript")]
|
||||
[ProducesResponseType(typeof(void), StatusCodes.Status401Unauthorized)]
|
||||
[AllowAnonymous]
|
||||
[HttpPost("login")]
|
||||
public async Task<IActionResult> Login([FromBody] LogInDto login)
|
||||
[HttpPost]
|
||||
public async Task<IActionResult> Login([FromBody] Login login, [FromQuery] bool cookie = false)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -48,13 +79,13 @@ namespace EnvelopeGenerator.GeneratorAPI.Controllers
|
||||
|
||||
// Create claims
|
||||
var claims = new List<Claim>
|
||||
{
|
||||
new (ClaimTypes.NameIdentifier, user.Id.ToString()),
|
||||
new (ClaimTypes.Name, user.Username),
|
||||
new (ClaimTypes.Surname, user.Name!),
|
||||
new (ClaimTypes.GivenName, user.Prename!),
|
||||
new (ClaimTypes.Email, user.Email!),
|
||||
};
|
||||
{
|
||||
new (ClaimTypes.NameIdentifier, user.Id.ToString()),
|
||||
new (ClaimTypes.Name, user.Username),
|
||||
new (ClaimTypes.Surname, user.Name!),
|
||||
new (ClaimTypes.GivenName, user.Prename!),
|
||||
new (ClaimTypes.Email, user.Email!),
|
||||
};
|
||||
|
||||
// Create claimsIdentity
|
||||
var claimsIdentity = new ClaimsIdentity(claims, CookieAuthenticationDefaults.AuthenticationScheme);
|
||||
@@ -75,13 +106,58 @@ namespace EnvelopeGenerator.GeneratorAPI.Controllers
|
||||
|
||||
return Ok();
|
||||
}
|
||||
catch(Exception ex)
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Unexpected error occurred.\n{ErrorMessage}", ex.Message);
|
||||
return StatusCode(StatusCodes.Status500InternalServerError);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Authentifiziert einen Benutzer und generiert ein JWT-Token. Das Token wird als HTTP-only-Cookie zurückgegeben.
|
||||
/// </summary>
|
||||
/// <param name="login">Benutzeranmeldedaten (Benutzername und Passwort).</param>
|
||||
/// <returns>
|
||||
/// Gibt eine HTTP 200 oder 401.
|
||||
/// </returns>
|
||||
/// <remarks>
|
||||
/// Sample request:
|
||||
///
|
||||
/// POST /api/auth/form
|
||||
/// {
|
||||
/// "username": "MaxMustermann",
|
||||
/// "password": "Geheim123!"
|
||||
/// }
|
||||
///
|
||||
/// </remarks>
|
||||
/// <response code="200">Erfolgreiche Anmeldung. Gibt das JWT-Token im Antwortkörper oder als Cookie zurück, wenn 'cookie' wahr ist.</response>
|
||||
/// <response code="401">Unbefugt. Ungültiger Benutzername oder Passwort.</response>
|
||||
[ProducesResponseType(typeof(string), StatusCodes.Status200OK, "text/javascript")]
|
||||
[ProducesResponseType(typeof(void), StatusCodes.Status401Unauthorized)]
|
||||
[AllowAnonymous]
|
||||
[HttpPost]
|
||||
[Route("form")]
|
||||
public async Task<IActionResult> Login([FromForm] Login login)
|
||||
{
|
||||
return await Login(login, true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Entfernt das Authentifizierungs-Cookie des Benutzers (AuthCookie)
|
||||
/// </summary>
|
||||
/// <returns>
|
||||
/// Gibt eine HTTP 200 oder 401.
|
||||
/// </returns>
|
||||
/// <remarks>
|
||||
/// Sample request:
|
||||
///
|
||||
/// POST /api/auth/logout
|
||||
///
|
||||
/// </remarks>
|
||||
/// <response code="200">Erfolgreich gelöscht, wenn der Benutzer ein berechtigtes Cookie hat.</response>
|
||||
/// <response code="401">Wenn es kein zugelassenes Cookie gibt, wird „nicht zugelassen“ zurückgegeben.</response>
|
||||
[ProducesResponseType(typeof(string), StatusCodes.Status200OK, "text/javascript")]
|
||||
[ProducesResponseType(typeof(void), StatusCodes.Status401Unauthorized)]
|
||||
[Authorize]
|
||||
[HttpPost("logout")]
|
||||
public async Task<IActionResult> Logout()
|
||||
@@ -98,8 +174,22 @@ namespace EnvelopeGenerator.GeneratorAPI.Controllers
|
||||
}
|
||||
}
|
||||
|
||||
[AllowAnonymous]
|
||||
[HttpGet("check")]
|
||||
public IActionResult IsAuthenticated() => Ok(User.Identity?.IsAuthenticated ?? false);
|
||||
/// <summary>
|
||||
/// Prüft, ob der Benutzer ein autorisiertes Token hat.
|
||||
/// </summary>
|
||||
/// <returns>Wenn ein autorisiertes Token vorhanden ist HTTP 200 asynchron 401</returns>
|
||||
/// <remarks>
|
||||
/// Sample request:
|
||||
///
|
||||
/// GET /api/auth
|
||||
///
|
||||
/// </remarks>
|
||||
/// <response code="200">Wenn es einen autorisierten Cookie gibt.</response>
|
||||
/// <response code="401">Wenn kein Cookie vorhanden ist oder nicht autorisierte.</response>
|
||||
[ProducesResponseType(typeof(string), StatusCodes.Status200OK, "text/javascript")]
|
||||
[ProducesResponseType(typeof(void), StatusCodes.Status401Unauthorized)]
|
||||
[Authorize]
|
||||
[HttpGet]
|
||||
public IActionResult IsAuthenticated() => Ok();
|
||||
}
|
||||
}
|
||||
@@ -3,50 +3,49 @@ using EnvelopeGenerator.Application.Contracts.Services;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace EnvelopeGenerator.GeneratorAPI.Controllers
|
||||
namespace EnvelopeGenerator.GeneratorAPI.Controllers;
|
||||
|
||||
[Route("api/[controller]")]
|
||||
[ApiController]
|
||||
[Authorize]
|
||||
public class EnvelopeController : ControllerBase
|
||||
{
|
||||
[Route("api/[controller]")]
|
||||
[ApiController]
|
||||
[Authorize]
|
||||
public class EnvelopeController : ControllerBase
|
||||
private readonly ILogger<EnvelopeController> _logger;
|
||||
private readonly IEnvelopeService _envelopeService;
|
||||
|
||||
public EnvelopeController(ILogger<EnvelopeController> logger, IEnvelopeService envelopeService)
|
||||
{
|
||||
private readonly ILogger<EnvelopeController> _logger;
|
||||
private readonly IEnvelopeService _envelopeService;
|
||||
_logger = logger;
|
||||
_envelopeService = envelopeService;
|
||||
}
|
||||
|
||||
public EnvelopeController(ILogger<EnvelopeController> logger, IEnvelopeService envelopeService)
|
||||
[Authorize]
|
||||
[HttpGet]
|
||||
public async Task<IActionResult> GetAsync(
|
||||
[FromQuery] int? min_status = null,
|
||||
[FromQuery] int? max_status = null,
|
||||
[FromQuery] params int[] ignore_statuses)
|
||||
{
|
||||
try
|
||||
{
|
||||
_logger = logger;
|
||||
_envelopeService = envelopeService;
|
||||
}
|
||||
|
||||
[Authorize]
|
||||
[HttpGet]
|
||||
public async Task<IActionResult> GetCurrentAsync(
|
||||
[FromQuery] int? min_status = null,
|
||||
[FromQuery] int? max_status = null,
|
||||
[FromQuery] params int[] ignore_statuses)
|
||||
{
|
||||
try
|
||||
if (User.GetId() is int intId)
|
||||
return await _envelopeService.ReadByUserAsync(intId, min_status: min_status, max_status: max_status, ignore_statuses: ignore_statuses).ThenAsync(
|
||||
Success: Ok,
|
||||
Fail: IActionResult (msg, ntc) =>
|
||||
{
|
||||
_logger.LogNotice(ntc);
|
||||
return StatusCode(StatusCodes.Status500InternalServerError);
|
||||
});
|
||||
else
|
||||
{
|
||||
if (User.GetId() is int intId)
|
||||
return await _envelopeService.ReadByUserAsync(intId, min_status: min_status, max_status: max_status, ignore_statuses: ignore_statuses).ThenAsync(
|
||||
Success: Ok,
|
||||
Fail: IActionResult (msg, ntc) =>
|
||||
{
|
||||
_logger.LogNotice(ntc);
|
||||
return StatusCode(StatusCodes.Status500InternalServerError);
|
||||
});
|
||||
else
|
||||
{
|
||||
_logger.LogError("Despite successful authorization, the 'api/envelope' route encountered an issue: the user ID is not recognized as an integer. This may be due to the removal of the ID during the creation of the claims list.");
|
||||
return StatusCode(StatusCodes.Status500InternalServerError);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "{Message}", ex.Message);
|
||||
_logger.LogError("Despite successful authorization, the 'api/envelope' route encountered an issue: the user ID is not recognized as an integer. This may be due to the removal of the ID during the creation of the claims list.");
|
||||
return StatusCode(StatusCodes.Status500InternalServerError);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "{Message}", ex.Message);
|
||||
return StatusCode(StatusCodes.Status500InternalServerError);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
using DigitalData.Core.DTO;
|
||||
using EnvelopeGenerator.Application.Contracts.Services;
|
||||
using EnvelopeGenerator.Common.My.Resources;
|
||||
using EnvelopeGenerator.Application.EnvelopeReceivers.Commands.Create;
|
||||
using MediatR;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
@@ -12,12 +13,16 @@ namespace EnvelopeGenerator.GeneratorAPI.Controllers
|
||||
public class EnvelopeReceiverController : ControllerBase
|
||||
{
|
||||
private readonly ILogger<EnvelopeReceiverController> _logger;
|
||||
|
||||
private readonly IEnvelopeReceiverService _erService;
|
||||
|
||||
public EnvelopeReceiverController(ILogger<EnvelopeReceiverController> logger, IEnvelopeReceiverService envelopeReceiverService)
|
||||
private readonly IMediator _mediator;
|
||||
|
||||
public EnvelopeReceiverController(ILogger<EnvelopeReceiverController> logger, IEnvelopeReceiverService envelopeReceiverService, IMediator mediator)
|
||||
{
|
||||
_logger = logger;
|
||||
_erService = envelopeReceiverService;
|
||||
_mediator = mediator;
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
@@ -94,5 +99,55 @@ namespace EnvelopeGenerator.GeneratorAPI.Controllers
|
||||
return StatusCode(StatusCodes.Status500InternalServerError);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Datenübertragungsobjekt mit Informationen zu Umschlägen, Empfängern und Unterschriften.
|
||||
/// </summary>
|
||||
/// <param name="createEnvelopeQuery"></param>
|
||||
/// <param name="cancellationToken">Token to cancel the operation</param>
|
||||
/// <returns>HTTP-Antwort</returns>
|
||||
/// <remarks>
|
||||
/// Sample request:
|
||||
///
|
||||
/// POST /api/envelope
|
||||
/// {
|
||||
/// "title": "Vertragsdokument",
|
||||
/// "message": "Bitte unterschreiben Sie dieses Dokument.",
|
||||
/// "document": {
|
||||
/// "dataAsBase64": "dGVzdC1iYXNlNjQtZGF0YQ=="
|
||||
/// },
|
||||
/// "receivers": [
|
||||
/// {
|
||||
/// "emailAddress": "example@example.com",
|
||||
/// "signatures": [
|
||||
/// {
|
||||
/// "x": 100,
|
||||
/// "y": 200,
|
||||
/// "page": 1
|
||||
/// }
|
||||
/// ],
|
||||
/// "name": "Max Mustermann",
|
||||
/// "phoneNumber": "+49123456789"
|
||||
/// }
|
||||
/// ],
|
||||
/// "language": "de-DE",
|
||||
/// "expiresWhen": "2025-12-31T23:59:59Z",
|
||||
/// "expiresWarningWhen": "2025-12-24T23:59:59Z",
|
||||
/// "contractType": 1,
|
||||
/// "tfaEnabled": false
|
||||
/// }
|
||||
///
|
||||
/// </remarks>
|
||||
/// <response code="202">Envelope-Erstellung und Sendeprozessbefehl erfolgreich</response>
|
||||
/// <response code="400">Wenn ein Fehler im HTTP-Body auftritt</response>
|
||||
/// <response code="401">Wenn kein autorisierter Token vorhanden ist</response>
|
||||
/// <response code="500">Es handelt sich um einen unerwarteten Fehler. Die Protokolle sollten überprüft werden.</response>
|
||||
[Authorize]
|
||||
[HttpPost]
|
||||
public async Task<IActionResult> CreateAsync([FromBody] CreateEnvelopeCommand createEnvelopeQuery, CancellationToken cancellationToken)
|
||||
{
|
||||
await _mediator.Send(createEnvelopeQuery, cancellationToken);
|
||||
return Accepted();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,16 +1,28 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<TargetFrameworks>net9.0</TargetFrameworks>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||
<PackageId>EnvelopeGenerator.GeneratorAPI</PackageId>
|
||||
<Title></Title>
|
||||
<Authors>Digital Data GmbH</Authors>
|
||||
<Company>Digital Data GmbH</Company>
|
||||
<Product>EnvelopeGenerator.GeneratorAPI</Product>
|
||||
<Version>1.1.0</Version>
|
||||
<FileVersion>1.1.0</FileVersion>
|
||||
<AssemblyVersion>1.1.0</AssemblyVersion>
|
||||
<PackageOutputPath>Copyright © 2025 Digital Data GmbH. All rights reserved.</PackageOutputPath>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="AspNetCore.Scalar" Version="1.1.8" />
|
||||
<PackageReference Include="DigitalData.Core.Abstractions" Version="2.2.1" />
|
||||
<PackageReference Include="DigitalData.Core.API" Version="2.0.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="7.0.15" />
|
||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="9.0.3" />
|
||||
<PackageReference Include="Scalar.AspNetCore" Version="2.1.4" />
|
||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="8.1.0" />
|
||||
<PackageReference Include="System.DirectoryServices" Version="7.0.1" />
|
||||
<PackageReference Include="System.DirectoryServices.AccountManagement" Version="7.0.1" />
|
||||
<PackageReference Include="System.DirectoryServices.Protocols" Version="7.0.1" />
|
||||
|
||||
15
EnvelopeGenerator.GeneratorAPI/Models/Login.cs
Normal file
15
EnvelopeGenerator.GeneratorAPI/Models/Login.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace EnvelopeGenerator.GeneratorAPI.Models;
|
||||
|
||||
/// <summary>
|
||||
/// Anmeldedatenmodell
|
||||
/// </summary>
|
||||
/// <summary lang="en-US">
|
||||
/// Login data model
|
||||
/// </summary>
|
||||
/// <param name="Username">Active Directory user name</param>
|
||||
/// <param name="Password">Active Directory password</param>
|
||||
public record Login([Required]string Username, [Required] string Password)
|
||||
{
|
||||
}
|
||||
@@ -7,6 +7,9 @@ using Microsoft.AspNetCore.Authentication.Cookies;
|
||||
using Microsoft.AspNetCore.Localization;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.Globalization;
|
||||
using Scalar.AspNetCore;
|
||||
using Microsoft.OpenApi.Models;
|
||||
using System.Reflection;
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
|
||||
@@ -31,8 +34,25 @@ builder.Services.AddCors(options =>
|
||||
|
||||
// Swagger
|
||||
builder.Services.AddEndpointsApiExplorer();
|
||||
builder.Services.AddSwaggerGen();
|
||||
builder.Services.AddSwaggerGen(options =>
|
||||
{
|
||||
options.SwaggerDoc("v1", new OpenApiInfo
|
||||
{
|
||||
Version = "v1",
|
||||
Title = "signFLOW Absender-API",
|
||||
Description = "Eine API zur Verwaltung der Erstellung, des Versands und der Nachverfolgung von Umschlägen in der signFLOW-Anwendung.",
|
||||
Contact = new OpenApiContact
|
||||
{
|
||||
Name = "Digital Data GmbH",
|
||||
Url = new Uri("https://digitaldata.works/digitale-signatur#kontakt"),
|
||||
Email = "info-flow@digitaldata.works"
|
||||
},
|
||||
});
|
||||
|
||||
var xmlFilename = $"{Assembly.GetExecutingAssembly().GetName().Name}.xml";
|
||||
options.IncludeXmlComments(Path.Combine(AppContext.BaseDirectory, xmlFilename));
|
||||
});
|
||||
builder.Services.AddOpenApi();
|
||||
// DbContext
|
||||
var connStr = config.GetConnectionString("Default") ?? throw new InvalidOperationException("There is no default connection string in appsettings.json.");
|
||||
builder.Services.AddDbContext<EGDbContext>(options => options.UseSqlServer(connStr));
|
||||
@@ -60,15 +80,20 @@ builder.Services.AddDirectorySearchService();
|
||||
builder.Services.AddCookieBasedLocalizer() ;
|
||||
|
||||
// Envelope generator serives
|
||||
builder.Services.AddEnvelopeGenerator(config);
|
||||
builder.Services
|
||||
.AddEnvelopeGeneratorRepositories()
|
||||
.AddEnvelopeGeneratorServices(config);
|
||||
|
||||
var app = builder.Build();
|
||||
|
||||
app.MapOpenApi();
|
||||
|
||||
// Configure the HTTP request pipeline.
|
||||
if (app.Environment.IsDevelopment())
|
||||
if (app.Environment.IsDevelopment() || (app.IsDevOrDiP() && config.GetValue<bool>("UseSwagger")))
|
||||
{
|
||||
app.UseSwagger();
|
||||
app.UseSwaggerUI();
|
||||
app.MapScalarApiReference();
|
||||
}
|
||||
|
||||
// Set CORS policy
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
{
|
||||
"UseSwagger": true,
|
||||
"DiPMode": true,
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<TargetFrameworks>net7.0;net8.0;net9.0</TargetFrameworks>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
Reference in New Issue
Block a user