gpt4 book ai didi

c# - Azure 应用程序自定义身份验证签名 key

转载 作者:行者123 更新时间:2023-11-30 23:20:52 24 4
gpt4 key购买 nike

我正在关注以下文档: https://azure.microsoft.com/en-us/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。

正确的字符串格式是什么以及如何生成测试值?

最佳答案

签名 key 是十六进制编码的字符串。您可以使用任何值进行测试 - 前提是用于生成 JWT token 的 key 与用于验证它们的 key 相同。

您可以通过打开浏览器 https://your_app_name.scm.azurewebsites.net/Env.cshtml#envVariables 来检索 Azure Web 或移动应用程序中使用的值。并找到 WEBSITE_AUTH_SIGNING_KEY 值。

关于c# - Azure 应用程序自定义身份验证签名 key ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39590783/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com