Пример #1
0
        public string GetAdminTokenByAdminName(string administratorName)
        {
            if (string.IsNullOrEmpty(administratorName))
            {
                return(null);
            }

            var administratorToken = new AdministratorToken()
            {
                AdministratorName = administratorName,
                AddDate           = DateTime.Now
            };

            return(JsonWebToken.Encode(administratorToken, WebConfigUtils.SecretKey, JwtHashAlgorithm.HS256));
        }
Пример #2
0
        public static string GetAdministratorTokenStr(string administratorName)
        {
            if (string.IsNullOrEmpty(administratorName))
            {
                return(null);
            }

            var administratorToken = new AdministratorToken()
            {
                AdministratorName = administratorName,
                AddDate           = DateTime.Now
            };

            return(JsonWebToken.Encode(administratorToken, FileConfigManager.Instance.SecretKey, JwtHashAlgorithm.HS256));
        }