oauth-2.0 注销后身份验证服务器的行为应该如何?

1l5u6lss  于 2022-10-31  发布在  其他
关注(0)|答案(2)|浏览(154)

我正在做一个产品评估,我看到不同的实现。所以我想知道哪一个是正确的。
使用的库:manfredsteyer/angular-oauth2-oidc
示例1:
我试过和钥匙斗篷融合。
注销的行为如下:

  • 使会话令牌无效。
  • 注销idp以阻止浏览器中的任何其他SSO。

示例2:
我将我的应用程序集成到AWS Cognito。
注销的行为如下

  • 不使会话令牌无效。
  • 只要Token有效,仍允许签署。

我能问一下这些行为中哪些是正确的吗?或者它是基于我的需要吗?

ocebsuys

ocebsuys1#

Cognito有特定于供应商的注销端点,所以我认为您需要覆盖默认行为。
请参阅Step 12 of my write upcoded solution,其中解释了我是如何使用OIDC客户端库完成此操作的。
出于兴趣,您可以在this page上运行我部署的SPA。

k2arahey

k2arahey2#

我们需要手动调用Cognito注销端点。

logout() {
  // Revoke from library sessions
  this.oidcSecurityService.logoffAndRevokeTokens()
  this.oidcSecurityService.logoff();

  //set issuer url and logut url
  const stsServer = `${environment.issuer}`;
  const logoutUrl = `${window.location.origin}/`;

  //get open id configuration from cognito
  this.http.get<OpenIdConfigParams>(stsServer+"/.well-known/openid-configuration")
  .subscribe((openIdConfigParams) => {
    // call logout url with the browser redirection
    const url = openIdConfigParams.authorization_endpoint.replace("oauth2/authorize", "");
    window.location.href = url+`logout?client_id=${environment.clientId}&logout_uri=${logoutUrl}`;
  })
  return;
}

相关问题