public string GetAccessToken(string refreshToken) { var jwtPayload = _jwtService.GetJwtPayload(refreshToken); var accessToken = _accessTokenService.CreateToken(jwtPayload.userEmail); return(accessToken); }
public void Encode_And_Validate_JwToken() { var accessToken = _accessTokenService.CreateToken("*****@*****.**"); var isValid = _jwtService.IsSignatureValid(accessToken); Assert.IsTrue(isValid); }
public IActionResult CreateAccessToken(AccessTokenCreateModel tokenCreate) { if (string.IsNullOrEmpty(tokenCreate.TokenType)) { throw new Exception("Invalid TokenType"); } if (tokenCreate.HoursAllowed < 1) { throw new Exception("Cannot have Hours Allowed less than 1"); } _accessTokenService.CreateToken(tokenCreate.HoursAllowed, tokenCreate.TokenType); return(RedirectToAction("List")); }