Ejemplo n.º 1
0
        /// <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);
        }
Ejemplo n.º 2
0
        /// <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);
        }