using System;
using System.Linq;
using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Mvc;
namespace Common.Helper.Auth
{
public static class JwtHelper
{
///
/// 获取当前jwt缓存里面的数值 直接本地this.CurValue即可
///
///
///
///
public static string CurValue(this ControllerBase controller,string key)
{
var auth = controller.HttpContext.AuthenticateAsync().Result.Principal.Claims;
var value = auth.FirstOrDefault(t => t.Type.Equals(key))?.Value;
return value;
}
}
}