Skip to main content
Feedback

Design and Implementation

Policy Structure

Policy can be defined in the below structure:

[

[ {Policy1 Parameters},{Policy2 Parameters} ],

[{Policy 3 Parameters}]

]

ref1

Important Points about Policy Structure

  • Policy for API is defined under pre-input parameter Policies.

  • Policies should contain valid JSON array.

  • Policies consists of two types of JSON arrays:

    • Primary JSON array and secondary JSON array.

    • Primary JSON Array is the main JSON array defined under Policies. Each element of Primary JSON array can contain secondary JSON array, which is JSON array of policies.

  • For elements of Primary JSON array, evaluation is done in AND manner while for element of Secondary JSON Array, evaluation is done in OR manner.

    • This means you can define above policy structure as ((Policy1 || Policy2) && Policy3).
  • In case any element of Primary JSON array is not successfully evaluated, then further elements of Primary JSON Array are not evaluated because evaluation manner for Primary JSON Array is AND.

  • Policy is evaluated in the order in which they are defined, for example, policy, which is specified first is evaluated first.

  • If none of the parameters for policy are defined, then that policy is ignored. For the following example configuration, if statusMessage for response equals Success, then the call is forwarded otherwise, the call is blocked.

[
[{}],
[{
"Name": "Match",
"Operation": "ContainsAll",
"Context": "Response",
"ArgumentLocation": "${response.statusMessage}",
"MatchExpression": ["Success"],
"Effect" : "Allow"
}]
]

Context Object Structure

Request Object Structure

ref2

Request Object Description

S#Request Object Field NameField DescriptionField Name in RequestArgument Location Example
1MethodContains HTTP method like GET, POSTmethod${request.method}
2URIContains request uri like /aj2068?api_key=g8nftwaew4srgh6p95k7d4cdURI${request.URI}
3Remote AddressContains origin server IPremoteAddr${request.remoteAddr}
4VersionContains HTTP version for request, such as HTTP/1.1version${request.version}
5HeadersContains all request headersheaders${request.headers.get('Header Name')}
note

Only field names listed in above table is supported for match policy for Request context.

Response Object Structure

ref2

Response Object Description

S#Request Object Field NameField DescriptionField Name in RequestArgument Location Example
1Response Status MessageContains response status messagestatusMessage${response.statusMessage}
2VersionContains HTTP version for response like HTTP/1.1version${response.version}
3Response Status CodeContains response status codestatusCode${response.statusCode}
4HeadersContains all response headersheaders${response.headers.get('Header Name')}
note

Only field names listed in above table is supported for match policy for Response context.

Error Messages

Error NameHTTP Status CodeCause
PolicyFailure403Defined policies are not evaluated successfully.
InvalidJSONForPolicy403Defined policies are not in valid JSON format.
InvalidJSONFormatForPolicy403JSON for policies is valid but policies are not defined as List in defined JSON.
InvalidPolicyName403Policy name for any one of the defined policy is not correct.
PolicyNameNotSpecified403Policy name for any one of the defined policy is not specified.
InvalidMatchPolicyOperation403Match operation for any one of the defined match policy is not correct.
MatchPolicyOperationNotSpecified403Match operation for any one of the defined match policy is not specified.
InvalidMatchPolicyContext403Context for any one of the defined match policy is not correct.
MatchPolicyContextNotSpecified403Context for any one of the defined match policy is not specified.
MatchPolicyContextUnavailable403Required Context is not configured in policy.
InvalidMatchPolicyArgumentLocation403Argument Location for any one of the defined match policy is not defined as String.
MatchPolicyArgumentLocationNotSpecified403Argument Location for any one of the defined match policy is not specified.
InvalidMatchPolicyExpression403Match Expression for any one of the defined match policy is not defined as list.
MatchPolicyExpressionNotSpecified403Match Expression for any one of the defined match policy is not specified.
MatchExpressionNotEvaluatedAsString403Match Expression should be defined as an array of list. If that list does not contain String value, this exception is thrown.
MatchPolicyArgumentLocationEvaluationError403Java unified expression for argument location for any one of the defined match policy is not evaluated successfully or argument location evaluation does not result in string, integer, array of string or array of integer.
ArgumentDoesNotContainAnyDefinedMatchExpression403Argument Does not matches with any defined expression for match policy type ContainsAny.
ArgumentDoesNotContainAllDefinedMatchExpressions403Argument Does not matches with any defined expression for match policy type ContainsAll.
MatchOperationNotSupportedForPayload403Match Operation is not supported for payload processing.
MatchOperationSupportedOnlyForPayload403Match Operation only supports payload processing.
InvalidMatchPolicyEffect403Value in the effect parameter of match policy defined anything except Allow, Deny.
AccessDeniedDueToMatchPolicyDenyEffect403Call is blocked as one of the defined match policy with effect as "Deny" has been evaluated successfully.
On this Page