繁体   English   中英

IdentityServer4配置问题

[英]IdentityServer4 Configuration Issue

我正在将IdentityServer4添加到.net core 2.1应用程序中,并且在注销时遇到问题,这使我遇到了总体结构问题。

从所有示例中,我可以发现客户端具有与其选项不同的RedirectUris和PostLogoutRedirectUris端口.Authority是。

例如,我的父亲是:

public static IEnumerable<Client> GetClients()
    {
        return new List<Client> {
            new Client {
                ClientId = "oauthClient",
                ClientName = "Example Client Credentials Client Application",
                AllowedGrantTypes = GrantTypes.ClientCredentials,
                ClientSecrets = new List<Secret> {
                        new Secret("superSecretPassword".Sha256())},
                    AllowedScopes = new List<string> {"customAPI.read"}
                },
            new Client {
                ClientId = "openIdConnectClient",
                ClientName = "Example Implicit Client Application",
                AllowedGrantTypes = GrantTypes.Implicit,
                AllowedScopes = new List<string>
                {
                    IdentityServerConstants.StandardScopes.OpenId,
                    IdentityServerConstants.StandardScopes.Profile,
                    IdentityServerConstants.StandardScopes.Email,
                    "role",
                    "customAPI.write"
                },
                RedirectUris = new List<string> {"http://localhost:5000/signin-oidc"},
                PostLogoutRedirectUris = new List<string> {"http://localhost:5000"}
            }
        };
    }

并且我的IdentityServer被设置为

services.AddAuthentication(options =>
            {
                options.DefaultScheme = "cookie";
                options.DefaultChallengeScheme = "oidc";
            })
            .AddCookie("cookie")
            .AddOpenIdConnect("oidc", options =>
            {
                options.RequireHttpsMetadata = false;
                options.Authority = "http://localhost:5000/";
                options.ClientId = "openIdConnectClient";
                options.SignInScheme = "cookie";
            });

认为这是错误的,但是我不确定在设置options.Authority = "http://localhost:5001/";options.Authority = "http://localhost:5001/"; 我认为应该从示例中做些什么,但是我得到了例外。

这可能是一个愚蠢的问题,但是我可以仅使用1个主机使用IdentityServer4,还是需要两个?

我在理解您的问题时遇到了一些麻烦,但是我会尽力而为。

您可以在同一主机上配置身份服务器和与身份服务器一起使用的项目。

话虽如此,这实际上取决于您的意图。 例如,如果客户端应用程序关闭,身份服务器是否应该可用?

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM