コード例 #1
0
        //Add the Refresh token
        //public async Task<bool> AddRefreshToken(BabyFaceRefreshToken token)
        //{
        //    var existingToken = _repository.Value.Query().FirstOrDefault(r => r.UserName == token.UserName
        //                    && r.ClientId == token.ClientId);

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

        //    _repository.Value.Add(token);

        //    return await CommitAsync() > 0;
        //}
        public async Task <bool> AddRefreshToken(BabyFaceRefreshToken token)
        {
            var existingToken = _repository.Value.Query().FirstOrDefault(r => r.UserName == token.UserName &&
                                                                         r.ClientId == token.ClientId);

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

            _repository.Value.Add(token);

            return(await CommitAsync() > 0);
        }
コード例 #2
0
 //Remove the Refresh Token
 public async Task <bool> RemoveRefreshToken(BabyFaceRefreshToken refreshToken)
 {
     _repository.Value.Delete(refreshToken);
     return(await CommitAsync() > 0);
 }