Plugins#
A plugin entity represents a plugin configuration that will be executed during the HTTP request/response lifecycle. Plugins add functionality to services that run behind Kong, such as Authentication, Security, Rate Limiting and others.
Plugins can be added on the Service, Route, or Global levels.
Plugin Precedence#
Plugins can be configured to run on the service, route, consumer, or global level. The plugin will only run once, even if configured on multiple levels. This allows a plugin to behave one way for most requests, but differently for a specific type of request. Gluu Gateway has adopted Kong's order of plugin precedence, as follows:
- Plugins configured on a Route, a Service, and a Consumer.
- Plugins configured on a Route and a Consumer.
- Plugins configured on a Service and a Consumer.
- Plugins configured on a Route and a Service.
- Plugins configured on a Consumer.
- Plugins configured on a Route.
- Plugins configured on a Service.
- Plugins configured to run Globally.
Note
Plugins configured on the Consumer level requires requests to be authenticated.
Add Plugins on Service#
If you add plugins in a Service entity, the plugin will execute for every route under the service.
For example: One service test-service1 is created with two routes, route1 and route2. One plugin is added on test-service1. When the user requests route1, the plugin will be executed. The same is true if the user requests route2. Overall, both requests target the same service with the attached plugin.
Below are the steps to enable plugins on the Service entity.
-
Go to
Servicesview by clicking onServicesin left side of the navigation bar. -
Click on the Service name or pencil icon on which you want to add plugins.
-
Click on the
Pluginstab. -
Click on the
+ ADD PLUGINbutton. -
Now click on
+icon of the plugin which you want to add
Add Plugins on Route#
If you add plugins to a Route entity, the plugin will only execute for that route.
For example: One service test-service1 is created with two routes, route1 and route2. One plugin is added on route1. When a user requests route1, it will execute the plugin, but not if the user requests route2.
Below are the steps to enable plugins on the Route entity.
-
Go to
Routesview by clicking onRoutesin left side of the navigation bar. -
Click on the Route name or pencil icon on which you want to add plugins.
-
Click on the
Pluginstab. -
Click on the
+ ADD PLUGINbutton. -
Now click on
+icon of the plugin which you want to add.
Add Plugins Globally#
If a plugin is added globally, it will apply for all services and routes.
-
Go to
Pluginsview by clicking onPluginsin left side of the navigation bar. -
Add Plugins by using the
+ ADD GLOBAL PLUGINSbutton. -
Now click on
+icon of the plugin which you want to add.
Gluu Plugin Combinations and scopes#
The following table describes the possible combination of Gluu Plugins for security, as well as where the plugins can be added.
| Plugin | Service | Route | Globally |
|---|---|---|---|
| gluu-oauth-auth | ✔ | ✔ | ✔ |
| gluu-oauth-auth and gluu-oauth-pep | ✔ | ✔ | ✔ |
| gluu-oauth-auth and gluu-opa-pep | ✔ | ✔ | ✔ |
| gluu-uma-auth and gluu-uma-pep | ✔ | ✔ | ✔ |
| gluu-openid-connect | - | ✔ | - |
| gluu-openid-connect and gluu-uma-pep | - | ✔ | - |
| gluu-openid-connect and gluu-opa-pep | - | ✔ | - |
| gluu-metrics | - | - | ✔ |


