I have a login page in Worklight that sets the active user on the worklight server. This sets a userIdentity. In this userIdentity I save an encrypted string of 'username:password'.
Every time an adapterprocedure is called it tests if a user is logged in. When he is logged in, the procedure is called.
In the back-end I use basic authentication for every REST call. So I need in every call's header ->
Authorization: Basic encrypted(username:password)
When I mock this, everything works. Example ->
var input = {
method : 'get',
returnedContentType : 'json',
path : path,
headers:{
Authorization: "Basic "+"dGVzdDp0ZXN0"
}
I need to set, that everytime a procedure is called, this 'username:password' is the username:password from the userIdentity of the user that is logged in in the worklightserver.
How can I do this?
Authorizing HTTP Adapter in IBM Worklight
Here they use $( username ), but I don't know where the $ sign is referring to.