예제 #1
0
        private ActionResult <AuthResult> Authenticate(AuthResult authResult)
        {
            if (!authResult.Success)
            {
                return(StatusCode(StatusCodes.Status401Unauthorized, authResult));
            }

            var token        = tokenService.GenerateToken(authResult);
            var refreshToken = tokenService.GenerateRefreshToken();

            refreshTokenRepositoryCache.SaveRefreshToken(settings.JWT.RefreshTokenTimeoutInSeconds, new RefreshTokenLoginRequest(authResult.AuthResultInfo.Email, refreshToken));
            authResult.SetTokens(token, refreshToken);

            return(authResult);
        }