Hello,
I am trying to connect to an application that accepts basic authentication. I am able to authenticate and retrieve data without any issue when I provide
Authorization: Basic XXXXXXXXX
in the header as a mapped entity.
The problem is, the passwords are subject to change and we maintain them in an ini file. I have a script task that get the base64 encoded value from an ini and save it in an execution variable.
How can I use this variable in the header ?
I have tried freemarker. But that dosent seems to map
" org.camunda.bpm.engine.rest.exception.ExceptionHandler.toResponse java.lang.ClassCastException: java.lang.String cannot be cast to java.util.Map"
<bpmn:serviceTask id=“clone_vm” name=“Clone VM”>
bpmn:extensionElements
camunda:connector
camunda:inputOutput
<camunda:inputParameter name=“url”>https://192.168.1.201/post/cloneVm</camunda:inputParameter>
<camunda:inputParameter name=“method”>POST</camunda:inputParameter>
<camunda:inputParameter name=“headers”>
<camunda:script scriptFormat=“freemarker” resource=“header.ftl” />
</camunda:inputParameter>
The template file(header.ftl) looks like
Content-Type: application/json
accept: application/json
Authorization: Basic ${da_user}
The ${da_user} is an execution variable set using the below script
static void main(String[] args) {
def sout = new StringBuilder(), serr = new StringBuilder()
def proc = 'bash /etc/gasf/drupal-admin.sh'.execute()
proc.consumeProcessOutput(sout, serr)
proc.waitForOrKill(1000)
execution.setVariable("da_user", sout)
}
Any assistance would be much appreciated.