示例#1
0
        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);
        }
示例#2
0
        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));
        }
示例#3
0
        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));
        }
示例#4
0
        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));
        }