我想将身份服务器 4 与一堆不同的外部身份提供者一起使用。不止一个。例如:一个企业可能将 ADFS 用于他们的 EIP,另一个将使用 AZURE 身份等等。在这种情况下,将只有一个身份服务器实例访问不同的外部 id 提供者。
这可能吗,或者有没有人试过这个。如果没有,您是否知道这样做的服务。
当然这是可能的。您可以根据需要在 Startup 类中注册任意数量的外部 IdP。请务必同时查看 Identityserver 的示例快速入门存储库。
此代码会将 AzureAd 和 Google 注册为外部 IdP。在进行此设置之前,您必须在 developer.google 和 AzureAd 中注册您的应用程序以授权您的应用程序。
app.UseOpenIdConnectAuthentication(new OpenIdConnectOptions
{
ClientId = Configuration["AzureAd:clientid"],
Authority = Configuration["AzureAd:authority"],
ClientSecret = Configuration["AzureAd:secret"],
PostLogoutRedirectUri = "/signed-out",
AuthenticationScheme = "AzureAd",
ResponseType = OpenIdConnectResponseType.CodeIdToken,
SaveToken = true,
});
app.UseGoogleAuthentication(new GoogleOptions
{
ClientId = Configuration["Google:clientid"],
ClientSecret = Configuration["Google:secret"],
AuthenticationScheme = "Google",
SaveTokens = true
});
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1136 次 |
| 最近记录: |