fix: TokenParams-Kaliber erstellt, um Token-Beschreibungen über IOptions zu konfigurieren
This commit is contained in:
@@ -13,15 +13,15 @@ namespace DigitalData.Core.Security
|
||||
|
||||
private readonly IMapper _mapper;
|
||||
|
||||
private readonly IEnumerable<TokenDescription>? _tokenDescriptions;
|
||||
private readonly TokenParams? _params;
|
||||
|
||||
private readonly IAsymCryptHandler _cryptHandler;
|
||||
|
||||
public JwtSignatureHandler(IOptions<ClaimDescriptor<TPrincipal>> claimDescriptorOptions, IMapper mapper, IOptions<IEnumerable<TokenDescription>>? tokenDescriptionOptions, IAsymCryptHandler asymCryptHandler)
|
||||
public JwtSignatureHandler(IOptions<ClaimDescriptor<TPrincipal>> claimDescriptorOptions, IMapper mapper, IOptions<TokenParams>? tokenParamOptions, IAsymCryptHandler asymCryptHandler)
|
||||
{
|
||||
_claimDescriptor = claimDescriptorOptions.Value;
|
||||
_mapper = mapper;
|
||||
_tokenDescriptions = tokenDescriptionOptions?.Value;
|
||||
_params = tokenParamOptions?.Value;
|
||||
_cryptHandler = asymCryptHandler;
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ namespace DigitalData.Core.Security
|
||||
|
||||
public SecurityToken CreateToken(TPrincipal subject, string apiRoute)
|
||||
{
|
||||
var description = _tokenDescriptions?.SingleOrDefault(description => description.ApiRoute == apiRoute)
|
||||
var description = _params?.Descriptions.SingleOrDefault(description => description.ApiRoute == apiRoute)
|
||||
?? throw new InvalidOperationException($"No or multiple token description found for api route '{apiRoute}'.");
|
||||
|
||||
description.SigningCredentials = _cryptHandler.Decryptors
|
||||
|
||||
Reference in New Issue
Block a user