This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public async Task<string> CreateJwtTokenString(string accessToken, string refreshToken) | |
{ | |
var jwtSigningKey = await _keyVaultService.GetJwtSigningKey(); | |
var securityKey = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(jwtSigningKey)); | |
var signingCredentials = new SigningCredentials(securityKey, SecurityAlgorithms.HmacSha256Signature); | |
var secToken = new JwtSecurityToken( | |
issuer: _configuration["Issuer"], | |
audience: _configuration["Audience"], | |
claims: new List<Claim> | |
{ | |
new Claim("accessToken", await _cryptoService.Encrypt(accessToken)), | |
new Claim("refreshToken", await _cryptoService.Encrypt(refreshToken)) | |
}, | |
notBefore: null, | |
expires: DateTime.Now.AddDays(1), | |
signingCredentials); | |
return new JwtSecurityTokenHandler().WriteToken(secToken); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment