1

我正在使用 Identity Server 3 并有多个 angular 8 应用程序作为客户端。

在客户端,我使用“ angular-auth-oidc-client ”库来实现 SSO。

我在 app.module 中有以下配置。

在此处输入图像描述

onCheckSessionChanged从未触发......即使从同一浏览器的其他选项卡注销..。

在此处输入图像描述

下面是我的注销代码。

this.oidcSecurityService.logoff()

身份服务器配置:

public static void UseIdentityServerCustomStoreSetup(this IAppBuilder app)
        {
            app.Map("/Identity", idApp =>
            {

                var EventsOptions = new EventsOptions()
                {
                    RaiseErrorEvents = true,
                    RaiseFailureEvents = true,
                    RaiseInformationEvents = true,
                    RaiseSuccessEvents = true
                };


                var defaultViewServiceOptions = new DefaultViewServiceOptions();
                defaultViewServiceOptions.CacheViews = false;


                var Factory = new IdentityServerServiceFactory()
                .UseInMemoryClients(Clients.Get())
                .UseInMemoryScopes(Scopes.Get());

                Factory.UserService = new Registration<IUserService, UserManagementService>();

                Factory.ConfigureDefaultViewService(defaultViewServiceOptions);
                var cust = new CustomeValidator();
                Factory.CustomRequestValidator = new Registration<ICustomRequestValidator, CustomeValidator>();
                var option = new IdentityServerOptions()
                {
                    SiteName = "",
                    LoggingOptions = GetFullLoggingConfig(),
                    EventsOptions = EventsOptions,
                    Factory = Factory,
                    RequireSsl = false,
                    EnableWelcomePage = false,
                    SigningCertificate = LoadCertificate()
                };

                option.AuthenticationOptions = new IdentityServer3.Core.Configuration.AuthenticationOptions
                {
                    EnablePostSignOutAutoRedirect = true,
                    RequireSignOutPrompt = false,


                    CookieOptions = new IdentityServer3.Core.Configuration.CookieOptions
                    {
                        AllowRememberMe = true,
                        IsPersistent = false,
                        RememberMeDuration = TimeSpan.FromMinutes(24),

                    },
                    EnableSignOutPrompt = false
                    ,
                    PostSignOutAutoRedirectDelay = 0,
                    EnableLoginHint = true

                };

                idApp.UseIdentityServer(option);

            });

            Serilog.Log.Logger =
                new LoggerConfiguration().MinimumLevel.Debug()
                    .WriteTo.File(@"c:\logs\IdSvrAdmin-{Date}.log")
                    .CreateLogger();
            //  app.UseResourceAuthorization(new AuthorizationManager()); // for authorization
        }

身份服务器中的客户端配置

new Client
            {
                Enabled = true,
                ClientName = "UMS Client",
                ClientId = "UMSClient",
                 AccessTokenType = AccessTokenType.Reference,
                Flow = Flows.Implicit,
                ClientSecrets = new List<Secret> { new Secret { Value= "clientsecret@weave.com" } },
                RequireConsent = false,
                RedirectUris = new List<string>
                {
                    Urls.LIVE_URL+"3001"
                },
                AllowedCorsOrigins = new List<string>
                {
                    Urls.LIVE_URL+"3001"
                },
                // Valid URLs after logging out
                PostLogoutRedirectUris = new List<string>
                {
                    Urls.LIVE_URL+"3001"
                },

                AllowAccessToAllScopes = true,
                AccessTokenLifetime = Clients.TimeOut
            }
4

0 回答 0