mirror of
https://github.com/nsnail/Ocelot.git
synced 2025-06-19 17:48:15 +08:00
auth options builders
This commit is contained in:
@ -47,7 +47,7 @@ namespace Ocelot.AcceptanceTests
|
||||
DownstreamPort = _downstreamServicePort,
|
||||
DownstreamHost = _downstreamServiceHost,
|
||||
DownstreamScheme = _downstreamServiceScheme,
|
||||
UpstreamTemplate = "/",
|
||||
UpstreamPathTemplate = "/",
|
||||
UpstreamHttpMethod = "Post",
|
||||
AuthenticationOptions = new FileAuthenticationOptions
|
||||
{
|
||||
@ -85,7 +85,7 @@ namespace Ocelot.AcceptanceTests
|
||||
DownstreamPort = _downstreamServicePort,
|
||||
DownstreamHost = _downstreamServiceHost,
|
||||
DownstreamScheme = _downstreamServiceScheme,
|
||||
UpstreamTemplate = "/",
|
||||
UpstreamPathTemplate = "/",
|
||||
UpstreamHttpMethod = "Post",
|
||||
AuthenticationOptions = new FileAuthenticationOptions
|
||||
{
|
||||
@ -123,7 +123,7 @@ namespace Ocelot.AcceptanceTests
|
||||
DownstreamPort = _downstreamServicePort,
|
||||
DownstreamHost = _downstreamServiceHost,
|
||||
DownstreamScheme = _downstreamServiceScheme,
|
||||
UpstreamTemplate = "/",
|
||||
UpstreamPathTemplate = "/",
|
||||
UpstreamHttpMethod = "Get",
|
||||
AuthenticationOptions = new FileAuthenticationOptions
|
||||
{
|
||||
@ -163,7 +163,7 @@ namespace Ocelot.AcceptanceTests
|
||||
DownstreamPort = _downstreamServicePort,
|
||||
DownstreamHost = _downstreamServiceHost,
|
||||
DownstreamScheme = _downstreamServiceScheme,
|
||||
UpstreamTemplate = "/",
|
||||
UpstreamPathTemplate = "/",
|
||||
UpstreamHttpMethod = "Post",
|
||||
AuthenticationOptions = new FileAuthenticationOptions
|
||||
{
|
||||
@ -203,7 +203,7 @@ namespace Ocelot.AcceptanceTests
|
||||
DownstreamPort = _downstreamServicePort,
|
||||
DownstreamHost = _downstreamServiceHost,
|
||||
DownstreamScheme = _downstreamServiceScheme,
|
||||
UpstreamTemplate = "/",
|
||||
UpstreamPathTemplate = "/",
|
||||
UpstreamHttpMethod = "Post",
|
||||
AuthenticationOptions = new FileAuthenticationOptions
|
||||
{
|
||||
|
@ -41,7 +41,7 @@ namespace Ocelot.AcceptanceTests
|
||||
DownstreamPort = 51876,
|
||||
DownstreamScheme = "http",
|
||||
DownstreamHost = "localhost",
|
||||
UpstreamTemplate = "/",
|
||||
UpstreamPathTemplate = "/",
|
||||
UpstreamHttpMethod = "Get",
|
||||
AuthenticationOptions = new FileAuthenticationOptions
|
||||
{
|
||||
@ -98,7 +98,7 @@ namespace Ocelot.AcceptanceTests
|
||||
DownstreamPort = 51876,
|
||||
DownstreamScheme = "http",
|
||||
DownstreamHost = "localhost",
|
||||
UpstreamTemplate = "/",
|
||||
UpstreamPathTemplate = "/",
|
||||
UpstreamHttpMethod = "Get",
|
||||
AuthenticationOptions = new FileAuthenticationOptions
|
||||
{
|
||||
|
@ -35,7 +35,7 @@ namespace Ocelot.AcceptanceTests
|
||||
DownstreamPort = 51879,
|
||||
DownstreamScheme = "http",
|
||||
DownstreamHost = "localhost",
|
||||
UpstreamTemplate = "/",
|
||||
UpstreamPathTemplate = "/",
|
||||
UpstreamHttpMethod = "Get",
|
||||
FileCacheOptions = new FileCacheOptions
|
||||
{
|
||||
@ -71,7 +71,7 @@ namespace Ocelot.AcceptanceTests
|
||||
DownstreamPort = 51879,
|
||||
DownstreamScheme = "http",
|
||||
DownstreamHost = "localhost",
|
||||
UpstreamTemplate = "/",
|
||||
UpstreamPathTemplate = "/",
|
||||
UpstreamHttpMethod = "Get",
|
||||
FileCacheOptions = new FileCacheOptions
|
||||
{
|
||||
|
@ -34,7 +34,7 @@ namespace Ocelot.AcceptanceTests
|
||||
DownstreamPort = 51879,
|
||||
DownstreamScheme = "http",
|
||||
DownstreamHost = "localhost",
|
||||
UpstreamTemplate = "/products/{productId}",
|
||||
UpstreamPathTemplate = "/products/{productId}",
|
||||
UpstreamHttpMethod = "Get"
|
||||
}
|
||||
}
|
||||
@ -61,7 +61,7 @@ namespace Ocelot.AcceptanceTests
|
||||
DownstreamPort = 51879,
|
||||
DownstreamScheme = "http",
|
||||
DownstreamHost = "localhost",
|
||||
UpstreamTemplate = "/products/{productId}",
|
||||
UpstreamPathTemplate = "/products/{productId}",
|
||||
UpstreamHttpMethod = "Get",
|
||||
ReRouteIsCaseSensitive = false
|
||||
}
|
||||
@ -89,7 +89,7 @@ namespace Ocelot.AcceptanceTests
|
||||
DownstreamPort = 51879,
|
||||
DownstreamScheme = "http",
|
||||
DownstreamHost = "localhost",
|
||||
UpstreamTemplate = "/products/{productId}",
|
||||
UpstreamPathTemplate = "/products/{productId}",
|
||||
UpstreamHttpMethod = "Get",
|
||||
ReRouteIsCaseSensitive = true
|
||||
}
|
||||
@ -117,7 +117,7 @@ namespace Ocelot.AcceptanceTests
|
||||
DownstreamPort = 51879,
|
||||
DownstreamScheme = "http",
|
||||
DownstreamHost = "localhost",
|
||||
UpstreamTemplate = "/PRODUCTS/{productId}",
|
||||
UpstreamPathTemplate = "/PRODUCTS/{productId}",
|
||||
UpstreamHttpMethod = "Get",
|
||||
ReRouteIsCaseSensitive = true
|
||||
}
|
||||
@ -145,7 +145,7 @@ namespace Ocelot.AcceptanceTests
|
||||
DownstreamPort = 51879,
|
||||
DownstreamScheme = "http",
|
||||
DownstreamHost = "localhost",
|
||||
UpstreamTemplate = "/products/{productId}",
|
||||
UpstreamPathTemplate = "/products/{productId}",
|
||||
UpstreamHttpMethod = "Get",
|
||||
ReRouteIsCaseSensitive = true
|
||||
}
|
||||
@ -173,7 +173,7 @@ namespace Ocelot.AcceptanceTests
|
||||
DownstreamPort = 51879,
|
||||
DownstreamScheme = "http",
|
||||
DownstreamHost = "localhost",
|
||||
UpstreamTemplate = "/PRODUCTS/{productId}",
|
||||
UpstreamPathTemplate = "/PRODUCTS/{productId}",
|
||||
UpstreamHttpMethod = "Get",
|
||||
ReRouteIsCaseSensitive = true
|
||||
}
|
||||
|
@ -55,7 +55,7 @@ namespace Ocelot.AcceptanceTests
|
||||
DownstreamPort = 52876,
|
||||
DownstreamScheme = "http",
|
||||
DownstreamHost = "localhost",
|
||||
UpstreamTemplate = "/",
|
||||
UpstreamPathTemplate = "/",
|
||||
UpstreamHttpMethod = "Get",
|
||||
AuthenticationOptions = new FileAuthenticationOptions
|
||||
{
|
||||
|
@ -55,7 +55,7 @@ namespace Ocelot.AcceptanceTests
|
||||
DownstreamPort = 57876,
|
||||
DownstreamScheme = "http",
|
||||
DownstreamHost = "localhost",
|
||||
UpstreamTemplate = "/",
|
||||
UpstreamPathTemplate = "/",
|
||||
UpstreamHttpMethod = "Get",
|
||||
AuthenticationOptions = new FileAuthenticationOptions
|
||||
{
|
||||
|
@ -49,7 +49,7 @@ namespace Ocelot.AcceptanceTests
|
||||
DownstreamPort = 41879,
|
||||
DownstreamScheme = "http",
|
||||
DownstreamHost = "localhost",
|
||||
UpstreamTemplate = "/",
|
||||
UpstreamPathTemplate = "/",
|
||||
UpstreamHttpMethod = "Get",
|
||||
}
|
||||
}
|
||||
@ -86,7 +86,7 @@ namespace Ocelot.AcceptanceTests
|
||||
DownstreamPort = 41879,
|
||||
DownstreamScheme = "http",
|
||||
DownstreamHost = "localhost",
|
||||
UpstreamTemplate = "/",
|
||||
UpstreamPathTemplate = "/",
|
||||
UpstreamHttpMethod = "Get",
|
||||
}
|
||||
}
|
||||
@ -123,7 +123,7 @@ namespace Ocelot.AcceptanceTests
|
||||
DownstreamPort = 41879,
|
||||
DownstreamScheme = "http",
|
||||
DownstreamHost = "localhost",
|
||||
UpstreamTemplate = "/",
|
||||
UpstreamPathTemplate = "/",
|
||||
UpstreamHttpMethod = "Get",
|
||||
}
|
||||
}
|
||||
@ -160,7 +160,7 @@ namespace Ocelot.AcceptanceTests
|
||||
DownstreamPort = 41879,
|
||||
DownstreamScheme = "http",
|
||||
DownstreamHost = "localhost",
|
||||
UpstreamTemplate = "/",
|
||||
UpstreamPathTemplate = "/",
|
||||
UpstreamHttpMethod = "Get",
|
||||
}
|
||||
}
|
||||
@ -197,7 +197,7 @@ namespace Ocelot.AcceptanceTests
|
||||
DownstreamPort = 41879,
|
||||
DownstreamScheme = "http",
|
||||
DownstreamHost = "localhost",
|
||||
UpstreamTemplate = "/",
|
||||
UpstreamPathTemplate = "/",
|
||||
UpstreamHttpMethod = "Get",
|
||||
}
|
||||
}
|
||||
@ -234,7 +234,7 @@ namespace Ocelot.AcceptanceTests
|
||||
DownstreamPort = 41879,
|
||||
DownstreamScheme = "http",
|
||||
DownstreamHost = "localhost",
|
||||
UpstreamTemplate = "/",
|
||||
UpstreamPathTemplate = "/",
|
||||
UpstreamHttpMethod = "Get",
|
||||
}
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ namespace Ocelot.AcceptanceTests
|
||||
DownstreamPort = 51879,
|
||||
DownstreamScheme = "http",
|
||||
DownstreamHost = "localhost",
|
||||
UpstreamTemplate = "/",
|
||||
UpstreamPathTemplate = "/",
|
||||
UpstreamHttpMethod = "Get",
|
||||
RequestIdKey = _steps.RequestIdKey
|
||||
}
|
||||
@ -65,7 +65,7 @@ namespace Ocelot.AcceptanceTests
|
||||
DownstreamPort = 51879,
|
||||
DownstreamScheme = "http",
|
||||
DownstreamHost = "localhost",
|
||||
UpstreamTemplate = "/",
|
||||
UpstreamPathTemplate = "/",
|
||||
UpstreamHttpMethod = "Get",
|
||||
RequestIdKey = _steps.RequestIdKey
|
||||
}
|
||||
@ -95,7 +95,7 @@ namespace Ocelot.AcceptanceTests
|
||||
DownstreamPort = 51879,
|
||||
DownstreamScheme = "http",
|
||||
DownstreamHost = "localhost",
|
||||
UpstreamTemplate = "/",
|
||||
UpstreamPathTemplate = "/",
|
||||
UpstreamHttpMethod = "Get",
|
||||
}
|
||||
},
|
||||
|
@ -30,7 +30,7 @@ namespace Ocelot.AcceptanceTests
|
||||
new FileReRoute
|
||||
{
|
||||
DownstreamPathTemplate = "http://localhost:53876/",
|
||||
UpstreamTemplate = "/",
|
||||
UpstreamPathTemplate = "/",
|
||||
UpstreamHttpMethod = "Get"
|
||||
}
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ namespace Ocelot.AcceptanceTests
|
||||
DownstreamScheme = "http",
|
||||
DownstreamHost = "localhost",
|
||||
DownstreamPort = 51879,
|
||||
UpstreamTemplate = "/",
|
||||
UpstreamPathTemplate = "/",
|
||||
UpstreamHttpMethod = "Get",
|
||||
}
|
||||
}
|
||||
@ -72,7 +72,7 @@ namespace Ocelot.AcceptanceTests
|
||||
DownstreamScheme = "http",
|
||||
DownstreamHost = "localhost",
|
||||
DownstreamPort = 51879,
|
||||
UpstreamTemplate = "/",
|
||||
UpstreamPathTemplate = "/",
|
||||
UpstreamHttpMethod = "Get",
|
||||
}
|
||||
}
|
||||
@ -100,7 +100,7 @@ namespace Ocelot.AcceptanceTests
|
||||
DownstreamScheme = "http",
|
||||
DownstreamHost = "localhost/",
|
||||
DownstreamPort = 51879,
|
||||
UpstreamTemplate = "/",
|
||||
UpstreamPathTemplate = "/",
|
||||
UpstreamHttpMethod = "Get",
|
||||
}
|
||||
}
|
||||
@ -128,7 +128,7 @@ namespace Ocelot.AcceptanceTests
|
||||
DownstreamScheme = "http",
|
||||
DownstreamHost = "localhost",
|
||||
DownstreamPort = 51879,
|
||||
UpstreamTemplate = "/products/",
|
||||
UpstreamPathTemplate = "/products/",
|
||||
UpstreamHttpMethod = "Get",
|
||||
}
|
||||
}
|
||||
@ -156,7 +156,7 @@ namespace Ocelot.AcceptanceTests
|
||||
DownstreamScheme = "http",
|
||||
DownstreamHost = "localhost",
|
||||
DownstreamPort = 51879,
|
||||
UpstreamTemplate = "/products",
|
||||
UpstreamPathTemplate = "/products",
|
||||
UpstreamHttpMethod = "Get",
|
||||
}
|
||||
}
|
||||
@ -184,7 +184,7 @@ namespace Ocelot.AcceptanceTests
|
||||
DownstreamScheme = "http",
|
||||
DownstreamHost = "localhost",
|
||||
DownstreamPort = 51879,
|
||||
UpstreamTemplate = "/products/{productId}",
|
||||
UpstreamPathTemplate = "/products/{productId}",
|
||||
UpstreamHttpMethod = "Get",
|
||||
}
|
||||
}
|
||||
@ -211,7 +211,7 @@ namespace Ocelot.AcceptanceTests
|
||||
DownstreamScheme = "http",
|
||||
DownstreamHost = "localhost",
|
||||
DownstreamPort = 51879,
|
||||
UpstreamTemplate = "/products/{productId}",
|
||||
UpstreamPathTemplate = "/products/{productId}",
|
||||
UpstreamHttpMethod = "Get"
|
||||
}
|
||||
}
|
||||
@ -239,7 +239,7 @@ namespace Ocelot.AcceptanceTests
|
||||
DownstreamHost = "localhost",
|
||||
DownstreamPort = 51879,
|
||||
DownstreamScheme = "http",
|
||||
UpstreamTemplate = "/",
|
||||
UpstreamPathTemplate = "/",
|
||||
UpstreamHttpMethod = "Post"
|
||||
}
|
||||
}
|
||||
@ -264,7 +264,7 @@ namespace Ocelot.AcceptanceTests
|
||||
new FileReRoute
|
||||
{
|
||||
DownstreamPathTemplate = "/newThing",
|
||||
UpstreamTemplate = "/newThing",
|
||||
UpstreamPathTemplate = "/newThing",
|
||||
DownstreamScheme = "http",
|
||||
DownstreamHost = "localhost",
|
||||
DownstreamPort = 51879,
|
||||
|
@ -68,7 +68,7 @@ namespace Ocelot.AcceptanceTests
|
||||
{
|
||||
DownstreamPathTemplate = "/",
|
||||
DownstreamScheme = "http",
|
||||
UpstreamTemplate = "/",
|
||||
UpstreamPathTemplate = "/",
|
||||
UpstreamHttpMethod = "Get",
|
||||
ServiceName = serviceName,
|
||||
LoadBalancer = "LeastConnection",
|
||||
|
@ -1 +1 @@
|
||||
{"ReRoutes":[{"DownstreamPathTemplate":"41879/","UpstreamTemplate":"/","UpstreamHttpMethod":"Get","AuthenticationOptions":{"Provider":null,"ProviderRootUrl":null,"ScopeName":null,"RequireHttps":false,"AdditionalScopes":[],"ScopeSecret":null},"AddHeadersToRequest":{},"AddClaimsToRequest":{},"RouteClaimsRequirement":{},"AddQueriesToRequest":{},"RequestIdKey":null,"FileCacheOptions":{"TtlSeconds":0},"ReRouteIsCaseSensitive":false,"ServiceName":null,"DownstreamScheme":"http","DownstreamHost":"localhost","DownstreamPort":41879,"LoadBalancer":null}],"GlobalConfiguration":{"RequestIdKey":null,"ServiceDiscoveryProvider":{"Provider":null,"Host":null,"Port":0}}}
|
||||
{"ReRoutes":[{"DownstreamPathTemplate":"41879/","UpstreamPathTemplate":"/","UpstreamHttpMethod":"Get","AuthenticationOptions":{"Provider":null,"ProviderRootUrl":null,"ScopeName":null,"RequireHttps":false,"AdditionalScopes":[],"ScopeSecret":null},"AddHeadersToRequest":{},"AddClaimsToRequest":{},"RouteClaimsRequirement":{},"AddQueriesToRequest":{},"RequestIdKey":null,"FileCacheOptions":{"TtlSeconds":0},"ReRouteIsCaseSensitive":false,"ServiceName":null,"DownstreamScheme":"http","DownstreamHost":"localhost","DownstreamPort":41879,"LoadBalancer":null}],"GlobalConfiguration":{"RequestIdKey":null,"ServiceDiscoveryProvider":{"Provider":null,"Host":null,"Port":0}}}
|
@ -29,7 +29,7 @@ namespace Ocelot.UnitTests.Configuration
|
||||
new FileReRoute
|
||||
{
|
||||
DownstreamPathTemplate = "http://www.bbc.co.uk/api/products/{productId}",
|
||||
UpstreamTemplate = "http://asdf.com"
|
||||
UpstreamPathTemplate = "http://asdf.com"
|
||||
}
|
||||
}
|
||||
}))
|
||||
@ -48,7 +48,7 @@ namespace Ocelot.UnitTests.Configuration
|
||||
new FileReRoute
|
||||
{
|
||||
DownstreamPathTemplate = "/api/products/",
|
||||
UpstreamTemplate = "http://asdf.com"
|
||||
UpstreamPathTemplate = "http://asdf.com"
|
||||
}
|
||||
}
|
||||
}))
|
||||
@ -67,7 +67,7 @@ namespace Ocelot.UnitTests.Configuration
|
||||
new FileReRoute
|
||||
{
|
||||
DownstreamPathTemplate = "/api/products/",
|
||||
UpstreamTemplate = "http://asdf.com",
|
||||
UpstreamPathTemplate = "http://asdf.com",
|
||||
AuthenticationOptions = new FileAuthenticationOptions
|
||||
{
|
||||
Provider = "IdentityServer"
|
||||
@ -90,7 +90,7 @@ namespace Ocelot.UnitTests.Configuration
|
||||
new FileReRoute
|
||||
{
|
||||
DownstreamPathTemplate = "/api/products/",
|
||||
UpstreamTemplate = "http://asdf.com",
|
||||
UpstreamPathTemplate = "http://asdf.com",
|
||||
AuthenticationOptions = new FileAuthenticationOptions
|
||||
{
|
||||
Provider = "BootyBootyBottyRockinEverywhere"
|
||||
@ -114,12 +114,12 @@ namespace Ocelot.UnitTests.Configuration
|
||||
new FileReRoute
|
||||
{
|
||||
DownstreamPathTemplate = "/api/products/",
|
||||
UpstreamTemplate = "http://asdf.com"
|
||||
UpstreamPathTemplate = "http://asdf.com"
|
||||
},
|
||||
new FileReRoute
|
||||
{
|
||||
DownstreamPathTemplate = "http://www.bbc.co.uk",
|
||||
UpstreamTemplate = "http://asdf.com"
|
||||
UpstreamPathTemplate = "http://asdf.com"
|
||||
}
|
||||
}
|
||||
}))
|
||||
|
@ -53,7 +53,7 @@ namespace Ocelot.UnitTests.Configuration
|
||||
new FileReRoute
|
||||
{
|
||||
DownstreamHost = "127.0.0.1",
|
||||
UpstreamTemplate = "/api/products/{productId}",
|
||||
UpstreamPathTemplate = "/api/products/{productId}",
|
||||
DownstreamPathTemplate = "/products/{productId}",
|
||||
UpstreamHttpMethod = "Get",
|
||||
}
|
||||
@ -78,7 +78,7 @@ namespace Ocelot.UnitTests.Configuration
|
||||
new FileReRoute
|
||||
{
|
||||
DownstreamHost = "127.0.0.1",
|
||||
UpstreamTemplate = "/api/products/{productId}",
|
||||
UpstreamPathTemplate = "/api/products/{productId}",
|
||||
DownstreamPathTemplate = "/products/{productId}",
|
||||
UpstreamHttpMethod = "Get",
|
||||
}
|
||||
@ -91,7 +91,7 @@ namespace Ocelot.UnitTests.Configuration
|
||||
new ReRouteBuilder()
|
||||
.WithDownstreamHost("127.0.0.1")
|
||||
.WithDownstreamPathTemplate("/products/{productId}")
|
||||
.WithUpstreamTemplate("/api/products/{productId}")
|
||||
.WithUpstreamPathTemplate("/api/products/{productId}")
|
||||
.WithUpstreamHttpMethod("Get")
|
||||
.WithUpstreamTemplatePattern("(?i)/api/products/.*/$")
|
||||
.Build()
|
||||
@ -109,7 +109,7 @@ namespace Ocelot.UnitTests.Configuration
|
||||
new FileReRoute
|
||||
{
|
||||
DownstreamScheme = "https",
|
||||
UpstreamTemplate = "/api/products/{productId}",
|
||||
UpstreamPathTemplate = "/api/products/{productId}",
|
||||
DownstreamPathTemplate = "/products/{productId}",
|
||||
UpstreamHttpMethod = "Get",
|
||||
}
|
||||
@ -122,7 +122,7 @@ namespace Ocelot.UnitTests.Configuration
|
||||
new ReRouteBuilder()
|
||||
.WithDownstreamScheme("https")
|
||||
.WithDownstreamPathTemplate("/products/{productId}")
|
||||
.WithUpstreamTemplate("/api/products/{productId}")
|
||||
.WithUpstreamPathTemplate("/api/products/{productId}")
|
||||
.WithUpstreamHttpMethod("Get")
|
||||
.WithUpstreamTemplatePattern("(?i)/api/products/.*/$")
|
||||
.Build()
|
||||
@ -139,7 +139,7 @@ namespace Ocelot.UnitTests.Configuration
|
||||
{
|
||||
new FileReRoute
|
||||
{
|
||||
UpstreamTemplate = "/api/products/{productId}",
|
||||
UpstreamPathTemplate = "/api/products/{productId}",
|
||||
DownstreamPathTemplate = "/products/{productId}",
|
||||
UpstreamHttpMethod = "Get",
|
||||
ReRouteIsCaseSensitive = false,
|
||||
@ -161,7 +161,7 @@ namespace Ocelot.UnitTests.Configuration
|
||||
{
|
||||
new ReRouteBuilder()
|
||||
.WithDownstreamPathTemplate("/products/{productId}")
|
||||
.WithUpstreamTemplate("/api/products/{productId}")
|
||||
.WithUpstreamPathTemplate("/api/products/{productId}")
|
||||
.WithUpstreamHttpMethod("Get")
|
||||
.WithUpstreamTemplatePattern("(?i)/api/products/.*/$")
|
||||
.WithServiceName("ProductService")
|
||||
@ -184,7 +184,7 @@ namespace Ocelot.UnitTests.Configuration
|
||||
{
|
||||
new FileReRoute
|
||||
{
|
||||
UpstreamTemplate = "/api/products/{productId}",
|
||||
UpstreamPathTemplate = "/api/products/{productId}",
|
||||
DownstreamPathTemplate = "/products/{productId}",
|
||||
UpstreamHttpMethod = "Get",
|
||||
ReRouteIsCaseSensitive = false,
|
||||
@ -197,7 +197,7 @@ namespace Ocelot.UnitTests.Configuration
|
||||
{
|
||||
new ReRouteBuilder()
|
||||
.WithDownstreamPathTemplate("/products/{productId}")
|
||||
.WithUpstreamTemplate("/api/products/{productId}")
|
||||
.WithUpstreamPathTemplate("/api/products/{productId}")
|
||||
.WithUpstreamHttpMethod("Get")
|
||||
.WithUpstreamTemplatePattern("(?i)/api/products/.*/$")
|
||||
.WithServiceProviderConfiguraion(new ServiceProviderConfiguraionBuilder()
|
||||
@ -217,7 +217,7 @@ namespace Ocelot.UnitTests.Configuration
|
||||
{
|
||||
new FileReRoute
|
||||
{
|
||||
UpstreamTemplate = "/api/products/{productId}",
|
||||
UpstreamPathTemplate = "/api/products/{productId}",
|
||||
DownstreamPathTemplate = "/products/{productId}",
|
||||
UpstreamHttpMethod = "Get",
|
||||
ReRouteIsCaseSensitive = false
|
||||
@ -230,7 +230,7 @@ namespace Ocelot.UnitTests.Configuration
|
||||
{
|
||||
new ReRouteBuilder()
|
||||
.WithDownstreamPathTemplate("/products/{productId}")
|
||||
.WithUpstreamTemplate("/api/products/{productId}")
|
||||
.WithUpstreamPathTemplate("/api/products/{productId}")
|
||||
.WithUpstreamHttpMethod("Get")
|
||||
.WithUpstreamTemplatePattern("(?i)/api/products/.*/$")
|
||||
.Build()
|
||||
@ -247,7 +247,7 @@ namespace Ocelot.UnitTests.Configuration
|
||||
{
|
||||
new FileReRoute
|
||||
{
|
||||
UpstreamTemplate = "/api/products/{productId}",
|
||||
UpstreamPathTemplate = "/api/products/{productId}",
|
||||
DownstreamPathTemplate = "/products/{productId}",
|
||||
UpstreamHttpMethod = "Get"
|
||||
}
|
||||
@ -259,7 +259,7 @@ namespace Ocelot.UnitTests.Configuration
|
||||
{
|
||||
new ReRouteBuilder()
|
||||
.WithDownstreamPathTemplate("/products/{productId}")
|
||||
.WithUpstreamTemplate("/api/products/{productId}")
|
||||
.WithUpstreamPathTemplate("/api/products/{productId}")
|
||||
.WithUpstreamHttpMethod("Get")
|
||||
.WithUpstreamTemplatePattern("(?i)/api/products/.*/$")
|
||||
.Build()
|
||||
@ -276,7 +276,7 @@ namespace Ocelot.UnitTests.Configuration
|
||||
{
|
||||
new FileReRoute
|
||||
{
|
||||
UpstreamTemplate = "/api/products/{productId}",
|
||||
UpstreamPathTemplate = "/api/products/{productId}",
|
||||
DownstreamPathTemplate = "/products/{productId}",
|
||||
UpstreamHttpMethod = "Get",
|
||||
ReRouteIsCaseSensitive = true
|
||||
@ -289,7 +289,7 @@ namespace Ocelot.UnitTests.Configuration
|
||||
{
|
||||
new ReRouteBuilder()
|
||||
.WithDownstreamPathTemplate("/products/{productId}")
|
||||
.WithUpstreamTemplate("/api/products/{productId}")
|
||||
.WithUpstreamPathTemplate("/api/products/{productId}")
|
||||
.WithUpstreamHttpMethod("Get")
|
||||
.WithUpstreamTemplatePattern("/api/products/.*/$")
|
||||
.Build()
|
||||
@ -306,7 +306,7 @@ namespace Ocelot.UnitTests.Configuration
|
||||
{
|
||||
new FileReRoute
|
||||
{
|
||||
UpstreamTemplate = "/api/products/{productId}",
|
||||
UpstreamPathTemplate = "/api/products/{productId}",
|
||||
DownstreamPathTemplate = "/products/{productId}",
|
||||
UpstreamHttpMethod = "Get",
|
||||
ReRouteIsCaseSensitive = true
|
||||
@ -323,7 +323,7 @@ namespace Ocelot.UnitTests.Configuration
|
||||
{
|
||||
new ReRouteBuilder()
|
||||
.WithDownstreamPathTemplate("/products/{productId}")
|
||||
.WithUpstreamTemplate("/api/products/{productId}")
|
||||
.WithUpstreamPathTemplate("/api/products/{productId}")
|
||||
.WithUpstreamHttpMethod("Get")
|
||||
.WithUpstreamTemplatePattern("/api/products/.*/$")
|
||||
.WithRequestIdKey("blahhhh")
|
||||
@ -341,7 +341,7 @@ namespace Ocelot.UnitTests.Configuration
|
||||
{
|
||||
new FileReRoute
|
||||
{
|
||||
UpstreamTemplate = "/api/products/{productId}",
|
||||
UpstreamPathTemplate = "/api/products/{productId}",
|
||||
DownstreamPathTemplate = "/products/{productId}",
|
||||
UpstreamHttpMethod = "Get",
|
||||
ReRouteIsCaseSensitive = true
|
||||
@ -354,7 +354,7 @@ namespace Ocelot.UnitTests.Configuration
|
||||
{
|
||||
new ReRouteBuilder()
|
||||
.WithDownstreamPathTemplate("/products/{productId}")
|
||||
.WithUpstreamTemplate("/api/products/{productId}")
|
||||
.WithUpstreamPathTemplate("/api/products/{productId}")
|
||||
.WithUpstreamHttpMethod("Get")
|
||||
.WithUpstreamTemplatePattern("/api/products/.*/$")
|
||||
.Build()
|
||||
@ -365,18 +365,23 @@ namespace Ocelot.UnitTests.Configuration
|
||||
[Fact]
|
||||
public void should_create_with_headers_to_extract()
|
||||
{
|
||||
var authenticationOptions = new AuthenticationOptionsBuilder()
|
||||
.WithProvider("IdentityServer")
|
||||
.WithProviderRootUrl("http://localhost:51888")
|
||||
.WithRequireHttps(false)
|
||||
.WithScopeSecret("secret")
|
||||
.WithScopeName("api")
|
||||
.WithAdditionalScopes(new List<string>())
|
||||
.Build();
|
||||
|
||||
var expected = new List<ReRoute>
|
||||
{
|
||||
new ReRouteBuilder()
|
||||
.WithDownstreamPathTemplate("/products/{productId}")
|
||||
.WithUpstreamTemplate("/api/products/{productId}")
|
||||
.WithUpstreamPathTemplate("/api/products/{productId}")
|
||||
.WithUpstreamHttpMethod("Get")
|
||||
.WithUpstreamTemplatePattern("/api/products/.*/$")
|
||||
.WithAuthenticationProvider("IdentityServer")
|
||||
.WithAuthenticationProviderUrl("http://localhost:51888")
|
||||
.WithRequireHttps(false)
|
||||
.WithScopeSecret("secret")
|
||||
.WithAuthenticationProviderScopeName("api")
|
||||
.WithAuthenticationOptions(authenticationOptions)
|
||||
.WithClaimsToHeaders(new List<ClaimToThing>
|
||||
{
|
||||
new ClaimToThing("CustomerId", "CustomerId", "", 0),
|
||||
@ -390,7 +395,7 @@ namespace Ocelot.UnitTests.Configuration
|
||||
{
|
||||
new FileReRoute
|
||||
{
|
||||
UpstreamTemplate = "/api/products/{productId}",
|
||||
UpstreamPathTemplate = "/api/products/{productId}",
|
||||
DownstreamPathTemplate = "/products/{productId}",
|
||||
UpstreamHttpMethod = "Get",
|
||||
ReRouteIsCaseSensitive = true,
|
||||
@ -429,18 +434,23 @@ namespace Ocelot.UnitTests.Configuration
|
||||
[Fact]
|
||||
public void should_create_with_authentication_properties()
|
||||
{
|
||||
var authenticationOptions = new AuthenticationOptionsBuilder()
|
||||
.WithProvider("IdentityServer")
|
||||
.WithProviderRootUrl("http://localhost:51888")
|
||||
.WithRequireHttps(false)
|
||||
.WithScopeSecret("secret")
|
||||
.WithScopeName("api")
|
||||
.WithAdditionalScopes(new List<string>())
|
||||
.Build();
|
||||
|
||||
var expected = new List<ReRoute>
|
||||
{
|
||||
new ReRouteBuilder()
|
||||
.WithDownstreamPathTemplate("/products/{productId}")
|
||||
.WithUpstreamTemplate("/api/products/{productId}")
|
||||
.WithUpstreamPathTemplate("/api/products/{productId}")
|
||||
.WithUpstreamHttpMethod("Get")
|
||||
.WithUpstreamTemplatePattern("/api/products/.*/$")
|
||||
.WithAuthenticationProvider("IdentityServer")
|
||||
.WithAuthenticationProviderUrl("http://localhost:51888")
|
||||
.WithRequireHttps(false)
|
||||
.WithScopeSecret("secret")
|
||||
.WithAuthenticationProviderScopeName("api")
|
||||
.WithAuthenticationOptions(authenticationOptions)
|
||||
.Build()
|
||||
};
|
||||
|
||||
@ -450,7 +460,7 @@ namespace Ocelot.UnitTests.Configuration
|
||||
{
|
||||
new FileReRoute
|
||||
{
|
||||
UpstreamTemplate = "/api/products/{productId}",
|
||||
UpstreamPathTemplate = "/api/products/{productId}",
|
||||
DownstreamPathTemplate = "/products/{productId}",
|
||||
UpstreamHttpMethod = "Get",
|
||||
ReRouteIsCaseSensitive = true,
|
||||
@ -483,7 +493,7 @@ namespace Ocelot.UnitTests.Configuration
|
||||
{
|
||||
new FileReRoute
|
||||
{
|
||||
UpstreamTemplate = "/api/products/{productId}/variants/{variantId}",
|
||||
UpstreamPathTemplate = "/api/products/{productId}/variants/{variantId}",
|
||||
DownstreamPathTemplate = "/products/{productId}",
|
||||
UpstreamHttpMethod = "Get",
|
||||
ReRouteIsCaseSensitive = true
|
||||
@ -496,7 +506,7 @@ namespace Ocelot.UnitTests.Configuration
|
||||
{
|
||||
new ReRouteBuilder()
|
||||
.WithDownstreamPathTemplate("/products/{productId}")
|
||||
.WithUpstreamTemplate("/api/products/{productId}/variants/{variantId}")
|
||||
.WithUpstreamPathTemplate("/api/products/{productId}/variants/{variantId}")
|
||||
.WithUpstreamHttpMethod("Get")
|
||||
.WithUpstreamTemplatePattern("/api/products/.*/variants/.*/$")
|
||||
.Build()
|
||||
@ -513,7 +523,7 @@ namespace Ocelot.UnitTests.Configuration
|
||||
{
|
||||
new FileReRoute
|
||||
{
|
||||
UpstreamTemplate = "/api/products/{productId}/variants/{variantId}/",
|
||||
UpstreamPathTemplate = "/api/products/{productId}/variants/{variantId}/",
|
||||
DownstreamPathTemplate = "/products/{productId}",
|
||||
UpstreamHttpMethod = "Get",
|
||||
ReRouteIsCaseSensitive = true
|
||||
@ -526,7 +536,7 @@ namespace Ocelot.UnitTests.Configuration
|
||||
{
|
||||
new ReRouteBuilder()
|
||||
.WithDownstreamPathTemplate("/products/{productId}")
|
||||
.WithUpstreamTemplate("/api/products/{productId}/variants/{variantId}/")
|
||||
.WithUpstreamPathTemplate("/api/products/{productId}/variants/{variantId}/")
|
||||
.WithUpstreamHttpMethod("Get")
|
||||
.WithUpstreamTemplatePattern("/api/products/.*/variants/.*/$")
|
||||
.Build()
|
||||
@ -543,7 +553,7 @@ namespace Ocelot.UnitTests.Configuration
|
||||
{
|
||||
new FileReRoute
|
||||
{
|
||||
UpstreamTemplate = "/",
|
||||
UpstreamPathTemplate = "/",
|
||||
DownstreamPathTemplate = "/api/products/",
|
||||
UpstreamHttpMethod = "Get",
|
||||
ReRouteIsCaseSensitive = true
|
||||
@ -556,7 +566,7 @@ namespace Ocelot.UnitTests.Configuration
|
||||
{
|
||||
new ReRouteBuilder()
|
||||
.WithDownstreamPathTemplate("/api/products/")
|
||||
.WithUpstreamTemplate("/")
|
||||
.WithUpstreamPathTemplate("/")
|
||||
.WithUpstreamHttpMethod("Get")
|
||||
.WithUpstreamTemplatePattern("/$")
|
||||
.Build()
|
||||
@ -593,7 +603,7 @@ namespace Ocelot.UnitTests.Configuration
|
||||
|
||||
result.DownstreamPathTemplate.Value.ShouldBe(expected.DownstreamPathTemplate.Value);
|
||||
result.UpstreamHttpMethod.ShouldBe(expected.UpstreamHttpMethod);
|
||||
result.UpstreamTemplate.Value.ShouldBe(expected.UpstreamTemplate.Value);
|
||||
result.UpstreamPathTemplate.Value.ShouldBe(expected.UpstreamPathTemplate.Value);
|
||||
result.UpstreamTemplatePattern.ShouldBe(expected.UpstreamTemplatePattern);
|
||||
}
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ namespace Ocelot.UnitTests.DownstreamRouteFinder
|
||||
{
|
||||
new ReRouteBuilder()
|
||||
.WithDownstreamPathTemplate("someDownstreamPath")
|
||||
.WithUpstreamTemplate("someUpstreamPath")
|
||||
.WithUpstreamPathTemplate("someUpstreamPath")
|
||||
.WithUpstreamHttpMethod("Get")
|
||||
.WithUpstreamTemplatePattern("someUpstreamPath")
|
||||
.Build()
|
||||
@ -77,13 +77,13 @@ namespace Ocelot.UnitTests.DownstreamRouteFinder
|
||||
{
|
||||
new ReRouteBuilder()
|
||||
.WithDownstreamPathTemplate("someDownstreamPath")
|
||||
.WithUpstreamTemplate("someUpstreamPath")
|
||||
.WithUpstreamPathTemplate("someUpstreamPath")
|
||||
.WithUpstreamHttpMethod("Get")
|
||||
.WithUpstreamTemplatePattern("")
|
||||
.Build(),
|
||||
new ReRouteBuilder()
|
||||
.WithDownstreamPathTemplate("someDownstreamPathForAPost")
|
||||
.WithUpstreamTemplate("someUpstreamPath")
|
||||
.WithUpstreamPathTemplate("someUpstreamPath")
|
||||
.WithUpstreamHttpMethod("Post")
|
||||
.WithUpstreamTemplatePattern("")
|
||||
.Build()
|
||||
@ -110,7 +110,7 @@ namespace Ocelot.UnitTests.DownstreamRouteFinder
|
||||
{
|
||||
new ReRouteBuilder()
|
||||
.WithDownstreamPathTemplate("somPath")
|
||||
.WithUpstreamTemplate("somePath")
|
||||
.WithUpstreamPathTemplate("somePath")
|
||||
.WithUpstreamHttpMethod("Get")
|
||||
.WithUpstreamTemplatePattern("somePath")
|
||||
.Build(),
|
||||
@ -145,7 +145,7 @@ namespace Ocelot.UnitTests.DownstreamRouteFinder
|
||||
private void ThenTheUrlMatcherIsCalledCorrectly()
|
||||
{
|
||||
_mockMatcher
|
||||
.Verify(x => x.Match(_upstreamUrlPath, _reRoutesConfig[0].UpstreamTemplate.Value), Times.Once);
|
||||
.Verify(x => x.Match(_upstreamUrlPath, _reRoutesConfig[0].UpstreamPathTemplate.Value), Times.Once);
|
||||
}
|
||||
|
||||
private void GivenTheUrlMatcherReturns(Response<UrlMatch> match)
|
||||
|
@ -1,4 +1,5 @@
|
||||
using Ocelot.Configuration;
|
||||
using Ocelot.Configuration.Builder;
|
||||
using Ocelot.ServiceDiscovery;
|
||||
using Shouldly;
|
||||
using TestStack.BDDfy;
|
||||
|
Reference in New Issue
Block a user