{
  "encassConfigs": [
    {
      "goid": "1b0856ed46c14522b6a3ab83b1afd79c",
      "guid": "d2bbbaab-0f14-45ef-a766-6e549fbfc0ae",
      "name": "APIKeyValidation-1.0",
      "checksum": "9b81b69215a2b9bebc7425a5a606c17e9ec8284f",
      "description": "Validates that an incoming API key, supplied in the 'apikey' HTTP header or 'apikey' query parameter, is valid and authorized for the managed API.",
      "policyName": "APIKeyValidation-1.0",
      "encassArgs": [
        {
          "name": "portal.managed.service.apiId",
          "type": "STRING",
          "ordinal": 1,
          "guiPrompt": false
        }
      ],
      "encassResults": [
        {
          "name": "apiKeyRecord.accountPlanMappingId",
          "type": "STRING"
        },
        {
          "name": "apiKeyRecord.accountPlanMappingName",
          "type": "STRING"
        },
        {
          "name": "apiKeyRecord.hashingMetadata",
          "type": "STRING"
        },
        {
          "name": "apiKeyRecord.id",
          "type": "STRING"
        },
        {
          "name": "apiKeyRecord.key",
          "type": "STRING"
        },
        {
          "name": "apiKeyRecord.plan",
          "type": "STRING"
        },
        {
          "name": "apiKeyRecord.platform",
          "type": "STRING"
        },
        {
          "name": "apiKeyRecord.secret",
          "type": "STRING"
        },
        {
          "name": "apiKeyRecord.status",
          "type": "STRING"
        },
        {
          "name": "apiKeyRecord.version",
          "type": "STRING"
        },
        {
          "name": "apiKeyRecord.xml",
          "type": "STRING"
        },
        {
          "name": "content-type",
          "type": "STRING"
        },
        {
          "name": "custom_data",
          "type": "STRING"
        },
        {
          "name": "error.code",
          "type": "STRING"
        },
        {
          "name": "error.msg",
          "type": "STRING"
        },
        {
          "name": "errorMsg",
          "type": "STRING"
        },
        {
          "name": "external.client_id",
          "type": "STRING"
        },
        {
          "name": "external.error.code",
          "type": "STRING"
        },
        {
          "name": "external.error.message",
          "type": "STRING"
        },
        {
          "name": "external.issuer",
          "type": "STRING"
        },
        {
          "name": "external.scope",
          "type": "STRING"
        },
        {
          "name": "portal.analytics.action",
          "type": "STRING"
        },
        {
          "name": "portal.analytics.api.uuid",
          "type": "STRING"
        },
        {
          "name": "portal.analytics.apikey",
          "type": "STRING"
        },
        {
          "name": "portal.analytics.application.name",
          "type": "STRING"
        },
        {
          "name": "portal.analytics.application.uuid",
          "type": "STRING"
        },
        {
          "name": "portal.analytics.authType",
          "type": "STRING"
        },
        {
          "name": "portal.analytics.organization.name",
          "type": "STRING"
        },
        {
          "name": "portal.analytics.organization.uuid",
          "type": "STRING"
        },
        {
          "name": "status",
          "type": "STRING"
        }
      ],
      "properties": [
        {
          "name": "allowTracing",
          "value": "false"
        },
        {
          "name": "paletteFolder",
          "value": "customAssertions"
        },
        {
          "name": "passMetricsToParent",
          "value": "false"
        }
      ]
    }
  ],
  "policies": [
    {
      "goid": "fa3ec26ec4ec4d9c9b7665ca47457a20",
      "guid": "6c7281a3-e9ec-4df8-a1b7-eb01579a62e4",
      "name": "APIKeyValidation-1.0",
      "policyType": "FRAGMENT",
      "checksum": "e5fc780414dcbc9f2b625fb87d4bafd9dbeb7b4f",
      "version": 3,
      "enabled": true,
      "folderPath": "/Portal Templates",
      "soap": false,
      "policy": {
        "xml": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<wsp:Policy xmlns:L7p=\"http://www.layer7tech.com/ws/policy\" xmlns:wsp=\"http://schemas.xmlsoap.org/ws/2002/12/policy\">\n    <wsp:All wsp:Usage=\"Required\">\n        <L7p:SetVariable>\n            <L7p:Base64Expression stringValue=\"QVBJX0tFWQ==\"/>\n            <L7p:VariableToSet stringValue=\"portal.analytics.authType\"/>\n        </L7p:SetVariable>\n        <L7p:SetVariable>\n            <L7p:Base64Expression stringValue=\"JHtwb3J0YWwubWFuYWdlZC5zZXJ2aWNlLmFwaUlkfQ==\"/>\n            <L7p:VariableToSet stringValue=\"portal.analytics.api.uuid\"/>\n        </L7p:SetVariable>\n        <L7p:SetVariable>\n            <L7p:Base64Expression stringValue=\"\"/>\n            <L7p:VariableToSet stringValue=\"errorMsg\"/>\n        </L7p:SetVariable>\n        <L7p:SetVariable>\n            <L7p:Base64Expression stringValue=\"\"/>\n            <L7p:VariableToSet stringValue=\"lookupApiKey\"/>\n        </L7p:SetVariable>\n        <wsp:OneOrMore wsp:Usage=\"Required\">\n            <wsp:All wsp:Usage=\"Required\">\n                <L7p:ComparisonAssertion>\n                    <L7p:CaseSensitive booleanValue=\"false\"/>\n                    <L7p:Expression1 stringValue=\"${request.http.header.apikey}\"/>\n                    <L7p:Operator operatorNull=\"null\"/>\n                    <L7p:Predicates predicates=\"included\">\n                        <L7p:item dataType=\"included\">\n                            <L7p:Type variableDataType=\"string\"/>\n                        </L7p:item>\n                        <L7p:item binary=\"included\">\n                            <L7p:CaseSensitive booleanValue=\"false\"/>\n                            <L7p:Negated booleanValue=\"true\"/>\n                            <L7p:Operator operator=\"EMPTY\"/>\n                            <L7p:RightValue stringValue=\"\"/>\n                        </L7p:item>\n                    </L7p:Predicates>\n                </L7p:ComparisonAssertion>\n                <L7p:SetVariable>\n                    <L7p:Base64Expression stringValue=\"JHtyZXF1ZXN0Lmh0dHAuaGVhZGVyLmFwaWtleX0=\"/>\n                    <L7p:VariableToSet stringValue=\"lookupApiKey\"/>\n                </L7p:SetVariable>\n            </wsp:All>\n            <wsp:All wsp:Usage=\"Required\">\n                <L7p:ComparisonAssertion>\n                    <L7p:CaseSensitive booleanValue=\"false\"/>\n                    <L7p:Expression1 stringValue=\"${request.http.parameter.apikey}\"/>\n                    <L7p:Operator operatorNull=\"null\"/>\n                    <L7p:Predicates predicates=\"included\">\n                        <L7p:item dataType=\"included\">\n                            <L7p:Type variableDataType=\"string\"/>\n                        </L7p:item>\n                        <L7p:item binary=\"included\">\n                            <L7p:CaseSensitive booleanValue=\"false\"/>\n                            <L7p:Negated booleanValue=\"true\"/>\n                            <L7p:Operator operator=\"EMPTY\"/>\n                            <L7p:RightValue stringValue=\"\"/>\n                        </L7p:item>\n                    </L7p:Predicates>\n                </L7p:ComparisonAssertion>\n                <L7p:SetVariable>\n                    <L7p:Base64Expression stringValue=\"JHtyZXF1ZXN0Lmh0dHAucGFyYW1ldGVyLmFwaWtleX0=\"/>\n                    <L7p:VariableToSet stringValue=\"lookupApiKey\"/>\n                </L7p:SetVariable>\n            </wsp:All>\n            <L7p:SetVariable>\n                <L7p:Base64Expression stringValue=\"QVBJIGtleSBpcyBtaXNzaW5nIGZyb20gcmVxdWVzdA==\"/>\n                <L7p:VariableToSet stringValue=\"errorMsg\"/>\n            </L7p:SetVariable>\n        </wsp:OneOrMore>\n        <wsp:OneOrMore wsp:Usage=\"Required\">\n            <wsp:All wsp:Usage=\"Required\">\n                <L7p:ComparisonAssertion>\n                    <L7p:CaseSensitive booleanValue=\"false\"/>\n                    <L7p:Expression1 stringValue=\"${errorMsg}\"/>\n                    <L7p:Operator operatorNull=\"null\"/>\n                    <L7p:Predicates predicates=\"included\">\n                        <L7p:item dataType=\"included\">\n                            <L7p:Type variableDataType=\"string\"/>\n                        </L7p:item>\n                        <L7p:item binary=\"included\">\n                            <L7p:Operator operator=\"EMPTY\"/>\n                            <L7p:RightValue stringValue=\"\"/>\n                        </L7p:item>\n                    </L7p:Predicates>\n                </L7p:ComparisonAssertion>\n                <L7p:Encapsulated>\n                    <L7p:EncapsulatedAssertionConfigGuid stringValue=\"b74008fa-97b2-4556-9b5b-30e057641570\"/>\n                    <L7p:EncapsulatedAssertionConfigName stringValue=\"Portal API Key Look Up (Generic)\"/>\n                    <L7p:Parameters mapValue=\"included\">\n                        <L7p:entry>\n                            <L7p:key stringValue=\"apikey\"/>\n                            <L7p:value stringValue=\"${lookupApiKey}\"/>\n                        </L7p:entry>\n                        <L7p:entry>\n                            <L7p:key stringValue=\"serviceid\"/>\n                            <L7p:value stringValue=\"${portal.managed.service.apiId}\"/>\n                        </L7p:entry>\n                    </L7p:Parameters>\n                </L7p:Encapsulated>\n                <wsp:OneOrMore wsp:Usage=\"Required\">\n                    <wsp:All wsp:Usage=\"Required\">\n                        <L7p:ComparisonAssertion>\n                            <L7p:CaseSensitive booleanValue=\"false\"/>\n                            <L7p:Expression1 stringValue=\"${apiKeyRecord.found}\"/>\n                            <L7p:Operator operatorNull=\"null\"/>\n                            <L7p:Predicates predicates=\"included\">\n                                <L7p:item dataType=\"included\">\n                                    <L7p:Type variableDataType=\"string\"/>\n                                </L7p:item>\n                                <L7p:item binary=\"included\">\n                                    <L7p:CaseSensitive booleanValue=\"false\"/>\n                                    <L7p:RightValue stringValue=\"true\"/>\n                                </L7p:item>\n                            </L7p:Predicates>\n                        </L7p:ComparisonAssertion>\n                        <L7p:ComparisonAssertion>\n                            <L7p:CaseSensitive booleanValue=\"false\"/>\n                            <L7p:Expression1 stringValue=\"${apiKeyRecord.service}\"/>\n                            <L7p:Operator operatorNull=\"null\"/>\n                            <L7p:Predicates predicates=\"included\">\n                                <L7p:item dataType=\"included\">\n                                    <L7p:Type variableDataType=\"string\"/>\n                                </L7p:item>\n                                <L7p:item binary=\"included\">\n                                    <L7p:CaseSensitive booleanValue=\"false\"/>\n                                    <L7p:RightValue stringValue=\"${portal.managed.service.apiId}\"/>\n                                </L7p:item>\n                            </L7p:Predicates>\n                        </L7p:ComparisonAssertion>\n                        <L7p:ComparisonAssertion>\n                            <L7p:CaseSensitive booleanValue=\"false\"/>\n                            <L7p:Expression1 stringValue=\"${apiKeyRecord.status}\"/>\n                            <L7p:Operator operatorNull=\"null\"/>\n                            <L7p:Predicates predicates=\"included\">\n                                <L7p:item dataType=\"included\">\n                                    <L7p:Type variableDataType=\"string\"/>\n                                </L7p:item>\n                                <L7p:item binary=\"included\">\n                                    <L7p:CaseSensitive booleanValue=\"false\"/>\n                                    <L7p:RightValue stringValue=\"active\"/>\n                                </L7p:item>\n                            </L7p:Predicates>\n                        </L7p:ComparisonAssertion>\n                    </wsp:All>\n                    <L7p:SetVariable>\n                        <L7p:Base64Expression stringValue=\"QVBJIGtleSBub3QgZm91bmQgb3IgaW52YWxpZA==\"/>\n                        <L7p:VariableToSet stringValue=\"errorMsg\"/>\n                    </L7p:SetVariable>\n                </wsp:OneOrMore>\n            </wsp:All>\n            <L7p:TrueAssertion/>\n        </wsp:OneOrMore>\n        <wsp:OneOrMore wsp:Usage=\"Required\">\n            <wsp:All wsp:Usage=\"Required\">\n                <L7p:ComparisonAssertion>\n                    <L7p:CaseSensitive booleanValue=\"false\"/>\n                    <L7p:Expression1 stringValue=\"${errorMsg}\"/>\n                    <L7p:Operator operatorNull=\"null\"/>\n                    <L7p:Predicates predicates=\"included\">\n                        <L7p:item dataType=\"included\">\n                            <L7p:Type variableDataType=\"string\"/>\n                        </L7p:item>\n                        <L7p:item binary=\"included\">\n                            <L7p:Operator operator=\"EMPTY\"/>\n                            <L7p:RightValue stringValue=\"\"/>\n                        </L7p:item>\n                    </L7p:Predicates>\n                </L7p:ComparisonAssertion>\n                <L7p:ComparisonAssertion>\n                    <L7p:CaseSensitive booleanValue=\"false\"/>\n                    <L7p:Expression1 stringValue=\"${apiKeyRecord.found}\"/>\n                    <L7p:Operator operatorNull=\"null\"/>\n                    <L7p:Predicates predicates=\"included\">\n                        <L7p:item dataType=\"included\">\n                            <L7p:Type variableDataType=\"string\"/>\n                        </L7p:item>\n                        <L7p:item binary=\"included\">\n                            <L7p:CaseSensitive booleanValue=\"false\"/>\n                            <L7p:RightValue stringValue=\"true\"/>\n                        </L7p:item>\n                    </L7p:Predicates>\n                </L7p:ComparisonAssertion>\n                <L7p:ComparisonAssertion>\n                    <L7p:CaseSensitive booleanValue=\"false\"/>\n                    <L7p:Expression1 stringValue=\"${apiKeyRecord.service}\"/>\n                    <L7p:Operator operatorNull=\"null\"/>\n                    <L7p:Predicates predicates=\"included\">\n                        <L7p:item dataType=\"included\">\n                            <L7p:Type variableDataType=\"string\"/>\n                        </L7p:item>\n                        <L7p:item binary=\"included\">\n                            <L7p:CaseSensitive booleanValue=\"false\"/>\n                            <L7p:RightValue stringValue=\"${portal.managed.service.apiId}\"/>\n                        </L7p:item>\n                    </L7p:Predicates>\n                </L7p:ComparisonAssertion>\n                <L7p:ComparisonAssertion>\n                    <L7p:CaseSensitive booleanValue=\"false\"/>\n                    <L7p:Expression1 stringValue=\"${apiKeyRecord.status}\"/>\n                    <L7p:Operator operatorNull=\"null\"/>\n                    <L7p:Predicates predicates=\"included\">\n                        <L7p:item dataType=\"included\">\n                            <L7p:Type variableDataType=\"string\"/>\n                        </L7p:item>\n                        <L7p:item binary=\"included\">\n                            <L7p:CaseSensitive booleanValue=\"false\"/>\n                            <L7p:RightValue stringValue=\"active\"/>\n                        </L7p:item>\n                    </L7p:Predicates>\n                </L7p:ComparisonAssertion>\n                <L7p:SetVariable>\n                    <L7p:Base64Expression stringValue=\"JHthcGlrZXlSZWNvcmQueG1sfQ==\"/>\n                    <L7p:ContentType stringValue=\"text/xml; charset=utf-8\"/>\n                    <L7p:DataType variableDataType=\"message\"/>\n                    <L7p:VariableToSet stringValue=\"recordXml\"/>\n                </L7p:SetVariable>\n                <L7p:ResponseXpathAssertion>\n                    <L7p:VariablePrefix stringValue=\"customFieldsMetadata\"/>\n                    <L7p:XmlMsgSrc stringValue=\"recordXml\"/>\n                    <L7p:XpathExpression xpathExpressionValue=\"included\">\n                        <L7p:Expression stringValue=\"/l7:ApiKey/l7:CustomMetaData\"/>\n                        <L7p:Namespaces mapValue=\"included\">\n                            <L7p:entry>\n                                <L7p:key stringValue=\"s\"/>\n                                <L7p:value stringValue=\"http://schemas.xmlsoap.org/soap/envelope/\"/>\n                            </L7p:entry>\n                            <L7p:entry>\n                                <L7p:key stringValue=\"l7\"/>\n                                <L7p:value stringValue=\"http://ns.l7tech.com/2012/04/api-management\"/>\n                            </L7p:entry>\n                        </L7p:Namespaces>\n                        <L7p:XpathVersion xpathVersion=\"XPATH_1_0\"/>\n                    </L7p:XpathExpression>\n                </L7p:ResponseXpathAssertion>\n                <L7p:SetVariable>\n                    <L7p:Base64Expression stringValue=\"JHtjdXN0b21GaWVsZHNNZXRhZGF0YS5yZXN1bHR9\"/>\n                    <L7p:VariableToSet stringValue=\"customFieldsMetadata\"/>\n                </L7p:SetVariable>\n                <wsp:OneOrMore wsp:Usage=\"Required\">\n                    <wsp:All wsp:Usage=\"Required\">\n                        <L7p:SetVariable>\n                            <L7p:Base64Expression stringValue=\"JHtjdXN0b21GaWVsZHNNZXRhZGF0YX0=\"/>\n                            <L7p:ContentType stringValue=\"application/json; charset=utf-8\"/>\n                            <L7p:DataType variableDataType=\"message\"/>\n                            <L7p:VariableToSet stringValue=\"customFieldsJson\"/>\n                        </L7p:SetVariable>\n                        <L7p:EvaluateJsonPathExpressionV2>\n                            <L7p:Evaluator stringValue=\"JsonPath\"/>\n                            <L7p:Expression stringValue=\"$._portalApplicationUuid\"/>\n                            <L7p:OtherTargetMessageVariable stringValue=\"customFieldsJson\"/>\n                            <L7p:Target target=\"OTHER\"/>\n                            <L7p:VariablePrefix stringValue=\"appUuid\"/>\n                        </L7p:EvaluateJsonPathExpressionV2>\n                        <L7p:SetVariable>\n                            <L7p:Base64Expression stringValue=\"JHthcHBVdWlkLnJlc3VsdH0=\"/>\n                            <L7p:VariableToSet stringValue=\"portal.analytics.application.uuid\"/>\n                        </L7p:SetVariable>\n                    </wsp:All>\n                    <L7p:SetVariable>\n                        <L7p:Base64Expression stringValue=\"JHthcGlLZXlSZWNvcmQuaWR9\"/>\n                        <L7p:VariableToSet stringValue=\"portal.analytics.application.uuid\"/>\n                    </L7p:SetVariable>\n                </wsp:OneOrMore>\n                <L7p:SetVariable>\n                    <L7p:Base64Expression stringValue=\"JHthcGlLZXlSZWNvcmQuaWR9\"/>\n                    <L7p:VariableToSet stringValue=\"portal.analytics.apikey\"/>\n                </L7p:SetVariable>\n                <L7p:SetVariable>\n                    <L7p:Base64Expression stringValue=\"JHthcGlLZXlSZWNvcmQubGFiZWx9\"/>\n                    <L7p:VariableToSet stringValue=\"portal.analytics.application.name\"/>\n                </L7p:SetVariable>\n                <L7p:SetVariable>\n                    <L7p:Base64Expression stringValue=\"JHthcGlLZXlSZWNvcmQuYWNjb3VudFBsYW5NYXBwaW5nSWR9\"/>\n                    <L7p:VariableToSet stringValue=\"portal.analytics.organization.uuid\"/>\n                </L7p:SetVariable>\n                <L7p:SetVariable>\n                    <L7p:Base64Expression stringValue=\"JHthcGlLZXlSZWNvcmQuYWNjb3VudFBsYW5NYXBwaW5nTmFtZX0=\"/>\n                    <L7p:VariableToSet stringValue=\"portal.analytics.organization.name\"/>\n                </L7p:SetVariable>\n            </wsp:All>\n            <wsp:All wsp:Usage=\"Required\">\n                <L7p:SetVariable>\n                    <L7p:Base64Expression stringValue=\"NDAx\"/>\n                    <L7p:VariableToSet stringValue=\"portal.analytics.response.code\"/>\n                </L7p:SetVariable>\n            </wsp:All>\n        </wsp:OneOrMore>\n        <L7p:ExportVariables>\n            <L7p:ExportedVars stringArrayValue=\"included\">\n                <L7p:item stringValue=\"apiKeyRecord.accountPlanMappingId\"/>\n                <L7p:item stringValue=\"apiKeyRecord.accountPlanMappingName\"/>\n                <L7p:item stringValue=\"apiKeyRecord.id\"/>\n                <L7p:item stringValue=\"apiKeyRecord.key\"/>\n                <L7p:item stringValue=\"apiKeyRecord.plan\"/>\n                <L7p:item stringValue=\"apiKeyRecord.status\"/>\n                <L7p:item stringValue=\"errorMsg\"/>\n                <L7p:item stringValue=\"portal.analytics.authType\"/>\n                <L7p:item stringValue=\"portal.analytics.api.uuid\"/>\n                <L7p:item stringValue=\"portal.analytics.apikey\"/>\n                <L7p:item stringValue=\"portal.analytics.application.uuid\"/>\n                <L7p:item stringValue=\"portal.analytics.application.name\"/>\n                <L7p:item stringValue=\"portal.analytics.organization.uuid\"/>\n                <L7p:item stringValue=\"portal.analytics.organization.name\"/>\n                <L7p:item stringValue=\"portal.analytics.response.code\"/>\n            </L7p:ExportedVars>\n        </L7p:ExportVariables>\n        <wsp:OneOrMore wsp:Usage=\"Required\">\n            <L7p:ComparisonAssertion>\n                <L7p:CaseSensitive booleanValue=\"false\"/>\n                <L7p:Expression1 stringValue=\"${errorMsg}\"/>\n                <L7p:Operator operatorNull=\"null\"/>\n                <L7p:Predicates predicates=\"included\">\n                    <L7p:item dataType=\"included\">\n                        <L7p:Type variableDataType=\"string\"/>\n                    </L7p:item>\n                    <L7p:item binary=\"included\">\n                        <L7p:Operator operator=\"EMPTY\"/>\n                        <L7p:RightValue stringValue=\"\"/>\n                    </L7p:item>\n                </L7p:Predicates>\n            </L7p:ComparisonAssertion>\n            <wsp:All wsp:Usage=\"Required\">\n                <L7p:CustomizeErrorResponse>\n                    <L7p:Content stringValue=\"${errorMsg}\"/>\n                    <L7p:ExtraHeaders nameValuePairArray=\"included\"/>\n                    <L7p:HttpStatus stringValue=\"401\"/>\n                </L7p:CustomizeErrorResponse>\n                <L7p:FalseAssertion/>\n            </wsp:All>\n        </wsp:OneOrMore>\n    </wsp:All>\n</wsp:Policy>\n"
      }
    }
  ],
  "properties": {
    "defaultAction": "NEW_OR_UPDATE",
    "meta": {
      "id": "0a3bab06-6fae-42eb-9d62-7c0091e614ed",
      "name": "Gateway Graphman Bundle - 2026-05-05T22:54:38.406Z",
      "schema": "11.2.1"
    },
    "mappings": {}
  }
}