Skip to content

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:

  1. Plugins configured on a Route, a Service, and a Consumer.
  2. Plugins configured on a Route and a Consumer.
  3. Plugins configured on a Service and a Consumer.
  4. Plugins configured on a Route and a Service.
  5. Plugins configured on a Consumer.
  6. Plugins configured on a Route.
  7. Plugins configured on a Service.
  8. 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 Services view by clicking on Services in left side of the navigation bar.

  • Click on the Service name or pencil icon on which you want to add plugins.

  • Click on the Plugins tab.

  • Click on the + ADD PLUGIN button.

  • Now click on + icon of the plugin which you want to add

6_plugins

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 Routes view by clicking on Routes in left side of the navigation bar.

  • Click on the Route name or pencil icon on which you want to add plugins.

  • Click on the Plugins tab.

  • Click on the + ADD PLUGIN button.

  • Now click on + icon of the plugin which you want to add.

6_plugins

Add Plugins Globally#

If a plugin is added globally, it will apply for all services and routes.

  • Go to Plugins view by clicking on Plugins in left side of the navigation bar.

  • Add Plugins by using the + ADD GLOBAL PLUGINS button.

  • Now click on + icon of the plugin which you want to add.

6_plugins_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 - -