feat(CryptoFactory): Hinzugefügt und in appsettings.json konfiguriert.

This commit is contained in:
Developer 02 2025-01-15 10:30:48 +01:00
parent 82f23d447b
commit f898d8c4a4
3 changed files with 35 additions and 4 deletions

View File

@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
@ -7,6 +7,8 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="DigitalData.Core.Abstractions" Version="3.1.0" />
<PackageReference Include="DigitalData.Core.Security" Version="1.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="8.0.12" />
<PackageReference Include="Microsoft.IdentityModel.Tokens" Version="8.3.0" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.4.0" />

View File

@ -1,5 +1,6 @@
using DigitalData.Auth.API.Config;
using DigitalData.Auth.API.Services;
using DigitalData.Core.Security;
using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.IdentityModel.JsonWebTokens;
using Microsoft.IdentityModel.Tokens;
@ -16,6 +17,7 @@ var apiParams = config.Get<AuthApiParams>() ?? throw new InvalidOperationExcepti
// Add services to the container.
builder.Services.Configure<AuthApiParams>(config);
builder.Services.AddConsumerApiServiceFromConfiguration(config);
builder.Services.AddCryptoFactory(config.GetSection("CryptParams"));
builder.Services.AddControllers();
@ -74,4 +76,4 @@ app.UseAuthorization();
app.MapControllers();
app.Run();
app.Run();

View File

@ -5,5 +5,32 @@
"Microsoft.AspNetCore": "Warning"
}
},
"AllowedHosts": "*"
}
"AllowedHosts": "*",
"CryptParams": {
"KeySizeInBits": 4096,
"Padding": "OaepSHA512",
"PemDirectory": "Secrets",
"Decryptors": [
{
"IsEncrypted": true
}
],
"TokenDescriptors": [
{
"Id": "4062504f-f081-43d1-b4ed-78256a0879e1",
"Issuer": "auth.digitaldata.works",
"Audience": "api.digitaldata.works",
"IsEncrypted": true,
"ApiRoute": "api",
"Lifetime": "48:00:00"
},
{
"Id": "61c07d26-baa8-4cbb-bb33-ac4ee1838c3a",
"Issuer": "auth.digitaldata.works",
"Audience": "client.digitaldata.works",
"IsEncrypted": true,
"ApiRoute": "client"
}
]
}
}