Skip to content

Latest commit

 

History

History

policy-reference

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
description
Detailed documentation for all of Gravitee's policies

Policy Reference

Overview

Gravitee policies fall into several functional categories: security, transformation, restrictions, performance, routing, and monitoring & testing. Although the implementation details of each policy are unique, they share a common installation and deployment and are compatible with subsets of phases.

{% hint style="info" %} Policies cannot currently be applied to v4 TCP proxy APIs {% endhint %}

Policyv2 APIv4 HTTP proxy APIv4 message API
API Keytruetruefalse
Assign Attributestruetruetrue
Assign Contenttruetruetrue
Assign Metricstruetruetrue
AVRO to JSONtruetruetrue
AVRO to Protobuftruetruetrue
AWS Lambdatruefalsefalse
Basic Authenticationtruetruefalse
Cachetruefalsefalse
Circuit Breakertruefalsefalse
Cloud Eventsfalsefalsetrue
Custom Query Parameters Parsertruetruefalse
Data Logging Maskingtruefalsefalse
Dynamic Routingtruetruefalse
Generate HTTP Signaturetruetruefalse
Generate JWTtruetruefalse
GeoIP Filteringtruetruefalse
GraphQL Rate Limittruetruefalse
Groovytruetruetrue
HTML to JSONtruetruefalse
HTTP Callouttruetruefalse
HTTP Signaturetruetruefalse
Interrupttruetruefalse
IP Filteringtruetruefalse
Javascripttruetruefalse
JSON to JSONtruetruetrue
JSON to XMLtruetruetrue
JSON Threat Protectiontruetruefalse
JSON Validationtruetruefalse
JSON Web Signaturetruetruefalse
JSON Web Tokentruetruefalse
Keylesstruetruefalse
Latencytruetruetrue
Message Filteringfalsefalsetrue
Metrics Reportertruefalsefalse
Mocktruefalsefalse
OAS Validationtruetruefalse
OAuth2truetruefalse
OpenID Connect UserInfotruetruefalse
Override HTTP Methodtruetruefalse
Protobuf to JSONtruetruetrue
Rate Limittruetruefalse
Regex Threat Protectiontruetruefalse
Request Content Limittruetruefalse
Request Validationtruetruefalse
Resource Filteringtruetruefalse
REST to SOAPtruetruefalse
Retrytruefalsefalse
Role-based Access Controltruetruefalse
SSL Enforcementtruetruefalse
Traffic Shadowingtruefalsefalse
Transform Headerstruetruetrue
Transform Query Paramstruetruefalse
URL Rewritingtruetruefalse
WS Security Authenticationtruetruefalse
XML to JSONtruetruetrue
XML Threat Protectiontruetruefalse
XML Validationtruetruefalse
XSLTtruetruefalse

Installation and deployment

Each version of Gravitee API Management (APIM) includes a number of policies in the default distribution. Gravitee Enterprise Edition policy plugins are available for download here.

To use a different version of the policy or add a custom policy, you can follow the deployment instructions below.

How to deploy a plugin

Please check the policy documentation to ensure the policy version you select is compatible with your version of APIM.

To deploy the plugin, follow these steps:

  1. Download the plugin archive (a .zip file) from the plugins download page.
  2. Add the file into the Gateway and Management API plugins folders. The default location is ${GRAVITEE_HOME/plugins} but this can be modified in the gravitee.yaml file. For most installations, the Gateway and Management API plugins folders are at /gravitee/apim-gateway/plugins and /gravitee/apim-management-api/plugins, respectively.
  3. Restart your APIM nodes.

Configuration

Policies can be added to flows that are assigned to an API or to a plan. Gravitee supports configuring policies through the Policy Studio in the Management Console or interacting directly with the Management API.

Phases

Policies can be applied to the request or the response of a Gateway API transaction, which are broken up into phases that depend on the API definition version. Each policy is compatible with a subset of the available phases.

{% tabs %} {% tab title="v4 API definition" %} v4 APIs have the following phases:

  • onRequest: This phase is executed before invoking the backend services for both proxy and message APIs. Policies can act on the headers and the content for proxy APIs.
  • onMessageRequest: This phase occurs after the onRequest phase and allows policies to act on each incoming message before being sent to the backend service. This only applies to message APIs.
  • onResponse: This phase is executed after invoking the backend services for both proxy and message APIs. Policies can act on the headers and the content for proxy APIs.
  • onMessageResponse: This phase after the onResponse phase and allows policies to act on each outgoing message before being sent to the client application. This only applies to message APIs. {% endtab %}

{% tab title="v2 API definition" %} v2 APIs have the following phases:

  • onRequest: This phase only allows policies to work on request headers. It never accesses the request body.
  • onRequestContent: This phase always occurs after the onRequest phase. It allows policies to work at the content level and access the request body.
  • onResponse: This phase only allows policies to work on response headers. It never accesses the response body.
  • onResponseContent: This phase always occurs after the onResponse phase. It allows policies to work at the content level and access the response body. {% endtab %} {% endtabs %}