【发布时间】:2019-11-07 23:14:22
【问题描述】:
我正在尝试确定 JwtBearer 服务是否为 .net core 3.0 提供,它实际上是否使用了我的 oidc 提供商众所周知的配置提供的不对称签名密钥???
我找不到与此相关的任何文档。
.AddJwtBearer(opt =>
{
opt.Authority = "http://localhost:8180/auth/realms/master";
opt.TokenValidationParameters = new Microsoft.IdentityModel.Tokens.TokenValidationParameters
{
ValidateIssuer = true,
ValidateAudience = false,
ValidateLifetime = true,
ValidateIssuerSigningKey = true
};
我使用 Keycloak 4.8.3 作为我的 oidc 提供程序。我能找到的最接近的文档在这里。 https://developer.okta.com/blog/2018/03/23/token-authentication-aspnetcore-complete-guide
相关文章在这里:
如果您让 JwtBearer 中间件通过发现文档自动配置,这一切都会自动运行!
上面的代码做到了吗?由于我们不再注册中间件,这在 3.0 中仍然相关吗??
我敢打赌,很多人都不知道不对称签名密钥,以及它们为何如此重要。我们已经从开发人员那里抽象了很多东西,现在我什至不知道我的 api 是否安全。
所以最后一个问题是。 Does the .AddJwtBearer service with "ValidateIssuerSigningKey" periodically check the wellknown or whatever discovery document to grab the latest asymettric signing key?
【问题讨论】:
标签: asp.net-core .net-core keycloak