Kommentare zur Dokumentation hinzugefügt und Pakete konfiguriert.

This commit is contained in:
Developer 02
2024-06-20 16:20:50 +02:00
parent b7584a1632
commit 0ad92e7592
19 changed files with 588 additions and 56 deletions

View File

@@ -81,6 +81,16 @@ namespace DigitalData.Core.Application
.AddScoped<IDirectorySearchService, DirectorySearchService>();
}
/// <summary>
/// Adds the JWT service to the <see cref="IServiceCollection"/>.
/// </summary>
/// <typeparam name="TClaimValue">The type of the claim value used in the JWT token.</typeparam>
/// <param name="services">The <see cref="IServiceCollection"/> to add the service to.</param>
/// <param name="tokenDescriptorFactory">A function that takes a claim value of type <typeparamref name="TClaimValue"/> and returns a <see cref="SecurityTokenDescriptor"/> used to configure the JWT token.</param>
/// <returns>The original <see cref="IServiceCollection"/> instance, allowing further configuration.</returns>
/// <remarks>
/// This method adds the necessary services for handling JWT tokens. The <paramref name="tokenDescriptorFactory"/> function is used to generate the <see cref="SecurityTokenDescriptor"/> which is essential for creating the JWT tokens.
/// </remarks>
public static IServiceCollection AddJWTService<TClaimValue>(this IServiceCollection services, Func<TClaimValue, SecurityTokenDescriptor> tokenDescriptorFactory)
{
return services.AddScoped<IJWTService<TClaimValue>, JWTService<TClaimValue>>(provider => new (tokenDescriptorFactory));