Я использую Identity Server 3 и использую несколько приложений angular 8 в качестве клиентов.
На стороне клиента я использую "angular -auth-oid c -client"библиотека для реализации единого входа.
У меня есть настройки ниже в 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
}