Example #1
0
        /// <summary>
        /// Retrieves the user by token.
        /// </summary>
        /// <param name="token">The token.</param>
        /// <returns></returns>
        public User RetrieveUserByToken(string token)
        {
            bool isValidToken = IsValidToken(token);
            User user         = new User();

            //if valid token, proceed to use it.
            if (isValidToken)
            {
                string[] tokenSegments = DecryptToken(token);

                Guid serviceKey = new Guid(tokenSegments[1]);
                user = _resource.RetrieveUserByServiceKey(serviceKey);
            }

            return(user);
        }