Skip to content

gravitee-io/gravitee-policy-template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Gravitee Policy Template

Phases

onRequest onResponse onMessageRequest onMessageResponse

X

X

X

X

Description

A policy template to fork and use as a quick starter.

This policy will compare X-Template-Policy header value with its configuration errorKey field, if both values are equal, then the policy will interrupt the request with a failure execution error.

Implements TemplatePolicy#onRequest(HttpExecutionContext context) and TemplatePolicy#onResponse(HttpExecutionContext context) to develop your own policy.

Note
This policy is designed to work with at least APIM 4.0.0.

AM and APIM V2 API compatibility

To develop a policy working with AM or a v2 definition of an API in APIM, please follow the v3 example implementation of the policy.

Configuration

You can configure the policy with the following options:

Property Required Description Type Default

errorKey

X

Policy will fail if header X-Template-Policy value is equal to this field.

string

"failure"

Example configuration:

{
    "configuration": {
        "errorKey": "value-to-fail-the-policy"
    }
}

Errors

With the provided default implementation, policy will fail if header X-Template-Policy value is equal to configured errorKey value.

Phase Code Error template key Description

REQUEST

400 - BAD REQUEST

POLICY_TEMPLATE_ERROR_KEY

An error occurs during request

RESPONSE

500 - INTERNAL SERVER ERROR

POLICY_TEMPLATE_ERROR_KEY

An error occurs during response

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages