public void GeneratedUserIdCheck() { var token = new JwtSecurityHelper(_settings.Object); var tempGuid = Guid.NewGuid().ToString(); var jwt = token.GetToken(tempGuid); var userClaim = jwt.Claims.FirstOrDefault(i => i.Type.Equals(JwtRegisteredClaimNames.Sub)); Assert.Equal(userClaim.Value, tempGuid); }
public void TokenStringValidation() { var token = new JwtSecurityHelper(_settings.Object); var tempGuid = Guid.NewGuid().ToString(); var jwt = token.GetToken(tempGuid); var tokenString = token.GetTokenValue(jwt); var handler = new JwtSecurityTokenHandler(); var result = handler.ReadJwtToken(tokenString); Assert.Equal(_settings.Object.Value.Issuer, result.Issuer); }
public ActionResult <string> GetJwtToken() { return(JwtSecurityHelper.GenerateJwtToken(_config[Constants.AuthSecretPreference])); }