Exemplo n.º 1
0
        public Task <string> GetSecret()
        {
            var nonce     = Guid.NewGuid();
            var timestamp = Commons.GetCurrentTimeStepNumber().ToString();
            var token     =
                ValidHelper.GetSignature(
                    ValidHelper.GetSecretParams(new SecretModels
            {
                apptype   = "system",
                nonce     = nonce.ToString(),
                timestamp = timestamp
            }));
            var secret =
                $"timestamp={timestamp}&nonce={nonce.ToString()}&apptype={"system"}&signature={token}";

            return(Task.FromResult(ValidHelper.Base64Code(secret)));
        }
Exemplo n.º 2
0
        /// <summary>
        /// 构造Secret
        /// </summary>
        /// <returns></returns>
        protected virtual Task <string> CreateSecret()
        {
            var nonce     = Guid.NewGuid();
            var timestamp = GetCurrentTimeStepNumber().ToString();
            //var dataparams = ValidHelper.GetSecretParams(new SecretModels
            //{
            //    apptype = "Web",
            //    nonce = nonce.ToString(),
            //    timestamp = timestamp
            //});
            //var token = ValidHelper.GetSignature(dataparams);
            var token =
                ValidHelper.GetSignature(
                    ValidHelper.GetSecretParams(new SecretModels
            {
                apptype   = "system",
                nonce     = nonce.ToString(),
                timestamp = timestamp
            }));
            var secret =
                $"timestamp={timestamp}&nonce={nonce.ToString()}&apptype={"system"}&signature={token}";

            return(Task.FromResult(ValidHelper.Base64Code(secret)));
        }