我正在使用Ocelot块开发Api网关,并且为了进行服务发现,我正在使用Consul块。
我需要描述为here的动态路由。
一切正常,直到我想按照此page中的说明使用自己的身份服务器实施身份验证。
对于使用Consul服务发现的动态重新路由,我必须具有空的重新路由
{
"ReRoutes": []
}
对于身份验证,我需要添加以下部分到我的ReRoutes集合中
"AuthenticationOptions": {
"AuthenticationProviderKey": "TestKey",
"AllowedScopes": []
}
因此,重新路由必须更改为此:
"ReRoutes": [{
"DownstreamHostAndPorts": [
{
"Host": "localhost",
"Port": 51876,
}
],
"DownstreamPathTemplate": "/",
"UpstreamPathTemplate": "/",
"UpstreamHttpMethod": ["Post"],
"ReRouteIsCaseSensitive": false,
"DownstreamScheme": "http",
"AuthenticationOptions": {
"AuthenticationProviderKey": "TestKey",
"AllowedScopes": []
}
}]
现在我失去了最初使用的动态路由。
有没有办法解决这个问题?