Esempio n. 1
0
 public void RemoveAccessToken(ValidateAccessTokenRequest request)
 {
     if (request == null)
     {
         return;
     }
     _accountAccessor.RemoveAccessToken(request.UserID, request.AccessToken);
 }
Esempio n. 2
0
        public Result <LogInResponse> ValidateAccessToken(ValidateAccessTokenRequest request)
        {
            var newToken = _encryptionService.CreateHash(Encoding.UTF8.GetBytes(DateTime.Now.ToString() + request.UserID), _configuration["HashCode"]);
            var result   = _accountAccessor.ValidateAccessToken(request.UserID, request.AccessToken, newToken);

            if (result.IsSuccess)
            {
                //Create a new token with the same expiry date
                var response = _accountAccessor.CreateLogInResponse(request.UserID, result.Payload).Payload;
                response.CartItems = _donateService.CheckCart(request.UserID);
                return(new Result <LogInResponse>(response));
            }
            else
            {
                return(new Result <LogInResponse>(false));
            }
        }
 public IActionResult RemoveAccessToken([FromBody] ValidateAccessTokenRequest request)
 {
     _loginService.RemoveAccessToken(request);
     return(Json(true));
 }
        public IActionResult ValidateAccessToken([FromBody] ValidateAccessTokenRequest request)
        {
            var result = _loginService.ValidateAccessToken(request);

            return(Json(result));
        }