【发布时间】:2016-02-11 11:32:08
【问题描述】:
我创建了一个IdentityServer,并且可以通过将ClientId 和ClientSecret 传递给令牌端点来成功检索令牌
我的 IndetityServer 设置如下
var certFile = env.ApplicationBasePath + $"{Path.DirectorySeparatorChar}idsrv3test.pfx";
var options = new IdentityServerOptions
{
Factory = new IdentityServerServiceFactory()
.UseInMemoryClients(Client.Get())
.UseInMemoryScopes(Scope.Get())
.UseInMemoryUsers(User.Get()),
SigningCertificate = new X509Certificate2(certFile, "idsrv3test"),
RequireSsl = false
};
app.UseIdentityServer(options);
当我调用受保护的 MVC 6 Web API 时,我得到一个
没有可用于令牌的 SecurityTokenValidator: c7f2c3890d83a454fcb504cb96c75fe7
这是我的 API 的 Startup.cs 中的设置
app.UseJwtBearerAuthentication(options =>
{
options.Authority = $@"{tokenServiceUrl}";
options.Audience = $@"{tokenServiceUrl}/resources";
options.AutomaticAuthenticate = true;
options.RequireHttpsMetadata = false;
});
我确保此设置在app.UseMvc() 调用之前完成。我还有什么需要做的吗?
【问题讨论】:
标签: c# asp.net-core asp.net-core-mvc identityserver3