Package org.apache.synapse.mediators.opa

# Interface OPARequestGenerator

All Known Implementing Classes:
  `OPASynapseRequestGenerator`

public interface OPARequestGenerator
OPA request generator interface to handle OPA policy validation payload and validation response

- ## Method Summary

  Modifier and Type
  Method
  Description
  `String`
  `generateRequest(String policyName, String rule, Map<String,String> additionalParameters, org.apache.synapse.MessageContext messageContext)`
  Generate the OPA request payload from the provided message context and the additional Properties Map
  `boolean`
  `handleResponse(String policyName, String rule, String opaResponse, Map<String,String> additionalParameters, org.apache.synapse.MessageContext messageContext)`
  Handle the OPA response based on the implementation

- ## Method Details

  - ### generateRequest

    String generateRequest(String policyName, String rule, Map<String,String> additionalParameters, org.apache.synapse.MessageContext messageContext) throws OPASecurityException
    Generate the OPA request payload from the provided message context and the additional Properties Map
    Parameters:
      `policyName` - Name of the policy validated
      `rule` - The rule of the policy
      `additionalParameters` - Additional parameters that can be used to construct the opa payload
      `messageContext` - The message to be validated with OPA server
    Returns:
      json input as a string and this will be sent to the OPA server for validation
    Throws:
      `OPASecurityException` - If an authentication failure or some other error occurs

  - ### handleResponse

    boolean handleResponse(String policyName, String rule, String opaResponse, Map<String,String> additionalParameters, org.apache.synapse.MessageContext messageContext) throws OPASecurityException
    Handle the OPA response based on the implementation
    Parameters:
      `policyName` - Name of the policy validated
      `rule` - The rule of the policy
      `opaResponse` - The message to be authenticated
      `additionalParameters` - Additional parameters that can be used to handle the the opa response
      `messageContext` - The message to be authenticated
    Returns:
      true if the authentication is successful
    Throws:
      `OPASecurityException` - If an authentication failure or some other error occurs