mirror of
https://github.com/nsnail/Ocelot.git
synced 2025-04-22 06:22:50 +08:00
Fixing tests
This commit is contained in:
parent
461ef6aa52
commit
20f6ebac2f
@ -7,6 +7,7 @@ namespace Ocelot.Configuration.File
|
|||||||
public FileAuthenticationOptions()
|
public FileAuthenticationOptions()
|
||||||
{
|
{
|
||||||
AllowedScopes = new List<string>();
|
AllowedScopes = new List<string>();
|
||||||
|
IdentityServerConfig = new FileIdentityServerConfig();
|
||||||
}
|
}
|
||||||
|
|
||||||
public string Provider { get; set; }
|
public string Provider { get; set; }
|
||||||
|
@ -34,241 +34,213 @@ namespace Ocelot.AcceptanceTests
|
|||||||
_steps = new Steps();
|
_steps = new Steps();
|
||||||
}
|
}
|
||||||
|
|
||||||
//[Fact]
|
[Fact]
|
||||||
//public void should_return_401_using_identity_server_access_token()
|
public void should_return_401_using_identity_server_access_token()
|
||||||
//{
|
{
|
||||||
// var configuration = new FileConfiguration
|
var configuration = new FileConfiguration
|
||||||
// {
|
{
|
||||||
// ReRoutes = new List<FileReRoute>
|
ReRoutes = new List<FileReRoute>
|
||||||
// {
|
{
|
||||||
// new FileReRoute
|
new FileReRoute
|
||||||
// {
|
{
|
||||||
// DownstreamPathTemplate = _downstreamServicePath,
|
DownstreamPathTemplate = _downstreamServicePath,
|
||||||
// DownstreamPort = _downstreamServicePort,
|
DownstreamPort = _downstreamServicePort,
|
||||||
// DownstreamHost = _downstreamServiceHost,
|
DownstreamHost = _downstreamServiceHost,
|
||||||
// DownstreamScheme = _downstreamServiceScheme,
|
DownstreamScheme = _downstreamServiceScheme,
|
||||||
// UpstreamPathTemplate = "/",
|
UpstreamPathTemplate = "/",
|
||||||
// UpstreamHttpMethod = new List<string> { "Post" },
|
UpstreamHttpMethod = new List<string> { "Post" },
|
||||||
// AuthenticationOptions = new FileAuthenticationOptions
|
AuthenticationOptions = new FileAuthenticationOptions
|
||||||
// {
|
{
|
||||||
// AllowedScopes = new List<string>(),
|
AllowedScopes = new List<string>(),
|
||||||
// Provider = "IdentityServer",
|
Provider = "IdentityServer",
|
||||||
// ProviderRootUrl = _identityServerRootUrl,
|
IdentityServerConfig = new FileIdentityServerConfig{
|
||||||
// RequireHttps = false,
|
ProviderRootUrl = _identityServerRootUrl,
|
||||||
// ApiName = "api",
|
RequireHttps = false,
|
||||||
// ApiSecret = "secret"
|
ApiName = "api",
|
||||||
// }
|
ApiSecret = "secret"
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
// };
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
// this.Given(x => x.GivenThereIsAnIdentityServerOn(_identityServerRootUrl, "api", "api2", AccessTokenType.Jwt))
|
this.Given(x => x.GivenThereIsAnIdentityServerOn(_identityServerRootUrl, "api", "api2", AccessTokenType.Jwt))
|
||||||
// .And(x => x.GivenThereIsAServiceRunningOn(_downstreamServiceUrl, 201, string.Empty))
|
.And(x => x.GivenThereIsAServiceRunningOn(_downstreamServiceUrl, 201, string.Empty))
|
||||||
// .And(x => _steps.GivenThereIsAConfiguration(configuration))
|
.And(x => _steps.GivenThereIsAConfiguration(configuration))
|
||||||
// .And(x => _steps.GivenOcelotIsRunning())
|
.And(x => _steps.GivenOcelotIsRunning())
|
||||||
// .And(x => _steps.GivenThePostHasContent("postContent"))
|
.And(x => _steps.GivenThePostHasContent("postContent"))
|
||||||
// .When(x => _steps.WhenIPostUrlOnTheApiGateway("/"))
|
.When(x => _steps.WhenIPostUrlOnTheApiGateway("/"))
|
||||||
// .Then(x => _steps.ThenTheStatusCodeShouldBe(HttpStatusCode.Unauthorized))
|
.Then(x => _steps.ThenTheStatusCodeShouldBe(HttpStatusCode.Unauthorized))
|
||||||
// .BDDfy();
|
.BDDfy();
|
||||||
//}
|
}
|
||||||
|
|
||||||
//[Fact]
|
[Fact]
|
||||||
//public void should_return_401_using_identity_server_reference_token()
|
public void should_return_response_200_using_identity_server()
|
||||||
//{
|
{
|
||||||
// var configuration = new FileConfiguration
|
var configuration = new FileConfiguration
|
||||||
// {
|
{
|
||||||
// ReRoutes = new List<FileReRoute>
|
ReRoutes = new List<FileReRoute>
|
||||||
// {
|
{
|
||||||
// new FileReRoute
|
new FileReRoute
|
||||||
// {
|
{
|
||||||
// DownstreamPathTemplate = _downstreamServicePath,
|
DownstreamPathTemplate = _downstreamServicePath,
|
||||||
// DownstreamPort = _downstreamServicePort,
|
DownstreamPort = _downstreamServicePort,
|
||||||
// DownstreamHost = _downstreamServiceHost,
|
DownstreamHost = _downstreamServiceHost,
|
||||||
// DownstreamScheme = _downstreamServiceScheme,
|
DownstreamScheme = _downstreamServiceScheme,
|
||||||
// UpstreamPathTemplate = "/",
|
UpstreamPathTemplate = "/",
|
||||||
// UpstreamHttpMethod = new List<string> { "Post" },
|
UpstreamHttpMethod = new List<string> { "Get" },
|
||||||
// AuthenticationOptions = new FileAuthenticationOptions
|
AuthenticationOptions = new FileAuthenticationOptions
|
||||||
// {
|
{
|
||||||
// AllowedScopes = new List<string>(),
|
AllowedScopes = new List<string>(),
|
||||||
// Provider = "IdentityServer",
|
Provider = "IdentityServer",
|
||||||
// ProviderRootUrl = _identityServerRootUrl,
|
IdentityServerConfig = new FileIdentityServerConfig{
|
||||||
// RequireHttps = false,
|
ProviderRootUrl = _identityServerRootUrl,
|
||||||
// ApiName = "api",
|
RequireHttps = false,
|
||||||
// ApiSecret = "secret"
|
ApiName = "api",
|
||||||
// }
|
ApiSecret = "secret"
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
// };
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
// this.Given(x => x.GivenThereIsAnIdentityServerOn(_identityServerRootUrl, "api", "api2", AccessTokenType.Reference))
|
this.Given(x => x.GivenThereIsAnIdentityServerOn(_identityServerRootUrl, "api", "api2", AccessTokenType.Jwt))
|
||||||
// .And(x => x.GivenThereIsAServiceRunningOn(_downstreamServiceUrl, 201, string.Empty))
|
.And(x => x.GivenThereIsAServiceRunningOn(_downstreamServiceUrl, 200, "Hello from Laura"))
|
||||||
// .And(x => _steps.GivenThereIsAConfiguration(configuration))
|
.And(x => _steps.GivenIHaveAToken(_identityServerRootUrl))
|
||||||
// .And(x => _steps.GivenOcelotIsRunning())
|
.And(x => _steps.GivenThereIsAConfiguration(configuration))
|
||||||
// .And(x => _steps.GivenThePostHasContent("postContent"))
|
.And(x => _steps.GivenOcelotIsRunning())
|
||||||
// .When(x => _steps.WhenIPostUrlOnTheApiGateway("/"))
|
.And(x => _steps.GivenIHaveAddedATokenToMyRequest())
|
||||||
// .Then(x => _steps.ThenTheStatusCodeShouldBe(HttpStatusCode.Unauthorized))
|
.When(x => _steps.WhenIGetUrlOnTheApiGateway("/"))
|
||||||
// .BDDfy();
|
.Then(x => _steps.ThenTheStatusCodeShouldBe(HttpStatusCode.OK))
|
||||||
//}
|
.And(x => _steps.ThenTheResponseBodyShouldBe("Hello from Laura"))
|
||||||
|
.BDDfy();
|
||||||
|
}
|
||||||
|
|
||||||
//[Fact]
|
[Fact]
|
||||||
//public void should_return_response_200_using_identity_server()
|
public void should_return_response_401_using_identity_server_with_token_requested_for_other_api()
|
||||||
//{
|
{
|
||||||
// var configuration = new FileConfiguration
|
var configuration = new FileConfiguration
|
||||||
// {
|
{
|
||||||
// ReRoutes = new List<FileReRoute>
|
ReRoutes = new List<FileReRoute>
|
||||||
// {
|
{
|
||||||
// new FileReRoute
|
new FileReRoute
|
||||||
// {
|
{
|
||||||
// DownstreamPathTemplate = _downstreamServicePath,
|
DownstreamPathTemplate = _downstreamServicePath,
|
||||||
// DownstreamPort = _downstreamServicePort,
|
DownstreamPort = _downstreamServicePort,
|
||||||
// DownstreamHost = _downstreamServiceHost,
|
DownstreamHost = _downstreamServiceHost,
|
||||||
// DownstreamScheme = _downstreamServiceScheme,
|
DownstreamScheme = _downstreamServiceScheme,
|
||||||
// UpstreamPathTemplate = "/",
|
UpstreamPathTemplate = "/",
|
||||||
// UpstreamHttpMethod = new List<string> { "Get" },
|
UpstreamHttpMethod = new List<string> { "Get" },
|
||||||
// AuthenticationOptions = new FileAuthenticationOptions
|
AuthenticationOptions = new FileAuthenticationOptions
|
||||||
// {
|
{
|
||||||
// AllowedScopes = new List<string>(),
|
AllowedScopes = new List<string>(),
|
||||||
// Provider = "IdentityServer",
|
Provider = "IdentityServer",
|
||||||
// ProviderRootUrl = _identityServerRootUrl,
|
IdentityServerConfig = new FileIdentityServerConfig{
|
||||||
// RequireHttps = false,
|
ProviderRootUrl = _identityServerRootUrl,
|
||||||
// ApiName = "api",
|
RequireHttps = false,
|
||||||
// ApiSecret = "secret"
|
ApiName = "api",
|
||||||
// }
|
ApiSecret = "secret"
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
// };
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
// this.Given(x => x.GivenThereIsAnIdentityServerOn(_identityServerRootUrl, "api", "api2", AccessTokenType.Jwt))
|
this.Given(x => x.GivenThereIsAnIdentityServerOn(_identityServerRootUrl, "api", "api2", AccessTokenType.Jwt))
|
||||||
// .And(x => x.GivenThereIsAServiceRunningOn(_downstreamServiceUrl, 200, "Hello from Laura"))
|
.And(x => x.GivenThereIsAServiceRunningOn(_downstreamServiceUrl, 200, "Hello from Laura"))
|
||||||
// .And(x => _steps.GivenIHaveAToken(_identityServerRootUrl))
|
.And(x => _steps.GivenIHaveATokenForApi2(_identityServerRootUrl))
|
||||||
// .And(x => _steps.GivenThereIsAConfiguration(configuration))
|
.And(x => _steps.GivenThereIsAConfiguration(configuration))
|
||||||
// .And(x => _steps.GivenOcelotIsRunning())
|
.And(x => _steps.GivenOcelotIsRunning())
|
||||||
// .And(x => _steps.GivenIHaveAddedATokenToMyRequest())
|
.And(x => _steps.GivenIHaveAddedATokenToMyRequest())
|
||||||
// .When(x => _steps.WhenIGetUrlOnTheApiGateway("/"))
|
.When(x => _steps.WhenIGetUrlOnTheApiGateway("/"))
|
||||||
// .Then(x => _steps.ThenTheStatusCodeShouldBe(HttpStatusCode.OK))
|
.Then(x => _steps.ThenTheStatusCodeShouldBe(HttpStatusCode.Unauthorized))
|
||||||
// .And(x => _steps.ThenTheResponseBodyShouldBe("Hello from Laura"))
|
.BDDfy();
|
||||||
// .BDDfy();
|
}
|
||||||
//}
|
|
||||||
|
|
||||||
//[Fact]
|
[Fact]
|
||||||
//public void should_return_response_401_using_identity_server_with_token_requested_for_other_api()
|
public void should_return_201_using_identity_server_access_token()
|
||||||
//{
|
{
|
||||||
// var configuration = new FileConfiguration
|
var configuration = new FileConfiguration
|
||||||
// {
|
{
|
||||||
// ReRoutes = new List<FileReRoute>
|
ReRoutes = new List<FileReRoute>
|
||||||
// {
|
{
|
||||||
// new FileReRoute
|
new FileReRoute
|
||||||
// {
|
{
|
||||||
// DownstreamPathTemplate = _downstreamServicePath,
|
DownstreamPathTemplate = _downstreamServicePath,
|
||||||
// DownstreamPort = _downstreamServicePort,
|
DownstreamPort = _downstreamServicePort,
|
||||||
// DownstreamHost = _downstreamServiceHost,
|
DownstreamHost = _downstreamServiceHost,
|
||||||
// DownstreamScheme = _downstreamServiceScheme,
|
DownstreamScheme = _downstreamServiceScheme,
|
||||||
// UpstreamPathTemplate = "/",
|
UpstreamPathTemplate = "/",
|
||||||
// UpstreamHttpMethod = new List<string> { "Get" },
|
UpstreamHttpMethod = new List<string> { "Post" },
|
||||||
// AuthenticationOptions = new FileAuthenticationOptions
|
|
||||||
// {
|
|
||||||
// AllowedScopes = new List<string>(),
|
|
||||||
// Provider = "IdentityServer",
|
|
||||||
// ProviderRootUrl = _identityServerRootUrl,
|
|
||||||
// RequireHttps = false,
|
|
||||||
// ApiName = "api",
|
|
||||||
// ApiSecret = "secret"
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// };
|
|
||||||
|
|
||||||
// this.Given(x => x.GivenThereIsAnIdentityServerOn(_identityServerRootUrl, "api", "api2", AccessTokenType.Jwt))
|
AuthenticationOptions = new FileAuthenticationOptions
|
||||||
// .And(x => x.GivenThereIsAServiceRunningOn(_downstreamServiceUrl, 200, "Hello from Laura"))
|
{
|
||||||
// .And(x => _steps.GivenIHaveATokenForApi2(_identityServerRootUrl))
|
AllowedScopes = new List<string>(),
|
||||||
// .And(x => _steps.GivenThereIsAConfiguration(configuration))
|
Provider = "IdentityServer",
|
||||||
// .And(x => _steps.GivenOcelotIsRunning())
|
IdentityServerConfig = new FileIdentityServerConfig{
|
||||||
// .And(x => _steps.GivenIHaveAddedATokenToMyRequest())
|
ProviderRootUrl = _identityServerRootUrl,
|
||||||
// .When(x => _steps.WhenIGetUrlOnTheApiGateway("/"))
|
RequireHttps = false,
|
||||||
// .Then(x => _steps.ThenTheStatusCodeShouldBe(HttpStatusCode.Unauthorized))
|
ApiName = "api",
|
||||||
// .BDDfy();
|
ApiSecret = "secret"
|
||||||
//}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
//[Fact]
|
this.Given(x => x.GivenThereIsAnIdentityServerOn(_identityServerRootUrl, "api", "api2", AccessTokenType.Jwt))
|
||||||
//public void should_return_201_using_identity_server_access_token()
|
.And(x => x.GivenThereIsAServiceRunningOn(_downstreamServiceUrl, 201, string.Empty))
|
||||||
//{
|
.And(x => _steps.GivenIHaveAToken(_identityServerRootUrl))
|
||||||
// var configuration = new FileConfiguration
|
.And(x => _steps.GivenThereIsAConfiguration(configuration))
|
||||||
// {
|
.And(x => _steps.GivenOcelotIsRunning())
|
||||||
// ReRoutes = new List<FileReRoute>
|
.And(x => _steps.GivenIHaveAddedATokenToMyRequest())
|
||||||
// {
|
.And(x => _steps.GivenThePostHasContent("postContent"))
|
||||||
// new FileReRoute
|
.When(x => _steps.WhenIPostUrlOnTheApiGateway("/"))
|
||||||
// {
|
.Then(x => _steps.ThenTheStatusCodeShouldBe(HttpStatusCode.Created))
|
||||||
// DownstreamPathTemplate = _downstreamServicePath,
|
.BDDfy();
|
||||||
// DownstreamPort = _downstreamServicePort,
|
}
|
||||||
// DownstreamHost = _downstreamServiceHost,
|
|
||||||
// DownstreamScheme = _downstreamServiceScheme,
|
|
||||||
// UpstreamPathTemplate = "/",
|
|
||||||
// UpstreamHttpMethod = new List<string> { "Post" },
|
|
||||||
|
|
||||||
// AuthenticationOptions = new FileAuthenticationOptions
|
[Fact]
|
||||||
// {
|
public void should_return_201_using_identity_server_reference_token()
|
||||||
// AllowedScopes = new List<string>(),
|
{
|
||||||
// Provider = "IdentityServer",
|
var configuration = new FileConfiguration
|
||||||
// ProviderRootUrl = _identityServerRootUrl,
|
{
|
||||||
// RequireHttps = false,
|
ReRoutes = new List<FileReRoute>
|
||||||
// ApiName = "api",
|
{
|
||||||
// ApiSecret = "secret"
|
new FileReRoute
|
||||||
// }
|
{
|
||||||
// }
|
DownstreamPathTemplate = _downstreamServicePath,
|
||||||
// }
|
DownstreamPort = _downstreamServicePort,
|
||||||
// };
|
DownstreamHost = _downstreamServiceHost,
|
||||||
|
DownstreamScheme = _downstreamServiceScheme,
|
||||||
|
UpstreamPathTemplate = "/",
|
||||||
|
UpstreamHttpMethod = new List<string> { "Post" },
|
||||||
|
AuthenticationOptions = new FileAuthenticationOptions
|
||||||
|
{
|
||||||
|
AllowedScopes = new List<string>(),
|
||||||
|
Provider = "IdentityServer",
|
||||||
|
IdentityServerConfig = new FileIdentityServerConfig{
|
||||||
|
ProviderRootUrl = _identityServerRootUrl,
|
||||||
|
RequireHttps = false,
|
||||||
|
ApiName = "api",
|
||||||
|
ApiSecret = "secret"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
// this.Given(x => x.GivenThereIsAnIdentityServerOn(_identityServerRootUrl, "api", "api2", AccessTokenType.Jwt))
|
this.Given(x => x.GivenThereIsAnIdentityServerOn(_identityServerRootUrl, "api", "api2", AccessTokenType.Reference))
|
||||||
// .And(x => x.GivenThereIsAServiceRunningOn(_downstreamServiceUrl, 201, string.Empty))
|
.And(x => x.GivenThereIsAServiceRunningOn(_downstreamServiceUrl, 201, string.Empty))
|
||||||
// .And(x => _steps.GivenIHaveAToken(_identityServerRootUrl))
|
.And(x => _steps.GivenIHaveAToken(_identityServerRootUrl))
|
||||||
// .And(x => _steps.GivenThereIsAConfiguration(configuration))
|
.And(x => _steps.GivenThereIsAConfiguration(configuration))
|
||||||
// .And(x => _steps.GivenOcelotIsRunning())
|
.And(x => _steps.GivenOcelotIsRunning())
|
||||||
// .And(x => _steps.GivenIHaveAddedATokenToMyRequest())
|
.And(x => _steps.GivenIHaveAddedATokenToMyRequest())
|
||||||
// .And(x => _steps.GivenThePostHasContent("postContent"))
|
.And(x => _steps.GivenThePostHasContent("postContent"))
|
||||||
// .When(x => _steps.WhenIPostUrlOnTheApiGateway("/"))
|
.When(x => _steps.WhenIPostUrlOnTheApiGateway("/"))
|
||||||
// .Then(x => _steps.ThenTheStatusCodeShouldBe(HttpStatusCode.Created))
|
.Then(x => _steps.ThenTheStatusCodeShouldBe(HttpStatusCode.Created))
|
||||||
// .BDDfy();
|
.BDDfy();
|
||||||
//}
|
}
|
||||||
|
|
||||||
//[Fact]
|
|
||||||
//public void should_return_201_using_identity_server_reference_token()
|
|
||||||
//{
|
|
||||||
// var configuration = new FileConfiguration
|
|
||||||
// {
|
|
||||||
// ReRoutes = new List<FileReRoute>
|
|
||||||
// {
|
|
||||||
// new FileReRoute
|
|
||||||
// {
|
|
||||||
// DownstreamPathTemplate = _downstreamServicePath,
|
|
||||||
// DownstreamPort = _downstreamServicePort,
|
|
||||||
// DownstreamHost = _downstreamServiceHost,
|
|
||||||
// DownstreamScheme = _downstreamServiceScheme,
|
|
||||||
// UpstreamPathTemplate = "/",
|
|
||||||
// UpstreamHttpMethod = new List<string> { "Post" },
|
|
||||||
// AuthenticationOptions = new FileAuthenticationOptions
|
|
||||||
// {
|
|
||||||
// AllowedScopes = new List<string>(),
|
|
||||||
// Provider = "IdentityServer",
|
|
||||||
// ProviderRootUrl = _identityServerRootUrl,
|
|
||||||
// RequireHttps = false,
|
|
||||||
// ApiName = "api",
|
|
||||||
// ApiSecret = "secret"
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// };
|
|
||||||
|
|
||||||
// this.Given(x => x.GivenThereIsAnIdentityServerOn(_identityServerRootUrl, "api", "api2", AccessTokenType.Reference))
|
|
||||||
// .And(x => x.GivenThereIsAServiceRunningOn(_downstreamServiceUrl, 201, string.Empty))
|
|
||||||
// .And(x => _steps.GivenIHaveAToken(_identityServerRootUrl))
|
|
||||||
// .And(x => _steps.GivenThereIsAConfiguration(configuration))
|
|
||||||
// .And(x => _steps.GivenOcelotIsRunning())
|
|
||||||
// .And(x => _steps.GivenIHaveAddedATokenToMyRequest())
|
|
||||||
// .And(x => _steps.GivenThePostHasContent("postContent"))
|
|
||||||
// .When(x => _steps.WhenIPostUrlOnTheApiGateway("/"))
|
|
||||||
// .Then(x => _steps.ThenTheStatusCodeShouldBe(HttpStatusCode.Created))
|
|
||||||
// .BDDfy();
|
|
||||||
//}
|
|
||||||
|
|
||||||
private void GivenThereIsAServiceRunningOn(string url, int statusCode, string responseBody)
|
private void GivenThereIsAServiceRunningOn(string url, int statusCode, string responseBody)
|
||||||
{
|
{
|
||||||
|
@ -28,195 +28,203 @@ namespace Ocelot.AcceptanceTests
|
|||||||
_steps = new Steps();
|
_steps = new Steps();
|
||||||
}
|
}
|
||||||
|
|
||||||
//[Fact]
|
[Fact]
|
||||||
//public void should_return_response_200_authorising_route()
|
public void should_return_response_200_authorising_route()
|
||||||
//{
|
{
|
||||||
// var configuration = new FileConfiguration
|
var configuration = new FileConfiguration
|
||||||
// {
|
{
|
||||||
// ReRoutes = new List<FileReRoute>
|
ReRoutes = new List<FileReRoute>
|
||||||
// {
|
{
|
||||||
// new FileReRoute
|
new FileReRoute
|
||||||
// {
|
{
|
||||||
// DownstreamPathTemplate = "/",
|
DownstreamPathTemplate = "/",
|
||||||
// DownstreamPort = 51876,
|
DownstreamPort = 51876,
|
||||||
// DownstreamScheme = "http",
|
DownstreamScheme = "http",
|
||||||
// DownstreamHost = "localhost",
|
DownstreamHost = "localhost",
|
||||||
// UpstreamPathTemplate = "/",
|
UpstreamPathTemplate = "/",
|
||||||
// UpstreamHttpMethod = new List<string> { "Get" },
|
UpstreamHttpMethod = new List<string> { "Get" },
|
||||||
// AuthenticationOptions = new FileAuthenticationOptions
|
AuthenticationOptions = new FileAuthenticationOptions
|
||||||
// {
|
{
|
||||||
//AllowedScopes = new List<string>(),
|
AllowedScopes = new List<string>(),
|
||||||
// Provider = "IdentityServer",
|
Provider = "IdentityServer",
|
||||||
// ProviderRootUrl = "http://localhost:51888",
|
IdentityServerConfig = new FileIdentityServerConfig{
|
||||||
// RequireHttps = false,
|
ProviderRootUrl = "http://localhost:51888",
|
||||||
//ApiName = "api",
|
RequireHttps = false,
|
||||||
// ApiSecret = "secret"
|
ApiName = "api",
|
||||||
// },
|
ApiSecret = "secret"
|
||||||
// AddHeadersToRequest =
|
}
|
||||||
// {
|
},
|
||||||
// {"CustomerId", "Claims[CustomerId] > value"},
|
AddHeadersToRequest =
|
||||||
// {"LocationId", "Claims[LocationId] > value"},
|
{
|
||||||
// {"UserType", "Claims[sub] > value[0] > |"},
|
{"CustomerId", "Claims[CustomerId] > value"},
|
||||||
// {"UserId", "Claims[sub] > value[1] > |"}
|
{"LocationId", "Claims[LocationId] > value"},
|
||||||
// },
|
{"UserType", "Claims[sub] > value[0] > |"},
|
||||||
// AddClaimsToRequest =
|
{"UserId", "Claims[sub] > value[1] > |"}
|
||||||
// {
|
},
|
||||||
// {"CustomerId", "Claims[CustomerId] > value"},
|
AddClaimsToRequest =
|
||||||
// {"UserType", "Claims[sub] > value[0] > |"},
|
{
|
||||||
// {"UserId", "Claims[sub] > value[1] > |"}
|
{"CustomerId", "Claims[CustomerId] > value"},
|
||||||
// },
|
{"UserType", "Claims[sub] > value[0] > |"},
|
||||||
// RouteClaimsRequirement =
|
{"UserId", "Claims[sub] > value[1] > |"}
|
||||||
// {
|
},
|
||||||
// {"UserType", "registered"}
|
RouteClaimsRequirement =
|
||||||
// }
|
{
|
||||||
// }
|
{"UserType", "registered"}
|
||||||
// }
|
}
|
||||||
// };
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
// this.Given(x => x.GivenThereIsAnIdentityServerOn("http://localhost:51888", "api", AccessTokenType.Jwt))
|
this.Given(x => x.GivenThereIsAnIdentityServerOn("http://localhost:51888", "api", AccessTokenType.Jwt))
|
||||||
// .And(x => x.GivenThereIsAServiceRunningOn("http://localhost:51876", 200, "Hello from Laura"))
|
.And(x => x.GivenThereIsAServiceRunningOn("http://localhost:51876", 200, "Hello from Laura"))
|
||||||
// .And(x => _steps.GivenIHaveAToken("http://localhost:51888"))
|
.And(x => _steps.GivenIHaveAToken("http://localhost:51888"))
|
||||||
// .And(x => _steps.GivenThereIsAConfiguration(configuration))
|
.And(x => _steps.GivenThereIsAConfiguration(configuration))
|
||||||
// .And(x => _steps.GivenOcelotIsRunning())
|
.And(x => _steps.GivenOcelotIsRunning())
|
||||||
// .And(x => _steps.GivenIHaveAddedATokenToMyRequest())
|
.And(x => _steps.GivenIHaveAddedATokenToMyRequest())
|
||||||
// .When(x => _steps.WhenIGetUrlOnTheApiGateway("/"))
|
.When(x => _steps.WhenIGetUrlOnTheApiGateway("/"))
|
||||||
// .Then(x => _steps.ThenTheStatusCodeShouldBe(HttpStatusCode.OK))
|
.Then(x => _steps.ThenTheStatusCodeShouldBe(HttpStatusCode.OK))
|
||||||
// .And(x => _steps.ThenTheResponseBodyShouldBe("Hello from Laura"))
|
.And(x => _steps.ThenTheResponseBodyShouldBe("Hello from Laura"))
|
||||||
// .BDDfy();
|
.BDDfy();
|
||||||
//}
|
}
|
||||||
|
|
||||||
//[Fact]
|
[Fact]
|
||||||
//public void should_return_response_403_authorising_route()
|
public void should_return_response_403_authorising_route()
|
||||||
//{
|
{
|
||||||
// var configuration = new FileConfiguration
|
var configuration = new FileConfiguration
|
||||||
// {
|
{
|
||||||
// ReRoutes = new List<FileReRoute>
|
ReRoutes = new List<FileReRoute>
|
||||||
// {
|
{
|
||||||
// new FileReRoute
|
new FileReRoute
|
||||||
// {
|
{
|
||||||
// DownstreamPathTemplate = "/",
|
DownstreamPathTemplate = "/",
|
||||||
// DownstreamPort = 51876,
|
DownstreamPort = 51876,
|
||||||
// DownstreamScheme = "http",
|
DownstreamScheme = "http",
|
||||||
// DownstreamHost = "localhost",
|
DownstreamHost = "localhost",
|
||||||
// UpstreamPathTemplate = "/",
|
UpstreamPathTemplate = "/",
|
||||||
// UpstreamHttpMethod = new List<string> { "Get" },
|
UpstreamHttpMethod = new List<string> { "Get" },
|
||||||
// AuthenticationOptions = new FileAuthenticationOptions
|
AuthenticationOptions = new FileAuthenticationOptions
|
||||||
// {
|
{
|
||||||
//AllowedScopes = new List<string>(),
|
AllowedScopes = new List<string>(),
|
||||||
// Provider = "IdentityServer",
|
Provider = "IdentityServer",
|
||||||
// ProviderRootUrl = "http://localhost:51888",
|
IdentityServerConfig = new FileIdentityServerConfig{
|
||||||
// RequireHttps = false,
|
ProviderRootUrl = "http://localhost:51888",
|
||||||
//ApiName = "api",
|
RequireHttps = false,
|
||||||
// ApiSecret = "secret"
|
ApiName = "api",
|
||||||
// },
|
ApiSecret = "secret"
|
||||||
// AddHeadersToRequest =
|
}
|
||||||
// {
|
},
|
||||||
// {"CustomerId", "Claims[CustomerId] > value"},
|
AddHeadersToRequest =
|
||||||
// {"LocationId", "Claims[LocationId] > value"},
|
{
|
||||||
// {"UserType", "Claims[sub] > value[0] > |"},
|
{"CustomerId", "Claims[CustomerId] > value"},
|
||||||
// {"UserId", "Claims[sub] > value[1] > |"}
|
{"LocationId", "Claims[LocationId] > value"},
|
||||||
// },
|
{"UserType", "Claims[sub] > value[0] > |"},
|
||||||
// AddClaimsToRequest =
|
{"UserId", "Claims[sub] > value[1] > |"}
|
||||||
// {
|
},
|
||||||
// {"CustomerId", "Claims[CustomerId] > value"},
|
AddClaimsToRequest =
|
||||||
// {"UserId", "Claims[sub] > value[1] > |"}
|
{
|
||||||
// },
|
{"CustomerId", "Claims[CustomerId] > value"},
|
||||||
// RouteClaimsRequirement =
|
{"UserId", "Claims[sub] > value[1] > |"}
|
||||||
// {
|
},
|
||||||
// {"UserType", "registered"}
|
RouteClaimsRequirement =
|
||||||
// }
|
{
|
||||||
// }
|
{"UserType", "registered"}
|
||||||
// }
|
}
|
||||||
// };
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
// this.Given(x => x.GivenThereIsAnIdentityServerOn("http://localhost:51888", "api", AccessTokenType.Jwt))
|
this.Given(x => x.GivenThereIsAnIdentityServerOn("http://localhost:51888", "api", AccessTokenType.Jwt))
|
||||||
// .And(x => x.GivenThereIsAServiceRunningOn("http://localhost:51876", 200, "Hello from Laura"))
|
.And(x => x.GivenThereIsAServiceRunningOn("http://localhost:51876", 200, "Hello from Laura"))
|
||||||
// .And(x => _steps.GivenIHaveAToken("http://localhost:51888"))
|
.And(x => _steps.GivenIHaveAToken("http://localhost:51888"))
|
||||||
// .And(x => _steps.GivenThereIsAConfiguration(configuration))
|
.And(x => _steps.GivenThereIsAConfiguration(configuration))
|
||||||
// .And(x => _steps.GivenOcelotIsRunning())
|
.And(x => _steps.GivenOcelotIsRunning())
|
||||||
// .And(x => _steps.GivenIHaveAddedATokenToMyRequest())
|
.And(x => _steps.GivenIHaveAddedATokenToMyRequest())
|
||||||
// .When(x => _steps.WhenIGetUrlOnTheApiGateway("/"))
|
.When(x => _steps.WhenIGetUrlOnTheApiGateway("/"))
|
||||||
// .Then(x => _steps.ThenTheStatusCodeShouldBe(HttpStatusCode.Forbidden))
|
.Then(x => _steps.ThenTheStatusCodeShouldBe(HttpStatusCode.Forbidden))
|
||||||
// .BDDfy();
|
.BDDfy();
|
||||||
//}
|
}
|
||||||
|
|
||||||
//[Fact]
|
[Fact]
|
||||||
//public void should_return_response_200_using_identity_server_with_allowed_scope()
|
public void should_return_response_200_using_identity_server_with_allowed_scope()
|
||||||
//{
|
{
|
||||||
// var configuration = new FileConfiguration
|
var configuration = new FileConfiguration
|
||||||
// {
|
{
|
||||||
// ReRoutes = new List<FileReRoute>
|
ReRoutes = new List<FileReRoute>
|
||||||
// {
|
{
|
||||||
// new FileReRoute
|
new FileReRoute
|
||||||
// {
|
{
|
||||||
// DownstreamPathTemplate = "/",
|
DownstreamPathTemplate = "/",
|
||||||
// DownstreamPort = 51876,
|
DownstreamPort = 51876,
|
||||||
// DownstreamHost = "localhost",
|
DownstreamHost = "localhost",
|
||||||
// DownstreamScheme = "http",
|
DownstreamScheme = "http",
|
||||||
// UpstreamPathTemplate = "/",
|
UpstreamPathTemplate = "/",
|
||||||
// UpstreamHttpMethod = new List<string> { "Get" },
|
UpstreamHttpMethod = new List<string> { "Get" },
|
||||||
// AuthenticationOptions = new FileAuthenticationOptions
|
AuthenticationOptions = new FileAuthenticationOptions
|
||||||
// {
|
{
|
||||||
// AllowedScopes = new List<string>{ "api", "api.readOnly", "openid", "offline_access" },
|
AllowedScopes = new List<string>{ "api", "api.readOnly", "openid", "offline_access" },
|
||||||
// Provider = "IdentityServer",
|
Provider = "IdentityServer",
|
||||||
// ProviderRootUrl = "http://localhost:51888",
|
IdentityServerConfig = new FileIdentityServerConfig{
|
||||||
// RequireHttps = false,
|
ProviderRootUrl = "http://localhost:51888",
|
||||||
// ApiName = "api",
|
RequireHttps = false,
|
||||||
// ApiSecret = "secret"
|
ApiName = "api",
|
||||||
// }
|
ApiSecret = "secret"
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
// };
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
// this.Given(x => x.GivenThereIsAnIdentityServerOn("http://localhost:51888", "api", AccessTokenType.Jwt))
|
this.Given(x => x.GivenThereIsAnIdentityServerOn("http://localhost:51888", "api", AccessTokenType.Jwt))
|
||||||
// .And(x => x.GivenThereIsAServiceRunningOn("http://localhost:51876", 200, "Hello from Laura"))
|
.And(x => x.GivenThereIsAServiceRunningOn("http://localhost:51876", 200, "Hello from Laura"))
|
||||||
// .And(x => _steps.GivenIHaveATokenForApiReadOnlyScope("http://localhost:51888"))
|
.And(x => _steps.GivenIHaveATokenForApiReadOnlyScope("http://localhost:51888"))
|
||||||
// .And(x => _steps.GivenThereIsAConfiguration(configuration))
|
.And(x => _steps.GivenThereIsAConfiguration(configuration))
|
||||||
// .And(x => _steps.GivenOcelotIsRunning())
|
.And(x => _steps.GivenOcelotIsRunning())
|
||||||
// .And(x => _steps.GivenIHaveAddedATokenToMyRequest())
|
.And(x => _steps.GivenIHaveAddedATokenToMyRequest())
|
||||||
// .When(x => _steps.WhenIGetUrlOnTheApiGateway("/"))
|
.When(x => _steps.WhenIGetUrlOnTheApiGateway("/"))
|
||||||
// .Then(x => _steps.ThenTheStatusCodeShouldBe(HttpStatusCode.OK))
|
.Then(x => _steps.ThenTheStatusCodeShouldBe(HttpStatusCode.OK))
|
||||||
// .BDDfy();
|
.BDDfy();
|
||||||
//}
|
}
|
||||||
|
|
||||||
//[Fact]
|
[Fact]
|
||||||
//public void should_return_response_403_using_identity_server_with_scope_not_allowed()
|
public void should_return_response_403_using_identity_server_with_scope_not_allowed()
|
||||||
//{
|
{
|
||||||
// var configuration = new FileConfiguration
|
var configuration = new FileConfiguration
|
||||||
// {
|
{
|
||||||
// ReRoutes = new List<FileReRoute>
|
ReRoutes = new List<FileReRoute>
|
||||||
// {
|
{
|
||||||
// new FileReRoute
|
new FileReRoute
|
||||||
// {
|
{
|
||||||
// DownstreamPathTemplate = "/",
|
DownstreamPathTemplate = "/",
|
||||||
// DownstreamPort = 51876,
|
DownstreamPort = 51876,
|
||||||
// DownstreamHost = "localhost",
|
DownstreamHost = "localhost",
|
||||||
// DownstreamScheme = "http",
|
DownstreamScheme = "http",
|
||||||
// UpstreamPathTemplate = "/",
|
UpstreamPathTemplate = "/",
|
||||||
// UpstreamHttpMethod = new List<string> { "Get" },
|
UpstreamHttpMethod = new List<string> { "Get" },
|
||||||
// AuthenticationOptions = new FileAuthenticationOptions
|
AuthenticationOptions = new FileAuthenticationOptions
|
||||||
// {
|
{
|
||||||
// AllowedScopes = new List<string>{ "api", "openid", "offline_access" },
|
AllowedScopes = new List<string>{ "api", "openid", "offline_access" },
|
||||||
// Provider = "IdentityServer",
|
Provider = "IdentityServer",
|
||||||
// ProviderRootUrl = "http://localhost:51888",
|
IdentityServerConfig = new FileIdentityServerConfig{
|
||||||
// RequireHttps = false,
|
ProviderRootUrl = "http://localhost:51888",
|
||||||
// ApiName = "api",
|
RequireHttps = false,
|
||||||
// ApiSecret = "secret"
|
ApiName = "api",
|
||||||
// }
|
ApiSecret = "secret"
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
// };
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
// this.Given(x => x.GivenThereIsAnIdentityServerOn("http://localhost:51888", "api", AccessTokenType.Jwt))
|
this.Given(x => x.GivenThereIsAnIdentityServerOn("http://localhost:51888", "api", AccessTokenType.Jwt))
|
||||||
// .And(x => x.GivenThereIsAServiceRunningOn("http://localhost:51876", 200, "Hello from Laura"))
|
.And(x => x.GivenThereIsAServiceRunningOn("http://localhost:51876", 200, "Hello from Laura"))
|
||||||
// .And(x => _steps.GivenIHaveATokenForApiReadOnlyScope("http://localhost:51888"))
|
.And(x => _steps.GivenIHaveATokenForApiReadOnlyScope("http://localhost:51888"))
|
||||||
// .And(x => _steps.GivenThereIsAConfiguration(configuration))
|
.And(x => _steps.GivenThereIsAConfiguration(configuration))
|
||||||
// .And(x => _steps.GivenOcelotIsRunning())
|
.And(x => _steps.GivenOcelotIsRunning())
|
||||||
// .And(x => _steps.GivenIHaveAddedATokenToMyRequest())
|
.And(x => _steps.GivenIHaveAddedATokenToMyRequest())
|
||||||
// .When(x => _steps.WhenIGetUrlOnTheApiGateway("/"))
|
.When(x => _steps.WhenIGetUrlOnTheApiGateway("/"))
|
||||||
// .Then(x => _steps.ThenTheStatusCodeShouldBe(HttpStatusCode.Forbidden))
|
.Then(x => _steps.ThenTheStatusCodeShouldBe(HttpStatusCode.Forbidden))
|
||||||
// .BDDfy();
|
.BDDfy();
|
||||||
//}
|
}
|
||||||
|
|
||||||
private void GivenThereIsAServiceRunningOn(string url, int statusCode, string responseBody)
|
private void GivenThereIsAServiceRunningOn(string url, int statusCode, string responseBody)
|
||||||
{
|
{
|
||||||
|
@ -30,67 +30,69 @@ namespace Ocelot.AcceptanceTests
|
|||||||
_steps = new Steps();
|
_steps = new Steps();
|
||||||
}
|
}
|
||||||
|
|
||||||
//[Fact]
|
[Fact]
|
||||||
//public void should_return_response_200_and_foward_claim_as_header()
|
public void should_return_response_200_and_foward_claim_as_header()
|
||||||
//{
|
{
|
||||||
// var user = new TestUser()
|
var user = new TestUser()
|
||||||
// {
|
{
|
||||||
// Username = "test",
|
Username = "test",
|
||||||
// Password = "test",
|
Password = "test",
|
||||||
// SubjectId = "registered|1231231",
|
SubjectId = "registered|1231231",
|
||||||
// Claims = new List<Claim>
|
Claims = new List<Claim>
|
||||||
// {
|
{
|
||||||
// new Claim("CustomerId", "123"),
|
new Claim("CustomerId", "123"),
|
||||||
// new Claim("LocationId", "1")
|
new Claim("LocationId", "1")
|
||||||
// }
|
}
|
||||||
// };
|
};
|
||||||
|
|
||||||
// var configuration = new FileConfiguration
|
var configuration = new FileConfiguration
|
||||||
// {
|
{
|
||||||
// ReRoutes = new List<FileReRoute>
|
ReRoutes = new List<FileReRoute>
|
||||||
// {
|
{
|
||||||
// new FileReRoute
|
new FileReRoute
|
||||||
// {
|
{
|
||||||
// DownstreamPathTemplate = "/",
|
DownstreamPathTemplate = "/",
|
||||||
// DownstreamPort = 52876,
|
DownstreamPort = 52876,
|
||||||
// DownstreamScheme = "http",
|
DownstreamScheme = "http",
|
||||||
// DownstreamHost = "localhost",
|
DownstreamHost = "localhost",
|
||||||
// UpstreamPathTemplate = "/",
|
UpstreamPathTemplate = "/",
|
||||||
// UpstreamHttpMethod = new List<string> { "Get" },
|
UpstreamHttpMethod = new List<string> { "Get" },
|
||||||
// AuthenticationOptions = new FileAuthenticationOptions
|
AuthenticationOptions = new FileAuthenticationOptions
|
||||||
// {
|
{
|
||||||
//AllowedScopes = new List<string>
|
AllowedScopes = new List<string>
|
||||||
// {
|
{
|
||||||
// "openid", "offline_access", "api"
|
"openid", "offline_access", "api"
|
||||||
// },
|
},
|
||||||
// Provider = "IdentityServer",
|
Provider = "IdentityServer",
|
||||||
// ProviderRootUrl = "http://localhost:52888",
|
IdentityServerConfig = new FileIdentityServerConfig{
|
||||||
// RequireHttps = false,
|
ProviderRootUrl = "http://localhost:52888",
|
||||||
//ApiName = "api",
|
RequireHttps = false,
|
||||||
// ApiSecret = "secret",
|
ApiName = "api",
|
||||||
// },
|
ApiSecret = "secret"
|
||||||
// AddHeadersToRequest =
|
}
|
||||||
// {
|
},
|
||||||
// {"CustomerId", "Claims[CustomerId] > value"},
|
AddHeadersToRequest =
|
||||||
// {"LocationId", "Claims[LocationId] > value"},
|
{
|
||||||
// {"UserType", "Claims[sub] > value[0] > |"},
|
{"CustomerId", "Claims[CustomerId] > value"},
|
||||||
// {"UserId", "Claims[sub] > value[1] > |"}
|
{"LocationId", "Claims[LocationId] > value"},
|
||||||
// }
|
{"UserType", "Claims[sub] > value[0] > |"},
|
||||||
// }
|
{"UserId", "Claims[sub] > value[1] > |"}
|
||||||
// }
|
}
|
||||||
// };
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
// this.Given(x => x.GivenThereIsAnIdentityServerOn("http://localhost:52888", "api", AccessTokenType.Jwt, user))
|
this.Given(x => x.GivenThereIsAnIdentityServerOn("http://localhost:52888", "api", AccessTokenType.Jwt, user))
|
||||||
// .And(x => x.GivenThereIsAServiceRunningOn("http://localhost:52876", 200))
|
.And(x => x.GivenThereIsAServiceRunningOn("http://localhost:52876", 200))
|
||||||
// .And(x => _steps.GivenIHaveAToken("http://localhost:52888"))
|
.And(x => _steps.GivenIHaveAToken("http://localhost:52888"))
|
||||||
// .And(x => _steps.GivenThereIsAConfiguration(configuration))
|
.And(x => _steps.GivenThereIsAConfiguration(configuration))
|
||||||
// .And(x => _steps.GivenOcelotIsRunning())
|
.And(x => _steps.GivenOcelotIsRunning())
|
||||||
// .And(x => _steps.GivenIHaveAddedATokenToMyRequest())
|
.And(x => _steps.GivenIHaveAddedATokenToMyRequest())
|
||||||
// .When(x => _steps.WhenIGetUrlOnTheApiGateway("/"))
|
.When(x => _steps.WhenIGetUrlOnTheApiGateway("/"))
|
||||||
// .Then(x => _steps.ThenTheStatusCodeShouldBe(HttpStatusCode.OK))
|
.Then(x => _steps.ThenTheStatusCodeShouldBe(HttpStatusCode.OK))
|
||||||
// .And(x => _steps.ThenTheResponseBodyShouldBe("CustomerId: 123 LocationId: 1 UserType: registered UserId: 1231231"))
|
.And(x => _steps.ThenTheResponseBodyShouldBe("CustomerId: 123 LocationId: 1 UserType: registered UserId: 1231231"))
|
||||||
// .BDDfy();
|
.BDDfy();
|
||||||
//}
|
}
|
||||||
|
|
||||||
private void GivenThereIsAServiceRunningOn(string url, int statusCode)
|
private void GivenThereIsAServiceRunningOn(string url, int statusCode)
|
||||||
{
|
{
|
||||||
|
@ -30,67 +30,69 @@ namespace Ocelot.AcceptanceTests
|
|||||||
_steps = new Steps();
|
_steps = new Steps();
|
||||||
}
|
}
|
||||||
|
|
||||||
//[Fact]
|
[Fact]
|
||||||
//public void should_return_response_200_and_foward_claim_as_query_string()
|
public void should_return_response_200_and_foward_claim_as_query_string()
|
||||||
//{
|
{
|
||||||
// var user = new TestUser()
|
var user = new TestUser()
|
||||||
// {
|
{
|
||||||
// Username = "test",
|
Username = "test",
|
||||||
// Password = "test",
|
Password = "test",
|
||||||
// SubjectId = "registered|1231231",
|
SubjectId = "registered|1231231",
|
||||||
// Claims = new List<Claim>
|
Claims = new List<Claim>
|
||||||
// {
|
{
|
||||||
// new Claim("CustomerId", "123"),
|
new Claim("CustomerId", "123"),
|
||||||
// new Claim("LocationId", "1")
|
new Claim("LocationId", "1")
|
||||||
// }
|
}
|
||||||
// };
|
};
|
||||||
|
|
||||||
// var configuration = new FileConfiguration
|
var configuration = new FileConfiguration
|
||||||
// {
|
{
|
||||||
// ReRoutes = new List<FileReRoute>
|
ReRoutes = new List<FileReRoute>
|
||||||
// {
|
{
|
||||||
// new FileReRoute
|
new FileReRoute
|
||||||
// {
|
{
|
||||||
// DownstreamPathTemplate = "/",
|
DownstreamPathTemplate = "/",
|
||||||
// DownstreamPort = 57876,
|
DownstreamPort = 57876,
|
||||||
// DownstreamScheme = "http",
|
DownstreamScheme = "http",
|
||||||
// DownstreamHost = "localhost",
|
DownstreamHost = "localhost",
|
||||||
// UpstreamPathTemplate = "/",
|
UpstreamPathTemplate = "/",
|
||||||
// UpstreamHttpMethod = new List<string> { "Get" },
|
UpstreamHttpMethod = new List<string> { "Get" },
|
||||||
// AuthenticationOptions = new FileAuthenticationOptions
|
AuthenticationOptions = new FileAuthenticationOptions
|
||||||
// {
|
{
|
||||||
//AllowedScopes = new List<string>
|
AllowedScopes = new List<string>
|
||||||
// {
|
{
|
||||||
// "openid", "offline_access", "api"
|
"openid", "offline_access", "api"
|
||||||
// },
|
},
|
||||||
// Provider = "IdentityServer",
|
Provider = "IdentityServer",
|
||||||
// ProviderRootUrl = "http://localhost:57888",
|
IdentityServerConfig = new FileIdentityServerConfig{
|
||||||
// RequireHttps = false,
|
ProviderRootUrl = "http://localhost:57888",
|
||||||
//ApiName = "api",
|
RequireHttps = false,
|
||||||
// ApiSecret = "secret",
|
ApiName = "api",
|
||||||
// },
|
ApiSecret = "secret"
|
||||||
// AddQueriesToRequest =
|
}
|
||||||
// {
|
},
|
||||||
// {"CustomerId", "Claims[CustomerId] > value"},
|
AddQueriesToRequest =
|
||||||
// {"LocationId", "Claims[LocationId] > value"},
|
{
|
||||||
// {"UserType", "Claims[sub] > value[0] > |"},
|
{"CustomerId", "Claims[CustomerId] > value"},
|
||||||
// {"UserId", "Claims[sub] > value[1] > |"}
|
{"LocationId", "Claims[LocationId] > value"},
|
||||||
// }
|
{"UserType", "Claims[sub] > value[0] > |"},
|
||||||
// }
|
{"UserId", "Claims[sub] > value[1] > |"}
|
||||||
// }
|
}
|
||||||
// };
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
// this.Given(x => x.GivenThereIsAnIdentityServerOn("http://localhost:57888", "api", AccessTokenType.Jwt, user))
|
this.Given(x => x.GivenThereIsAnIdentityServerOn("http://localhost:57888", "api", AccessTokenType.Jwt, user))
|
||||||
// .And(x => x.GivenThereIsAServiceRunningOn("http://localhost:57876", 200))
|
.And(x => x.GivenThereIsAServiceRunningOn("http://localhost:57876", 200))
|
||||||
// .And(x => _steps.GivenIHaveAToken("http://localhost:57888"))
|
.And(x => _steps.GivenIHaveAToken("http://localhost:57888"))
|
||||||
// .And(x => _steps.GivenThereIsAConfiguration(configuration))
|
.And(x => _steps.GivenThereIsAConfiguration(configuration))
|
||||||
// .And(x => _steps.GivenOcelotIsRunning())
|
.And(x => _steps.GivenOcelotIsRunning())
|
||||||
// .And(x => _steps.GivenIHaveAddedATokenToMyRequest())
|
.And(x => _steps.GivenIHaveAddedATokenToMyRequest())
|
||||||
// .When(x => _steps.WhenIGetUrlOnTheApiGateway("/"))
|
.When(x => _steps.WhenIGetUrlOnTheApiGateway("/"))
|
||||||
// .Then(x => _steps.ThenTheStatusCodeShouldBe(HttpStatusCode.OK))
|
.Then(x => _steps.ThenTheStatusCodeShouldBe(HttpStatusCode.OK))
|
||||||
// .And(x => _steps.ThenTheResponseBodyShouldBe("CustomerId: 123 LocationId: 1 UserType: registered UserId: 1231231"))
|
.And(x => _steps.ThenTheResponseBodyShouldBe("CustomerId: 123 LocationId: 1 UserType: registered UserId: 1231231"))
|
||||||
// .BDDfy();
|
.BDDfy();
|
||||||
//}
|
}
|
||||||
|
|
||||||
private void GivenThereIsAServiceRunningOn(string url, int statusCode)
|
private void GivenThereIsAServiceRunningOn(string url, int statusCode)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user