/// <summary>生成令牌</summary> /// <returns></returns> private static JwtBuilder GetJwt() { var set = Setting.Current; // 生成令牌 var ss = set.JwtSecret.Split(':'); var jwt = new JwtBuilder { Algorithm = ss[0], Secret = ss[1], }; return(jwt); }
/// <summary>生成令牌</summary> /// <returns></returns> public static JwtBuilder GetJwt() { var set = Setting.Current; // 生成令牌 var ss = set.JwtSecret?.Split(':'); if (ss == null || ss.Length < 2) { throw new InvalidOperationException("未设置JWT算法和密钥"); } var jwt = new JwtBuilder { Algorithm = ss[0], Secret = ss[1], }; return(jwt); }