我正在遵循以下文档:https : //azure.microsoft.com/zh-cn/documentation/articles/app-service-mobile-dotnet-backend-how-to-use-server-sdk/来构建自定义身份验证。我想知道以下代码段中的SginingKey格式是什么:
app.UseAppServiceAuthentication(new AppServiceAuthenticationOptions()
{
// Here
SigningKey = ConfigurationManager.AppSettings["authSigningKey"],
ValidAudiences = new[] { ConfigurationManager.AppSettings["authAudience"] },
ValidIssuers = new[] { ConfigurationManager.AppSettings["authIssuer"] },
TokenHandler = config.GetAppServiceTokenHandler()
});
和:
JwtSecurityToken token = AppServiceLoginHandler.CreateToken(
new Claim[] { new
Claim(JwtRegisteredClaimNames.Sub, assertion["username"]) },
// And here
mySigningKey,
myAppURL,
myAppURL,
TimeSpan.FromHours(24));
是Base64String吗?正常的字符串?我注意到在一些分散的示例中,有时是将字节数组转换为Base64String。
什么是正确的字符串格式,如何生成测试值?
签名密钥是十六进制编码的字符串。您可以将任何值用于测试目的-前提是用于生成JWT令牌的密钥与用于验证它们的密钥相同。
您可以通过打开浏览器到https://your_app_name.scm.azurewebsites.net/Env.cshtml#envVariables并找到WEBSITE_AUTH_SIGNING_KEY值来检索Azure Web或移动应用程序中使用的值。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句