public async Task when_BackchannelLogoutAllUserSessions_is_true_backchannel_logout_should_logout_all_sessions() { BffHost.BffOptions.BackchannelLogoutAllUserSessions = true; await BffHost.BffLoginAsync("alice", "sid1"); BffHost.BrowserClient.RemoveCookie("bff"); await BffHost.BffLoginAsync("alice", "sid2"); { var store = BffHost.Resolve <IUserSessionStore>(); var sessions = await store.GetUserSessionsAsync(new UserSessionsFilter { SubjectId = "alice" }); sessions.Count().Should().Be(2); } await IdentityServerHost.RevokeSessionCookieAsync(); { var store = BffHost.Resolve <IUserSessionStore>(); var sessions = await store.GetUserSessionsAsync(new UserSessionsFilter { SubjectId = "alice" }); sessions.Should().BeEmpty(); } }
public async Task backchannel_logout_endpoint_should_revoke_refreshtoken() { await BffHost.BffLoginAsync("alice", "sid123"); { var store = IdentityServerHost.Resolve <IPersistedGrantStore>(); var grants = await store.GetAllAsync(new PersistedGrantFilter { SubjectId = "alice" }); var rt = grants.Single(x => x.Type == "refresh_token"); rt.Should().NotBeNull(); } await IdentityServerHost.RevokeSessionCookieAsync(); { var store = IdentityServerHost.Resolve <IPersistedGrantStore>(); var grants = await store.GetAllAsync(new PersistedGrantFilter { SubjectId = "alice" }); var rt = grants.Should().BeEmpty(); } }
public async Task when_setting_disabled_backchannel_logout_endpoint_should_not_revoke_refreshtoken() { BffHost.BffOptions.RevokeRefreshTokenOnLogout = false; await BffHost.InitializeAsync(); await BffHost.BffLoginAsync("alice", "sid123"); { var store = IdentityServerHost.Resolve <IPersistedGrantStore>(); var grants = await store.GetAllAsync(new PersistedGrantFilter { SubjectId = "alice" }); var rt = grants.Single(x => x.Type == "refresh_token"); rt.Should().NotBeNull(); } await IdentityServerHost.RevokeSessionCookieAsync(); { var store = IdentityServerHost.Resolve <IPersistedGrantStore>(); var grants = await store.GetAllAsync(new PersistedGrantFilter { SubjectId = "alice" }); var rt = grants.Single(x => x.Type == "refresh_token"); rt.Should().NotBeNull(); } }
public async Task backchannel_logout_endpoint_should_signout() { await BffHost.BffLoginAsync("alice", "sid123"); await IdentityServerHost.RevokeSessionCookieAsync(); (await BffHost.GetIsUserLoggedInAsync()).Should().BeFalse(); }
public async Task backchannel_logout_endpoint_for_incorrect_sid_should_not_logout_user() { await BffHost.BffLoginAsync("alice", "sid123"); await IdentityServerHost.CreateIdentityServerSessionCookieAsync("alice", "sid999"); await IdentityServerHost.RevokeSessionCookieAsync(); (await BffHost.GetIsUserLoggedInAsync()).Should().BeTrue(); }