Example #1
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="token"></param>
        /// <returns></returns>
        public async Task<bool> AddRefreshToken(RefreshToken token)
        {

            var existingToken = _ctx.RefreshTokens.Where(r => r.Subject == token.Subject && r.ClientId == token.ClientId).SingleOrDefault();

            if (existingToken != null)
            {
                var result = await RemoveRefreshToken(existingToken);
            }

            _ctx.RefreshTokens.Add(token);

            return await _ctx.SaveChangesAsync() > 0;
        }
Example #2
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="refreshToken"></param>
 /// <returns></returns>
 public async Task<bool> RemoveRefreshToken(RefreshToken refreshToken)
 {
     _ctx.RefreshTokens.Remove(refreshToken);
     return await _ctx.SaveChangesAsync() > 0;
 }