我无法以角度实现所有客户端的单点注销。我使用的代码在下面。注销功能是从角度应用程序调用并从当前应用程序注销,但它不是从所有客户端注销(其他使用相同身份服务器的角度应用程序)
请帮助我实现所有客户的退出。提前致谢
客户端的IdentityServer4配置
new Client
{
//testing logout
ClientId = "clientangularSLO",
ClientName = "Angular Client",
AllowedGrantTypes = GrantTypes.Code,
RequireClientSecret = false,
AllowedScopes = new List<string>
{
IdentityServerConstants.StandardScopes.OpenId,
IdentityServerConstants.StandardScopes.Profile,
"api1",
"roles"
},
RedirectUris = new List<string> {"http://localhost:4300"},
PostLogoutRedirectUris = new List<string> {"http://localhost:4300"},
AllowedCorsOrigins = new List<string> {"http://localhost:4300" },
RequireConsent= false,
RequirePkce = true,
AllowAccessTokensViaBrowser = true,
AllowOfflineAccess = true
}
角度 OIDC 配置
oidcConfigService.withConfig({
stsServer: 'https://localhost:4001',
redirectUrl: window.location.origin,
clientId: 'clientangularSLO',
scope: 'openid profile',
responseType: 'code',
triggerAuthorizationResultEvent: true,
postLogoutRedirectUri: `${window.location.origin}/unauthorized`,
logLevel: LogLevel.Debug,
historyCleanupOff: true,
});
角度注销代码
import { OidcSecurityService } from 'angular-auth-oidc-client';
constructor(private oidcSecurityService: OidcSecurityService, private router: Router, private route: ActivatedRoute){}
logout() {
this.oidcSecurityService.logoff();
}