- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
在带有身份服务器 4 的 Angular 应用中使用 facebook 登录身份验证。在注销方法时 PostLogoutRedirectUri , ClientName, LogoutId 始终为空。
private async Task<LoggedOutViewModel> BuildLoggedOutViewModelAsync(string logoutId)
{
// get context information (client name, post logout redirect URI and iframe for federated signout)
var logout = await _interaction.GetLogoutContextAsync(logoutId);
var vm = new LoggedOutViewModel
{
AutomaticRedirectAfterSignOut = AccountOptions.AutomaticRedirectAfterSignOut,
PostLogoutRedirectUri = logout?.PostLogoutRedirectUri,
ClientName = string.IsNullOrEmpty(logout?.ClientName) ? logout?.ClientId : logout?.ClientName,
SignOutIframeUrl = logout?.SignOutIFrameUrl,
LogoutId = logoutId
};
if (User?.Identity.IsAuthenticated == true)
{
var idp = User.FindFirst(JwtClaimTypes.IdentityProvider)?.Value;
if (idp != null && idp != IdentityServer4.IdentityServerConstants.LocalIdentityProvider)
{
var providerSupportsSignout = await HttpContext.GetSchemeSupportsSignOutAsync(idp);
if (providerSupportsSignout)
{
if (vm.LogoutId == null)
{
// if there's no current logout context, we need to create one
// this captures necessary info from the current logged in user
// before we signout and redirect away to the external IdP for signout
vm.LogoutId = await _interaction.CreateLogoutContextAsync();
}
vm.ExternalAuthenticationScheme = idp;
}
}
}
return vm;
}
Angular oidc 客户端代码
logout(): Promise<any> {
return this._userManager.signoutRedirect();
}
客户端设置
public IEnumerable<Client> GetClients()
{
var client = new List<Client>
{
new Client
{
ClientId = ConstantValue.ClientId,
ClientName = ConstantValue.ClientName,
AllowedGrantTypes = GrantTypes.Implicit,
AllowAccessTokensViaBrowser = true,
RequireConsent = false,
RedirectUris = { string.Format("{0}/{1}", Configuration["IdentityServerUrls:ClientUrl"], "assets/oidc-login-redirect.html"), string.Format("{0}/{1}", Configuration["IdentityServerUrls:ClientUrl"], "assets/silent-redirect.html") },
PostLogoutRedirectUris = { string.Format("{0}?{1}", Configuration["IdentityServerUrls:ClientUrl"] , "postLogout=true") },
AllowedCorsOrigins = { Configuration["IdentityServerUrls: ClientUrl"] },
AllowedScopes =
{
IdentityServerConstants.StandardScopes.OpenId,
IdentityServerConstants.StandardScopes.Profile,
ConstantValue.ClientDashApi
},
IdentityTokenLifetime=120,
AccessTokenLifetime=120
},
};
return client;
}
logoutId 始终为空。我能够成功登录到 facebook 返回回调方法。但重定向 uri 始终为空。
最佳答案
这可能不是你的问题,但当我遇到与你相同的错误时,这是我的问题,所以我在这里发布我自己的经验。
我正在观看一个 Pluralsight 视频,该视频正在使用 IdentityServer4 作为 STS 服务器构建一个 Angular 应用程序,它指示我在我的 UserManager 配置中设置 post_logout_redirect_uri strong> 在我正在构建的 AuthService 中,如下所示:
var config = {
authority: 'http://localhost:4242/',
client_id: 'spa-client',
redirect_uri: `${Constants.clientRoot}assets/oidc-login-redirect.html`,
scope: 'openid projects-api profile',
response_type: 'id_token token',
post_logout_redirect_uri: `${Constants.clientRoot}`,
userStore: new WebStorageStateStore({ store: window.localStorage })
}
this._userManager = new UserManager(config);
github 仓库中的一个老问题 https://github.com/IdentityServer/IdentityServer4/issues/396讨论了现在自动设置并且不需要显式设置的事实(请参阅线程的末尾)。一旦我从配置中删除它,我就不再遇到 AccountController 的 Logout 方法中 logoutId 为空的问题:
/// <summary>
/// Show logout page
/// </summary>
[HttpGet]
public async Task<IActionResult> Logout(string logoutId)
所以这对我来说是正确的配置设置:
var config = {
authority: 'http://localhost:4242/',
client_id: 'spa-client',
redirect_uri: `${Constants.clientRoot}assets/oidc-login-redirect.html`,
scope: 'openid projects-api profile',
response_type: 'id_token token',
userStore: new WebStorageStateStore({ store: window.localStorage })
}
this._userManager = new UserManager(config);
关于asp.net - PostLogoutRedirectUri 在带有 SPA 的身份服务器 4 中始终为空(Angular 7 OIDC 客户端),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53824770/
正在复制的问题是,当sew呈现登录页面时,然后我们继续执行身份验证,现在将我们重定向到网站的仪表板,此时我们继续关闭会话,并且在之前的交互中生成的这些cookie没有被删除。这个问题是重复性的,并且一
我遇到了与这篇文章中相同的错误。 flask-oidc-client-exchange-error 虽然我想要一个解决该问题的答案,但我认为主要问题是没有维护 flask-oidc 库,并且它使用已弃
我正在使用带有 angular 7 的 oidc-client,并且我想启用日志记录。该文档建议我可以执行以下操作 Oidc.Log.logger = console; 我无法完成这项工作,因为 Oi
我在安装 go 时遇到了 k8s-oidc-helper 包的问题。但是,当我用它运行任何命令时,它会给出命令未找到错误。我在 ubuntu 16.04 VM 上运行它。我该如何解决这个问题? 最佳答
我正在编写一个react+flux应用程序,并且我已经将IdentityServer设置为OpenID Connect提供程序。 IdentityServer 人员提供了两个库,使处理客户端变得更加容
当我在 docker compose 中使用 Quarkus 和 Keycloak 时,我遇到了一个非常令人困惑的问题。当我设置环境变量以覆盖开发配置又名 quarkus.oidc.auth-serv
前言 前面选用了IdentityServer4做为认证授权的基础框架,感兴趣的可以看上篇<微服务下认证授权框架的探讨>,已经初步完成了authorization-code与implici
我有一个使用 redux-oidc 对身份服务器进行身份验证的设置。我可以登录,并且可以看到 silenRenew 在 token 过期时按预期工作。 不过有一个问题。如果我打开我的网站并让计算机进入
我试图在一个简单的 flask 应用程序中使用 Flask-oidc,以便通过 keycloak 添加身份验证。 但是,一旦我使用有效凭据登录,它就会返回到不存在的/oidc_callback。 fl
我正在使用 oidc JS cilent 库 OIDC JS 我有连接到 的客户端代码WSO2 IDP 服务器使用 openID 连接端点。流程是 隐式 在 WSO2 服务器上配置 WSO2 版本:w
我正在使用 angular-oauth2-oidc 在我的 Angular (8) 应用程序上设置 B2C。 我有一个登录和退出策略,并且我已经成功地设置了 angular-oauth2-oidc 服
我的 React 容器如下所示: class App extends React.Component { componentDidMount() { if (this.prop
我有一个使用 AAD B2C 保护的 SPA。 SPA 与同样受 AAD B2C 保护的 API 进行对话。现在,用户可以将授权 header 从 Chrome 复制/粘贴到 Postman 等工具,
我正在运行 IdentityServer4 的 Javascript 客户端示例,配置如下所示: var config = { authority: "https://localhost:44
我已经为 OIDC 设置了一个注册应用程序,并将其配置为在 Azure AD 上用于各种用途。 我集成的应用程序使用 preferred_username在 ID token 中用于各种事物。 Azu
我一直在将 keycloak 配置为 Kubernetes 集群上 eclipse hono 的身份验证和授权服务提供程序(使用 Rancher)。 文档对此几乎没有提供任何帮助,并且关于此主题的每项
我已经为 OIDC 设置了一个注册应用程序,并将其配置为在 Azure AD 上用于各种用途。 我集成的应用程序使用 preferred_username在 ID token 中用于各种事物。 Azu
我有一个 asp.net 核心应用程序,上面运行着一个 angular 2。我正在使用 oidc-client.js 库来处理登录。目前,如果用户已经登录并点击站点链接,则身份验证会正确进行,用户会被
无法使用 go 安装包。我想安装 k8s-oidc-helper 包。根据安装指南,我必须安装并运行 k8s-oidc-helper 命令。但是当我尝试它时,它说找不到命令 k8s-oidc-help
我的理解是 - oidc-client 生成随机数和状态并将其发送到授权服务器(身份服务器 4)。用于防止CSRF攻击、重放攻击。 State 和 nonce 通过下面的 signinredirect
我是一名优秀的程序员,十分优秀!