identityserver4 - Thinktecture Identity Server 4 和 SSO
问题描述
我正在做一个概念验证,将 OpenId Connect 引入我们的产品套件。经过多次讨论,我们决定为每个产品提供一个单独的、谨慎的 Javascript 应用程序 (Vuejs) 可能会更好,而不是将它们全部包含在一个单一的 SPA 中。
为此,我们实际上需要 Single Sign-On ("SSO")。我一直使用 IdentityServer 4 作为我们的 IDP。
RedirectUris
通过为Idp 的相关客户端配置的属性提供多个 uri,我似乎取得了一些合理的成功。因此,这两个应用程序实际上是相同的 Client。
这感觉不对,我想验证我是否正确地这样做。
这是涵盖 2 个 SPA(将涵盖所有 SPA)的客户端配置的配置。
new Client
{
ClientName = "Some App",
ClientId = "appsuiteid",
AccessTokenLifetime = 330,// 330 seconds, default 60 minutes
IdentityTokenLifetime = 300,
AllowOfflineAccess = true,
RefreshTokenUsage = TokenUsage.ReUse,
RefreshTokenExpiration = TokenExpiration.Sliding,
UpdateAccessTokenClaimsOnRefresh = true,
RequireClientSecret = false,
AllowedGrantTypes = GrantTypes.Code,
AllowAccessTokensViaBrowser = true,
RedirectUris = new List<string>
{
"http://localhost:8080/authcallback.html", <-- first 2 Uris for first SPA
"http://localhost:8080/silent-refresh.html",
"http://localhost:8090/authcallback.html", <-- second 2 Uris for second SPA
"http://localhost:8090/silent-refresh.html",
},
PostLogoutRedirectUris = new List<string>
{
"http://localhost:8080/signout-callback-oidc",
"http://localhost:8090/signout-callback-oidc",
},
AllowedCorsOrigins = new List<string>
{
$"http://localhost:8080",
$"http://localhost:8090",
},
AllowedScopes = new List<string>
{
IdentityServer4.IdentityServerConstants.StandardScopes.OpenId,
IdentityServer4.IdentityServerConstants.StandardScopes.Profile,
},
ClientSecrets = { new Secret("somepwd".Sha256())}
}
请注意,如果我为每个 SPA 配置单独的客户端,则它不起作用,因为每个 SPA 都被重定向到该客户端的不同同意页面 - 从而失去了我们需要的 SSO 特征。
对此的任何指导都会很棒。
谢谢
解决方案
推荐阅读
- reactjs - 如何在我的 React with Redux 和 KendoUI Web 应用程序中修复 DatePicker Invalid prop value of type string 错误?
- exasolution - 尽管用户具有更改表权限,但重命名表在 Exasol 中不起作用
- sql - 如何为超过 3000 万行和 250 列的表优化 Oracle 创建表功能
- rest - 如何实现消费者和生产者之间的快速和慢速工作人员之间的通信?
- android - 带有camera2库的Android应用程序在SDK19启动时崩溃
- java - 从 Switch Case 中的字母计算点数
- sql - 如果列表包含来自表 b 的另一列的子字符串,则使用表 b 中的列的值更新列表
- shell - shell 脚本中的信号量机制,用于在报告问题后停止相同的警报
- excel - 以相同的顺序/格式粘贴列中过滤数据的范围
- ssl - 让我们使用 HTTP 加密 DNS 挑战