예제 #1
0
        private bool ValidateApiToken(string token, out HubtelProfile hubtelProfile)
        {
            var authKey = _configuration["HubtelAuth:Key"];

            var headerStr = RequestHeaderHelper.Base64Decode(token);

            string[] stringSeparators = new string[] { ":" };
            var      headerStrArr     = headerStr.Split(stringSeparators, 2, StringSplitOptions.None);
            var      basicKeys        = $"{headerStrArr[0]}";

            if ($"{authKey}".Equals(basicKeys))
            {
                hubtelProfile = JsonConvert.DeserializeObject <HubtelProfile>(headerStrArr[1]);
                return(true);
            }
            hubtelProfile = null;
            return(false);
        }