Esempio n. 1
0
        public HttpResponseMessage GetSecretToken([FromBody] string appKey, long timestamp, string sign)
        {
            var dic = new SortedList <string, string>();

            dic.Add("timestamp", timestamp.ToString());
            dic.Add("appKey", appKey);
            var chkResult = SecretHelper.CheckSign(dic, sign);

            if (!chkResult.Status)
            {
                return(ObjectExtends.ToHttpRspMsgError(chkResult.Msg));
            }
            //生成临时接口校验token
            var secretToken = SecretHelper.GetSecretTokenByKey(appKey);

            return(new { secretToken = "" }.ToHttpRspMsgSuccess());
        }
Esempio n. 2
0
        /// <summary>
        /// (3)通过以上方式+私钥
        /// </summary>
        /// <param name="mobile"></param>
        /// <param name="timestamp"></param>
        /// <param name="appKey"></param>
        /// <param name="sign"></param>
        /// <returns></returns>
        public HttpResponseMessage GetUserBySecretKey(string token, long timestamp, string appKey, string sign)
        {
            var dic = new SortedList <string, string>();

            dic.Add("token", token);
            dic.Add("timestamp", timestamp.ToString());
            dic.Add("appKey", appKey);
            var chkResult = SecretHelper.CheckSign(dic, sign);

            if (!chkResult.Status)
            {
                return(ObjectExtends.ToHttpRspMsgError(chkResult.Msg));
            }

            var user = GetUserObj();

            return(user.ToHttpRspMsgSuccess());
        }