【发布时间】:2019-01-19 00:38:20
【问题描述】:
我正在关注 ID Server 4 的快速入门,但有一个例外是我正在使用 .NET Core 2.1.302 的 Mac 上工作。不知何故,当我导航到 http://localhost:5000/.well-known/openid-configuration 时,我得到了 404:
info: Microsoft.AspNetCore.Hosting.Internal.WebHost[1]
Request starting HTTP/1.1 GET http://localhost:5000/.well-known/openid-configuration
info: Microsoft.AspNetCore.Hosting.Internal.WebHost[2]
Request finished in 0.108ms 404
以下是我采取的步骤:
- 创建了一个新的 MVC 项目
dotnet new mvc - 添加了 ID 服务器
dotnet add package IdentityServer4 -
通过添加修改我的服务配置
services.AddIdentityServer() .AddDeveloperSigningCredential() .AddInMemoryApiResources(Config.GetApiResources()) .AddInMemoryClients(Config.GetClients()); -
使用以下内容创建 Config.cs:
public static IEnumerable<ApiResource> GetApiResources() { return new List<ApiResource> { new ApiResource("api1", "My API") }; } public static IEnumerable<Client> GetClients() { return new List<Client> { new Client { ClientId = "client", // no interactive user, use the clientid/secret for authentication AllowedGrantTypes = GrantTypes.ClientCredentials, // secret for authentication ClientSecrets = { new Secret("secret".Sha256()) }, // scopes that client has access to AllowedScopes = { "api1" } } };
当我导航到http://localhost:5000/.well-known/openid-configuration 时,我得到的是 404 而不是发现文档。有什么想法吗?
【问题讨论】:
标签: c# asp.net-core identityserver4