Beispiel #1
0
        public async Task when_setting_disabled_logout_should_not_revoke_refreshtoken()
        {
            BffHost.BffOptions.RevokeRefreshTokenOnLogout = false;
            await BffHost.InitializeAsync();

            await BffHost.BffLoginAsync("alice", "sid");

            {
                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 BffHost.BffLogoutAsync("sid");

            {
                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();
            }
        }
Beispiel #2
0
        public async Task logout_should_revoke_refreshtoken()
        {
            await BffHost.BffLoginAsync("alice", "sid");

            {
                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 BffHost.BffLogoutAsync("sid");

            {
                var store  = IdentityServerHost.Resolve <IPersistedGrantStore>();
                var grants = await store.GetAllAsync(new PersistedGrantFilter
                {
                    SubjectId = "alice"
                });

                grants.Should().BeEmpty();
            }
        }
Beispiel #3
0
        public async Task logout_endpoint_should_signout()
        {
            await BffHost.BffLoginAsync("alice", "sid123");

            await BffHost.BffLogoutAsync("sid123");

            (await BffHost.GetIsUserLoggedInAsync()).Should().BeFalse();
        }
Beispiel #4
0
        public async Task logout_endpoint_should_redirect_to_external_signout_and_return_to_root()
        {
            await BffHost.BffLoginAsync("alice", "sid123");

            await BffHost.BffLogoutAsync("sid123");

            BffHost.BrowserClient.CurrentUri.ToString().ToLowerInvariant().Should().Be(BffHost.Url("/"));
            (await BffHost.GetIsUserLoggedInAsync()).Should().BeFalse();
        }
Beispiel #5
0
        public async Task logout_endpoint_for_authenticated_should_require_sid()
        {
            await BffHost.BffLoginAsync("alice", "sid123");

            Func <Task> f = () => BffHost.BffLogoutAsync();

            f.Should().Throw <Exception>();

            (await BffHost.GetIsUserLoggedInAsync()).Should().BeTrue();
        }