in src/Azure.WebSites.DataProtection/JwtGenerator.cs [15:36]
public static string GenerateToken(string issuer, string audience, DateTime? notBefore = null, DateTime? expires = null, string key = null)
{
notBefore = notBefore ?? DateTime.UtcNow;
expires = expires ?? DateTime.UtcNow.AddMinutes(30);
key = key ?? Util.GetDefaultKeyValue();
if (key == null)
{
throw new NullReferenceException("A key value was not provided and a default key is not present.");
}
var handler = new JwtSecurityTokenHandler();
var claimsIdentity = new ClaimsIdentity();
var signingCredentials = new SigningCredentials(new SymmetricSecurityKey(Encoding.UTF8.GetBytes(key)),
SecurityAlgorithms.HmacSha256Signature);
var token = handler.CreateJwtSecurityToken(issuer, audience, subject: claimsIdentity, notBefore: notBefore, expires: expires,
signingCredentials: signingCredentials);
return token.RawData;
}