Exemple #1
0
        public async Task RequestsAsStaticPassThrough()
        {
            _request.Path.Returns(new PathString("/static"));
            await StartupExtensions.AuthenticateSPAFilesInternal(_request, _user, _challenge, _next);

            _nextWasCalled.Should().BeTrue();
            _challengeProperties.Should().BeNull();
        }
Exemple #2
0
        public async Task NotAuthenticatedRequestsMustAuthenticate()
        {
            _request.PathBase.Returns(new PathString("/website"));
            _request.Path.Returns(new PathString("/home"));
            _request.QueryString.Returns(new QueryString("?question=answer"));
            _identity.IsAuthenticated.Returns(false);
            await StartupExtensions.AuthenticateSPAFilesInternal(_request, _user, _challenge, _next);

            _nextWasCalled.Should().BeFalse();
            _challengeProperties.Should().NotBeNull();
            _challengeProperties.RedirectUri.Should().Be("/website/home?question=answer");
        }