public string Generate(string accessKey = null)
{
if (string.IsNullOrWhiteSpace(this.AccessKey) && accessKey == null)
{
throw new ArgumentNullException(nameof(accessKey));
}
this.ValidateToken();
accessKey = accessKey ?? this.AccessKey;
var key = Encoding.UTF8.GetBytes(accessKey);
var signingCredentials = new SigningCredentials(new InMemorySymmetricSecurityKey(key), SecurityAlgorithms.HmacSha256Signature, SecurityAlgorithms.Sha256Digest);
var token = new JwtSecurityToken(this.Issuer, this.Audience, this.Claims, DateTime.UtcNow, this.Expiration, signingCredentials);
return new JwtSecurityTokenHandler().WriteToken(token);
}