You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
905 B
31 lines
905 B
using System.Security.Claims; |
|
using System.IdentityModel.Tokens.Jwt; |
|
|
|
namespace AX.FireTrainingSys.Services |
|
{ |
|
/// <summary> |
|
/// JWT 服务器接口。 |
|
/// </summary> |
|
public interface IJwtService |
|
{ |
|
/// <summary> |
|
/// 创建一个 JWT。 |
|
/// </summary> |
|
/// <param name="identity"></param> |
|
/// <returns></returns> |
|
string Create(ClaimsIdentity identity); |
|
/// <summary> |
|
/// 验证 JWT 是否有效。 |
|
/// </summary> |
|
/// <param name="token"></param> |
|
/// <param name="principal"></param> |
|
/// <returns></returns> |
|
bool Validate(string token, out ClaimsPrincipal principal); |
|
/// <summary> |
|
/// 解析 JWT,但不验证。 |
|
/// </summary> |
|
/// <param name="token"></param> |
|
/// <returns></returns> |
|
JwtSecurityToken Decode(string token); |
|
} |
|
}
|
|
|