You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/features/authentication.rst
+13-13Lines changed: 13 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,7 @@
1
1
Authentication
2
2
==============
3
3
4
-
In order to authenticate ReRoutes and subsequently use any of Ocelot's claims based features such as authorisation or modifying the request with values from the token. Users must register authentication services in their Startup.cs as usual but they provide a scheme (authentication provider key) with each registration e.g.
4
+
In order to authenticate Routes and subsequently use any of Ocelot's claims based features such as authorisation or modifying the request with values from the token. Users must register authentication services in their Startup.cs as usual but they provide a scheme (authentication provider key) with each registration e.g.
5
5
6
6
.. code-block:: csharp
7
7
@@ -16,11 +16,11 @@ In order to authenticate ReRoutes and subsequently use any of Ocelot's claims ba
16
16
}
17
17
18
18
19
-
In this example TestKey is the scheme that this provider has been registered with. We then map this to a ReRoute in the configuration e.g.
19
+
In this example TestKey is the scheme that this provider has been registered with. We then map this to a Route in the configuration e.g.
20
20
21
21
.. code-block:: json
22
22
23
-
"ReRoutes": [{
23
+
"Routes": [{
24
24
"DownstreamHostAndPorts": [
25
25
{
26
26
"Host": "localhost",
@@ -30,17 +30,17 @@ In this example TestKey is the scheme that this provider has been registered wit
30
30
"DownstreamPathTemplate": "/",
31
31
"UpstreamPathTemplate": "/",
32
32
"UpstreamHttpMethod": ["Post"],
33
-
"ReRouteIsCaseSensitive": false,
33
+
"RouteIsCaseSensitive": false,
34
34
"DownstreamScheme": "http",
35
35
"AuthenticationOptions": {
36
36
"AuthenticationProviderKey": "TestKey",
37
37
"AllowedScopes": []
38
38
}
39
39
}]
40
40
41
-
When Ocelot runs it will look at this ReRoutes AuthenticationOptions.AuthenticationProviderKey and check that there is an Authentication provider registered with the given key. If there isn't then Ocelot will not start up, if there is then the ReRoute will use that provider when it executes.
41
+
When Ocelot runs it will look at this Routes AuthenticationOptions.AuthenticationProviderKey and check that there is an Authentication provider registered with the given key. If there isn't then Ocelot will not start up, if there is then the Route will use that provider when it executes.
42
42
43
-
If a ReRoute is authenticated Ocelot will invoke whatever scheme is associated with it while executing the authentication middleware. If the request fails authentication Ocelot returns a http status code 401.
43
+
If a Route is authenticated Ocelot will invoke whatever scheme is associated with it while executing the authentication middleware. If the request fails authentication Ocelot returns a http status code 401.
44
44
45
45
JWT Tokens
46
46
^^^^^^^^^^
@@ -63,11 +63,11 @@ If you want to authenticate using JWT tokens maybe from a provider like Auth0 yo
63
63
services.AddOcelot();
64
64
}
65
65
66
-
Then map the authentication provider key to a ReRoute in your configuration e.g.
66
+
Then map the authentication provider key to a Route in your configuration e.g.
67
67
68
68
.. code-block:: json
69
69
70
-
"ReRoutes": [{
70
+
"Routes": [{
71
71
"DownstreamHostAndPorts": [
72
72
{
73
73
"Host": "localhost",
@@ -77,7 +77,7 @@ Then map the authentication provider key to a ReRoute in your configuration e.g.
77
77
"DownstreamPathTemplate": "/",
78
78
"UpstreamPathTemplate": "/",
79
79
"UpstreamHttpMethod": ["Post"],
80
-
"ReRouteIsCaseSensitive": false,
80
+
"RouteIsCaseSensitive": false,
81
81
"DownstreamScheme": "http",
82
82
"AuthenticationOptions": {
83
83
"AuthenticationProviderKey": "TestKey",
@@ -111,11 +111,11 @@ In order to use IdentityServer bearer tokens, register your IdentityServer servi
111
111
services.AddOcelot();
112
112
}
113
113
114
-
Then map the authentication provider key to a ReRoute in your configuration e.g.
114
+
Then map the authentication provider key to a Route in your configuration e.g.
115
115
116
116
.. code-block:: json
117
117
118
-
"ReRoutes": [{
118
+
"Routes": [{
119
119
"DownstreamHostAndPorts": [
120
120
{
121
121
"Host": "localhost",
@@ -125,7 +125,7 @@ Then map the authentication provider key to a ReRoute in your configuration e.g.
125
125
"DownstreamPathTemplate": "/",
126
126
"UpstreamPathTemplate": "/",
127
127
"UpstreamHttpMethod": ["Post"],
128
-
"ReRouteIsCaseSensitive": false,
128
+
"RouteIsCaseSensitive": false,
129
129
"DownstreamScheme": "http",
130
130
"AuthenticationOptions": {
131
131
"AuthenticationProviderKey": "TestKey",
@@ -176,4 +176,4 @@ Allowed Scopes
176
176
177
177
If you add scopes to AllowedScopes Ocelot will get all the user claims (from the token) of the type scope and make sure that the user has all of the scopes in the list.
178
178
179
-
This is a way to restrict access to a ReRoute on a per scope basis.
179
+
This is a way to restrict access to a Route on a per scope basis.
Copy file name to clipboardExpand all lines: docs/features/authorisation.rst
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,7 @@
1
1
Authorisation
2
2
=============
3
3
4
-
Ocelot supports claims based authorisation which is run post authentication. This means if you have a route you want to authorise you can add the following to you ReRoute configuration.
4
+
Ocelot supports claims based authorisation which is run post authentication. This means if you have a route you want to authorise you can add the following to you Route configuration.
Copy file name to clipboardExpand all lines: docs/features/claimstransformation.rst
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,7 +5,7 @@ Ocelot allows the user to access claims and transform them into headers, query s
5
5
6
6
After the user is authenticated we run the claims to claims transformation middleware. This allows the user to transform claims before the authorisation middleware is called. After the user is authorised first we call the claims to headers middleware, thenthe claims to query string parameters middleware, and Finally the claims to downstream pathmiddleware.
7
7
8
-
The syntax for performing the transforms is the same for each process. In the ReRoute configuration a json dictionary is added with a specific name either AddClaimsToRequest, AddHeadersToRequest, AddQueriesToRequest, or ChangeDownstreamPathTemplate.
8
+
The syntax for performing the transforms is the same for each process. In the Route configuration a json dictionary is added with a specific name either AddClaimsToRequest, AddHeadersToRequest, AddQueriesToRequest, or ChangeDownstreamPathTemplate.
9
9
10
10
Note: I'm not a hotshot programmer so have no idea if this syntax is good...
Copy file name to clipboardExpand all lines: docs/features/configuration.rst
+8-8Lines changed: 8 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,16 +1,16 @@
1
1
Configuration
2
2
============
3
3
4
-
An example configuration can be found `here <https://github.com/ThreeMammals/Ocelot/blob/master/test/Ocelot.ManualTest/ocelot.json>`_. There are two sections to the configuration. An array of ReRoutes and a GlobalConfiguration. The ReRoutes are the objects that tell Ocelot how to treat an upstream request. The Global configuration is a bit hacky and allows overrides of ReRoute specific settings. It's useful if you don't want to manage lots of ReRoute specific settings.
4
+
An example configuration can be found `here <https://github.com/ThreeMammals/Ocelot/blob/master/test/Ocelot.ManualTest/ocelot.json>`_. There are two sections to the configuration. An array of Routes and a GlobalConfiguration. The Routes are the objects that tell Ocelot how to treat an upstream request. The Global configuration is a bit hacky and allows overrides of Route specific settings. It's useful if you don't want to manage lots of Route specific settings.
5
5
6
6
.. code-block:: json
7
7
8
8
{
9
-
"ReRoutes": [],
9
+
"Routes": [],
10
10
"GlobalConfiguration": {}
11
11
}
12
12
13
-
Here is an example ReRoute configuration, You don't need to set all of these things but this is everything that is available at the moment:
13
+
Here is an example Route configuration, You don't need to set all of these things but this is everything that is available at the moment:
14
14
15
15
.. code-block:: json
16
16
@@ -31,7 +31,7 @@ Here is an example ReRoute configuration, You don't need to set all of these thi
31
31
"TtlSeconds": 0,
32
32
"Region": ""
33
33
},
34
-
"ReRouteIsCaseSensitive": false,
34
+
"RouteIsCaseSensitive": false,
35
35
"ServiceName": "",
36
36
"DownstreamScheme": "http",
37
37
"DownstreamHostAndPorts": [
@@ -112,7 +112,7 @@ Instead of adding the configuration directly e.g. AddJsonFile("ocelot.json") you
112
112
113
113
In this scenario Ocelot will look for any files that match the pattern (?i)ocelot.([a-zA-Z0-9]*).json and then merge these together. If you want to set the GlobalConfiguration property you must have a file called ocelot.global.json.
114
114
115
-
The way Ocelot merges the files is basically load them, loop over them, add any ReRoutes, add any AggregateReRoutes and if the file is called ocelot.global.json add the GlobalConfiguration aswell as any ReRoutes or AggregateReRoutes. Ocelot will then save the merged configuration to a file called ocelot.json and this will be used as the source of truth while ocelot is running.
115
+
The way Ocelot merges the files is basically load them, loop over them, add any Routes, add any AggregateRoutes and if the file is called ocelot.global.json add the GlobalConfiguration aswell as any Routes or AggregateRoutes. Ocelot will then save the merged configuration to a file called ocelot.json and this will be used as the source of truth while ocelot is running.
116
116
117
117
At the moment there is no validation at this stage it only happens when Ocelot validates the final merged configuration. This is something to be aware of when you are investigating problems. I would advise always checking what is in ocelot.json if you have any problems.
118
118
@@ -195,7 +195,7 @@ If you do not set the ConfigurationKey Ocelot will use the string InternalConfig
195
195
Follow Redirects / Use CookieContainer
196
196
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
197
197
198
-
Use HttpHandlerOptions in ReRoute configuration to set up HttpHandler behavior:
198
+
Use HttpHandlerOptions in Route configuration to set up HttpHandler behavior:
199
199
200
200
1. AllowAutoRedirect is a value that indicates whether the request should follow redirection responses. Set it true if the request should automatically follow redirection responses from the Downstream resource; otherwise false. The default value is false.
201
201
@@ -204,7 +204,7 @@ Use HttpHandlerOptions in ReRoute configuration to set up HttpHandler behavior:
204
204
SSL Errors
205
205
^^^^^^^^^^
206
206
207
-
If you want to ignore SSL warnings / errors set the following in your ReRoute config.
207
+
If you want to ignore SSL warnings / errors set the following in your Route config.
208
208
209
209
.. code-block:: json
210
210
@@ -215,7 +215,7 @@ I don't recommend doing this, I suggest creating your own certificate and then g
215
215
MaxConnectionsPerServer
216
216
^^^^^^^^^^^^^^^^^^^^^^^
217
217
218
-
This controls how many connections the internal HttpClient will open. This can be set at ReRoute or global level.
218
+
This controls how many connections the internal HttpClient will open. This can be set at Route or global level.
Copy file name to clipboardExpand all lines: docs/features/delegatinghandlers.rst
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -31,8 +31,8 @@ Next you must add the handlers to Ocelot's container like below...
31
31
.AddDelegatingHandler<FakeHandler>()
32
32
.AddDelegatingHandler<FakeHandlerTwo>()
33
33
34
-
Both of these Add methods have a default parameter called global which is set to false. If it is false then the intent of the DelegatingHandler is to be applied to specific ReRoutes via ocelot.json (more on that later). If it is set to true
35
-
then it becomes a global handler and will be applied to all ReRoutes.
34
+
Both of these Add methods have a default parameter called global which is set to false. If it is false then the intent of the DelegatingHandler is to be applied to specific Routes via ocelot.json (more on that later). If it is set to true
35
+
then it becomes a global handler and will be applied to all Routes.
36
36
37
37
e.g.
38
38
@@ -43,7 +43,7 @@ As below...
43
43
services.AddOcelot()
44
44
.AddDelegatingHandler<FakeHandler>(true)
45
45
46
-
Finally if you want ReRoute specific DelegatingHandlers or to order your specific and / or global (more on this later) DelegatingHandlers then you must add the following json to the specific ReRoute in ocelot.json. The names in the array must match the class names of your
46
+
Finally if you want Route specific DelegatingHandlers or to order your specific and / or global (more on this later) DelegatingHandlers then you must add the following json to the specific Route in ocelot.json. The names in the array must match the class names of your
47
47
DelegatingHandlers for Ocelot to match them together.
Copy file name to clipboardExpand all lines: docs/features/headerstransformation.rst
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,7 +8,7 @@ Add to Request
8
8
9
9
This feature was requestes in `GitHub #313 <https://github.com/ThreeMammals/Ocelot/issues/313>`_.
10
10
11
-
If you want to add a header to your upstream request please add the following to a ReRoute in your ocelot.json:
11
+
If you want to add a header to your upstream request please add the following to a Route in your ocelot.json:
12
12
13
13
.. code-block:: json
14
14
@@ -25,15 +25,15 @@ Add to Response
25
25
26
26
This feature was requested in `GitHub #280 <https://github.com/ThreeMammals/Ocelot/issues/280>`_.
27
27
28
-
If you want to add a header to your downstream response please add the following to a ReRoute in ocelot.json..
28
+
If you want to add a header to your downstream response please add the following to a Route in ocelot.json..
29
29
30
30
.. code-block:: json
31
31
32
32
"DownstreamHeaderTransform": {
33
33
"Uncle": "Bob"
34
34
},
35
35
36
-
In the example above a header with the key Uncle and value Bob would be returned by Ocelot when requesting the specific ReRoute.
36
+
In the example above a header with the key Uncle and value Bob would be returned by Ocelot when requesting the specific Route.
37
37
38
38
If you want to return the Butterfly APM trace id then do something like the following..
39
39
@@ -57,7 +57,7 @@ The key is "Test" and the value is "http://www.bbc.co.uk/, http://ocelot.com/".
57
57
Pre Downstream Request
58
58
^^^^^^^^^^^^^^^^^^^^^^
59
59
60
-
Add the following to a ReRoute in ocelot.json in order to replace http://www.bbc.co.uk/ with http://ocelot.com/. This header will be changed before the request downstream and will be sent to the downstream server.
60
+
Add the following to a Route in ocelot.json in order to replace http://www.bbc.co.uk/ with http://ocelot.com/. This header will be changed before the request downstream and will be sent to the downstream server.
61
61
62
62
.. code-block:: json
63
63
@@ -68,7 +68,7 @@ Add the following to a ReRoute in ocelot.json in order to replace http://www.bbc
68
68
Post Downstream Request
69
69
^^^^^^^^^^^^^^^^^^^^^^^
70
70
71
-
Add the following to a ReRoute in ocelot.json in order to replace http://www.bbc.co.uk/ with http://ocelot.com/. This transformation will take place after Ocelot has received the response from the downstream service.
71
+
Add the following to a Route in ocelot.json in order to replace http://www.bbc.co.uk/ with http://ocelot.com/. This transformation will take place after Ocelot has received the response from the downstream service.
The following example shows how to set up a ReRoute that will work in kubernetes. The most important thing is the ServiceName which is made up of the kubernetes service name. We also need to set up the ServiceDiscoveryProvider in GlobalConfiguration. The example here shows a typical configuration.
33
+
The following example shows how to set up a Route that will work in kubernetes. The most important thing is the ServiceName which is made up of the kubernetes service name. We also need to set up the ServiceDiscoveryProvider in GlobalConfiguration. The example here shows a typical configuration.
34
34
35
35
36
36
.. code-block:: json
37
37
38
38
{
39
-
"ReRoutes": [
39
+
"Routes": [
40
40
{
41
41
"DownstreamPathTemplate": "/api/values",
42
42
"DownstreamScheme": "http",
@@ -76,13 +76,13 @@ The polling interval is in milliseconds and tells Ocelot how often to call kuber
76
76
77
77
Please note there are tradeoffs here. If you poll kubernetes it is possible Ocelot will not know if a service is down depending on your polling interval and you might get more errors than if you get the latest services per request. This really depends on how volatile your services are. I doubt it will matter for most people and polling may give a tiny performance improvement over calling kubernetes per request. There is no way for Ocelot to work these out for you.
78
78
79
-
If your downstream service resides in a different namespace you can override the global setting at the ReRoute level by specifying a ServiceNamespace.
79
+
If your downstream service resides in a different namespace you can override the global setting at the Route level by specifying a ServiceNamespace.
0 commit comments