Files
IM_NEW/IM.Jwt/ITokenService.cs
T

19 lines
713 B
C#

using System.Security.Claims;
namespace IM.Jwt
{
public interface ITokenService
{
/// <summary>
/// 获取令牌
/// </summary>
/// <param name="claims">令牌负载</param>
/// <param name="options"></param>
/// <returns></returns>
string GetToken(IEnumerable<Claim> claims, JwtOptions options);
Task<string> CreateRefreshTokenAsync(Guid userId, CancellationToken cancellationToken = default, string? stamp = null, int? days = null);
Task RevokeRefreshTokenAsync(string refreshToken);
Task<(bool ok, Guid userId, string? stamp)> ValidateRefreshTokenAsync(string token, CancellationToken cancellation = default);
}
}