update codes

master
Young 7 months ago
parent 31772e4f38
commit 1003342da3

@ -0,0 +1,15 @@
using System.IdentityModel.Tokens.Jwt;
using Microsoft.IdentityModel.Tokens;
namespace Infrastructure.Security;
public class DefaultTokenHandler(IEncryptionService encryptionService, JwtSecurityTokenHandler jwtSecurityTokenHandler)
: TokenHandler
{
public override Task<TokenValidationResult> ValidateTokenAsync(string token,
TokenValidationParameters validationParameters)
{
var decodeToken = encryptionService.Decrypt(token);
return jwtSecurityTokenHandler.ValidateTokenAsync(decodeToken, validationParameters);
}
}

@ -0,0 +1,10 @@
namespace Infrastructure.Security;
public class TokenInfo(string token, double expiredIn, string tokenType)
{
public string? Token { get; } = token;
public double? ExpiredIn { get; } = expiredIn;
public string? TokenType { get; } = tokenType;
}
Loading…
Cancel
Save