Basically it is an extension of my previous question: How to read REST service that returns JSON object and store the same into PostgreSQL using Mule ESB, Mule Studio
I have some REST services being running at "http://localhost:35798/RestServiceImpl.svc/json/567"
Now in order to access those services, I need to authenticate as admin. The credentials are
User Name: admin
Password: pwd
The flow (existing) should be able to handle authentication & establish session via REST.
How to do authentication using Mule? The flow will stop if authentication fails. Else after successful authentication, it will read the REST service and will insert the data into PostgreSQL.
Put the credentials in the outbound endpoint URI:
http://admin:pwd@localhost:35798/RestServiceImpl.svc/json/567
You can of course use properties to avoid hard-coding them in the Mule config:
http://${rest.admin.username}:${rest.admin.password}@localhost:35798/RestServiceImpl.svc/json/567