Beispiel #1
0
        public void Background()
        {
            "Given a running auth server".x(() => _fixture = new TestServerFixture(_outputHelper, BaseUrl))
            .Teardown(() => _fixture?.Dispose());

            "And the server signing keys".x(
                async() =>
            {
                var keysJson = await _fixture.Client().GetStringAsync(BaseUrl + "/jwks").ConfigureAwait(false);
                var keys     = JsonConvert.DeserializeObject <JsonWebKeySet>(keysJson);

                _jwks = keys !;
                Assert.NotEmpty(_jwks?.Keys);
            });
        }
Beispiel #2
0
        public void Background()
        {
            "Given loaded configuration values".x(
                () =>
            {
                var configuration = new ConfigurationBuilder().AddJsonFile("appsettings.json", false, false)
                                    .Build();
                ConnectionString = configuration["Db:ConnectionString"];
                OutputHelper.WriteLine(ConnectionString);
                Assert.NotNull(ConnectionString);
            });

            "Given a configured database".x(
                async() =>
            {
                ConnectionString = await DbInitializer.Init(
                    OutputHelper,
                    ConnectionString,
                    DefaultStores.Consents(),
                    DefaultStores.Users(),
                    DefaultStores.Clients(SharedContext.Instance),
                    DefaultStores.Scopes())
                                   .ConfigureAwait(false);
                var builder = new NpgsqlConnectionStringBuilder(ConnectionString);

                Assert.False(string.IsNullOrWhiteSpace(builder.SearchPath));
                OutputHelper.WriteLine(ConnectionString);
            })
            .Teardown(async() => { await DbInitializer.Drop(ConnectionString, OutputHelper).ConfigureAwait(false); });

            "and a running auth server"
            .x(() => Fixture = new TestServerFixture(OutputHelper, ConnectionString, BaseUrl))
            .Teardown(() => Fixture.Dispose());

            "And the server signing keys".x(
                async() =>
            {
                var keysJson = await Fixture.Client().GetStringAsync(BaseUrl + "/jwks").ConfigureAwait(false);
                Jwks         = new JsonWebKeySet(keysJson);

                Assert.NotEmpty(Jwks.Keys);
            });
        }
Beispiel #3
0
        public void Background()
        {
            "Given loaded configuration values".x(
                () =>
            {
                var configuration = new ConfigurationBuilder().AddJsonFile("appsettings.json", false, false).Build();
                _connectionString = configuration["Db:ConnectionString"];
                Assert.NotNull(_connectionString);
            });

            "Given a configured database".x(
                async() =>
            {
                _connectionString = await DbInitializer.Init(
                    _output,
                    _connectionString,
                    DefaultStores.Consents(),
                    DefaultStores.Users(),
                    DefaultStores.Clients(SharedContext.Instance),
                    DefaultStores.Scopes())
                                    .ConfigureAwait(false);
            })
            .Teardown(async() => { await DbInitializer.Drop(_connectionString).ConfigureAwait(false); });

            "and a running auth server".x(() => _fixture = new TestServerFixture(_output, _connectionString, BaseUrl))
            .Teardown(() => _fixture.Dispose());

            "And the server signing keys".x(
                async() =>
            {
                var keysJson = await _fixture.Client().GetStringAsync(BaseUrl + "/jwks").ConfigureAwait(false);
                _jwks        = new JsonWebKeySet(keysJson);

                Assert.NotEmpty(_jwks.Keys);
            });
        }