public Task InsertTokenAsync(ApplicationJwtRefreshToken token, CancellationToken cancellationToken) { string prefix = nameof(InsertTokenAsync) + Constants.FNSUFFIX; try { using (var tokensDAL = new AspNetTokensDAL(_connStr)) { tokensDAL.Insert(token); } } catch (Exception ex) { _logger.LogError(prefix + $"Exception:[{ex.ToString()}]"); } return(Task.CompletedTask); }
public Task <ApplicationJwtRefreshToken> FindByGuidAsync(string guid, CancellationToken cancellationToken) { string prefix = nameof(FindByGuidAsync) + Constants.FNSUFFIX; ApplicationJwtRefreshToken token = null; try { using (var tokensDAL = new AspNetTokensDAL(_connStr)) { token = tokensDAL.SelectByGuid(guid); } } catch (Exception ex) { _logger.LogError(prefix + $"Exception:[{ex.ToString()}]"); } return(Task.FromResult(token)); }
public Task <IdentityResult> DeleteAsync(string guid, CancellationToken cancellationToken) { try { using (var tokensDAL = new AspNetTokensDAL(_connStr)) { tokensDAL.Delete(guid); } } catch (Exception ex) { List <IdentityError> idErrors = new List <IdentityError>(); IdentityError idError = new IdentityError { Description = ex.Message }; idErrors.Add(idError); return(Task.FromResult(IdentityResult.Failed(idErrors.ToArray()))); } return(Task.FromResult(IdentityResult.Success)); }
public Task <IdentityResult> CreateAsync(ApplicationJwtRefreshToken token, CancellationToken cancellationToken) { try { using (var tokensDAL = new AspNetTokensDAL(_connStr)) { tokensDAL.Insert(token); } } catch (Exception ex) { List <IdentityError> idErrors = new List <IdentityError>(); IdentityError idError = new IdentityError { Description = ex.Message }; idErrors.Add(idError); return(Task.FromResult(IdentityResult.Failed(idErrors.ToArray()))); } return(Task.FromResult(IdentityResult.Success)); }