Nikita Petrov
Nikita Petrov

Reputation: 173

How to implement HTTP basic auth in Mule ESB http:request

I'm using HTTP request in Mule ESB and need to implement HTTP basic auth in it. Now I do this by using explicit authorization header:

            <http:request config-ref="HTTP_Request_Configuration" path="/activiti-rest/service/runtime/process-instances" method="POST" doc:name="Request to BPM">
                <http:request-builder>
                    <http:header headerName="Authorization" value="Basic a2VybWl0OnBhc3N3b3JkMQ=="/>
                </http:request-builder>
            </http:request>

Is there any direct way to enter user and password for basic auth in Mule http:request?

Upvotes: 0

Views: 2751

Answers (1)

Ryan Carter
Ryan Carter

Reputation: 11606

There sure is:

<http:request-config name="basicConfig" host="localhost" port="${httpPort}">
        <http:basic-authentication username="#[user]" password="#[password]" preemptive="#[preemptive]" />
    </http:request-config>

Upvotes: 3

Related Questions