fix(JwtSignatureHandler): The nullability of TokenParams has been removed.
This commit is contained in:
parent
4874079b69
commit
c27e21a702
@ -13,15 +13,15 @@ namespace DigitalData.Core.Security
|
||||
|
||||
private readonly IMapper _mapper;
|
||||
|
||||
private readonly TokenParams? _params;
|
||||
private readonly TokenParams _params;
|
||||
|
||||
private readonly IAsymCryptHandler _cryptHandler;
|
||||
|
||||
public JwtSignatureHandler(IOptions<ClaimDescriptor<TPrincipal>> claimDescriptorOptions, IMapper mapper, IOptions<TokenParams>? tokenParamOptions, IAsymCryptHandler asymCryptHandler)
|
||||
public JwtSignatureHandler(IOptions<ClaimDescriptor<TPrincipal>> claimDescriptorOptions, IMapper mapper, IOptions<TokenParams> tokenParamOptions, IAsymCryptHandler asymCryptHandler)
|
||||
{
|
||||
_claimDescriptor = claimDescriptorOptions.Value;
|
||||
_mapper = mapper;
|
||||
_params = tokenParamOptions?.Value;
|
||||
_params = tokenParamOptions.Value;
|
||||
_cryptHandler = asymCryptHandler;
|
||||
}
|
||||
|
||||
@ -35,7 +35,7 @@ namespace DigitalData.Core.Security
|
||||
|
||||
public SecurityToken CreateToken(TPrincipal subject, string issuer, string audience)
|
||||
{
|
||||
var description = _tokenDescriptions?.Get(issuer: issuer, audience: audience)
|
||||
var description = _params.Descriptions?.Get(issuer: issuer, audience: audience)
|
||||
?? throw new InvalidOperationException($"No or multiple token description found for issuer '{issuer}' and audience '{audience}'.");
|
||||
|
||||
description.SigningCredentials = _cryptHandler.Decryptors
|
||||
@ -47,7 +47,7 @@ namespace DigitalData.Core.Security
|
||||
|
||||
public SecurityToken CreateToken(TPrincipal subject, string apiRoute)
|
||||
{
|
||||
var description = _params?.Descriptions.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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user