예제 #1
0
        public async Task When_Expose_Two_Scopes_Then_DiscoveryDocument_Is_Correct()
        {
            const string firstScopeName      = "firstScopeName";
            const string secondScopeName     = "secondScopeName";
            const string notExposedScopeName = "notExposedScopeName";
            var          scopes = new[]
            {
                new Scope {
                    IsExposed = true, Name = firstScopeName
                },
                new Scope {
                    IsExposed = true, Name = secondScopeName
                },
                new Scope {
                    IsExposed = false, Name = secondScopeName
                }
            };

            _scopeRepositoryStub.Setup(s => s.GetAll(It.IsAny <CancellationToken>())).ReturnsAsync(scopes);

            var discoveryInformation = await _createDiscoveryDocumentationAction
                                       .CreateDiscoveryInformation("http://test", CancellationToken.None)
                                       .ConfigureAwait(false);

            Assert.Equal(2, discoveryInformation.ScopesSupported.Length);
            Assert.Contains(firstScopeName, discoveryInformation.ScopesSupported);
            Assert.Contains(secondScopeName, discoveryInformation.ScopesSupported);
            Assert.DoesNotContain(notExposedScopeName, discoveryInformation.ScopesSupported);
        }
예제 #2
0
        public async Task <DiscoveryInformation> Get(CancellationToken cancellationToken)
        {
            var issuer = Request.GetAbsoluteUriWithVirtualPath();
            var result = await _discoveryActions.CreateDiscoveryInformation(issuer, cancellationToken).ConfigureAwait(false);

            return(result);
        }