public void should_return_response_200_using_identity_server_with_allowed_scope() { int port = 63471; var configuration = new FileConfiguration { ReRoutes = new List <FileReRoute> { new FileReRoute { DownstreamPathTemplate = "/", DownstreamHostAndPorts = new List <FileHostAndPort> { new FileHostAndPort { Host = "localhost", Port = port, } }, DownstreamScheme = "http", UpstreamPathTemplate = "/", UpstreamHttpMethod = new List <string> { "Get" }, AuthenticationOptions = new FileAuthenticationOptions { AuthenticationProviderKey = "Test", AllowedScopes = new List <string> { "api", "api.readOnly", "openid", "offline_access" }, }, } } }; this.Given(x => x.GivenThereIsAnIdentityServerOn("http://localhost:51888", "api", AccessTokenType.Jwt)) .And(x => x.GivenThereIsAServiceRunningOn($"http://localhost:{port}", 200, "Hello from Laura")) .And(x => _steps.GivenIHaveATokenForApiReadOnlyScope("http://localhost:51888")) .And(x => _steps.GivenThereIsAConfiguration(configuration)) .And(x => _steps.GivenOcelotIsRunning(_options, "Test")) .And(x => _steps.GivenIHaveAddedATokenToMyRequest()) .When(x => _steps.WhenIGetUrlOnTheApiGateway("/")) .Then(x => _steps.ThenTheStatusCodeShouldBe(HttpStatusCode.OK)) .BDDfy(); }
public void should_return_response_200_using_identity_server_with_allowed_scope() { var configuration = new FileConfiguration { ReRoutes = new List <FileReRoute> { new FileReRoute { DownstreamPathTemplate = "/", DownstreamPort = 51876, DownstreamHost = "localhost", DownstreamScheme = "http", UpstreamPathTemplate = "/", UpstreamHttpMethod = new List <string> { "Get" }, AuthenticationOptions = new FileAuthenticationOptions { AllowedScopes = new List <string> { "api", "api.readOnly", "openid", "offline_access" }, Provider = "IdentityServer", IdentityServerConfig = new FileIdentityServerConfig { ProviderRootUrl = "http://localhost:51888", RequireHttps = false, ApiName = "api", ApiSecret = "secret" } } } } }; this.Given(x => x.GivenThereIsAnIdentityServerOn("http://localhost:51888", "api", AccessTokenType.Jwt)) .And(x => x.GivenThereIsAServiceRunningOn("http://localhost:51876", 200, "Hello from Laura")) .And(x => _steps.GivenIHaveATokenForApiReadOnlyScope("http://localhost:51888")) .And(x => _steps.GivenThereIsAConfiguration(configuration)) .And(x => _steps.GivenOcelotIsRunning()) .And(x => _steps.GivenIHaveAddedATokenToMyRequest()) .When(x => _steps.WhenIGetUrlOnTheApiGateway("/")) .Then(x => _steps.ThenTheStatusCodeShouldBe(HttpStatusCode.OK)) .BDDfy(); }