Ejemplo n.º 1
0
        /// <summary>
        /// Validate refresh token
        /// </summary>
        /// <returns>if token is valid - (true, null), otherwise (false, [reason])</returns>
        private async Task <bool> ValidaateRefreshToken(string userName, string sessionId, string refreshTokenToVerify)
        {
            IAuthToken savedRefreshToken = await _userStore.GetRefreshToken(userName, sessionId); //retrieve the refresh token from data storage

            if (savedRefreshToken == null ||
                savedRefreshToken.Token != refreshTokenToVerify ||
                savedRefreshToken.ExpireDate < DateTime.UtcNow)
            {
                return(false);
            }

            return(true);
        }