Example #1
0
 private RefreshToken GetCurrentRefreshTokenRecordFor(Guid accountId)
 {
     return(RefreshTokenRepository.GetAll(new RefreshTokenFilters {
         AccountId = accountId
     })
            .Where(r => r.Expires >= DateTime.UtcNow)
            .FirstOrDefault());
 }
        public async Task <IActionResult> GetAll()
        {
            var refreshTokens = await refreshTokenRepository.GetAll();

            return(Ok(new
            {
                Results = refreshTokens
            }));
        }
Example #3
0
        private void PurgeExpiredRefreshTokensFor(Guid accountId)
        {
            var expiredRecords = RefreshTokenRepository.GetAll(new RefreshTokenFilters {
                AccountId = accountId
            })
                                 .Where(r => r.Expires < DateTime.UtcNow);

            foreach (var record in expiredRecords)
            {
                RefreshTokenRepository.Delete(record.Id);
            }
        }
Example #4
0
 private Property Gettable(RefreshToken token, RefreshTokenRepository tokens)
 => (tokens.GetAll().Count() > 0).ToProperty();