parent
cbd0eaa353
commit
1ddacab128
@ -1,19 +1,17 @@
|
|||||||
using Microsoft.IdentityModel.Tokens;
|
|
||||||
|
|
||||||
namespace Infrastructure.Security;
|
namespace Infrastructure.Security;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 自定义token解密
|
/// 自定义token解密
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="encryptionService"></param>
|
/// <param name="encryptionService"></param>
|
||||||
/// <param name="jwtSecurityTokenHandler"></param>
|
/// <param name="jwtTokenHandler"></param>
|
||||||
public class DefaultTokenHandler(IEncryptionService encryptionService, JwtSecurityTokenHandler jwtSecurityTokenHandler)
|
public class DefaultTokenHandler(IEncryptionService encryptionService, JsonWebTokenHandler jwtTokenHandler)
|
||||||
: TokenHandler
|
: TokenHandler
|
||||||
{
|
{
|
||||||
public override Task<TokenValidationResult> ValidateTokenAsync(string token,
|
public override Task<TokenValidationResult> ValidateTokenAsync(string token,
|
||||||
TokenValidationParameters validationParameters)
|
TokenValidationParameters validationParameters)
|
||||||
{
|
{
|
||||||
var decodeToken = encryptionService.Decrypt(token);
|
var decodeToken = encryptionService.Decrypt(token);
|
||||||
return jwtSecurityTokenHandler.ValidateTokenAsync(decodeToken, validationParameters);
|
return jwtTokenHandler.ValidateTokenAsync(decodeToken, validationParameters);
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in new issue