Package org.apache.synapse.mediators.opa
Class OPAClient
- java.lang.Object
-
- org.apache.synapse.mediators.opa.OPAClient
-
public class OPAClient extends Object
This class represents the client used to request and retrieve OPA response for a given policy from the OPA server
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.apache.http.impl.client.CloseableHttpClient
createHttpClient(String url)
Return a CloseableHttpClient instanceString
publish(String opaServerUrl, String payload, String credentials)
Method to publish the OPA payload to the OPA server
-
-
-
Constructor Detail
-
OPAClient
public OPAClient(String url, Map<String,String> additionalParameters) throws OPASecurityException
- Throws:
OPASecurityException
-
-
Method Detail
-
publish
public String publish(String opaServerUrl, String payload, String credentials) throws OPASecurityException
Method to publish the OPA payload to the OPA server- Parameters:
opaServerUrl
- The url of the opa serverpayload
- The payload of the requestcredentials
- Access key of the opa validation request- Returns:
- opa response String
- Throws:
OPASecurityException
-
createHttpClient
public org.apache.http.impl.client.CloseableHttpClient createHttpClient(String url) throws OPASecurityException
Return a CloseableHttpClient instance- Parameters:
url
- Service endpoint.It can be http/https- Returns:
- CloseableHttpClient
- Throws:
OPASecurityException
-
-