Example #1
0
        private async Task <RefreshTokenResultVm> CreateRefreshTokenAsync(long userId)
        {
            var expirationDate = AccessTokenHelper.ExpirationDate;
            var accessToken    = CreateJwtToken(userId, expirationDate);
            var refreshToken   = GetGuid();

            await _accessTokenService.DeleteActiveAccessTokenAsync(userId);

            await InsertActiveAccessTokenAsync(accessToken, refreshToken, userId);


            return(new RefreshTokenResultVm
            {
                AccessToken = accessToken,
                RefreshToken = refreshToken,
                ExpiresIn = expirationDate
            });
        }
Example #2
0
        public async Task LogoutAsync(long userId)
        {
            _accessTokenService.DeleteUserAccessInMemory(userId);

            await _accessTokenService.DeleteActiveAccessTokenAsync(userId);
        }