First, you should use "Authorization" and not "Authentication" as described here: http://en.wikipedia.org/wiki/Basic_access_authentication
In addition, you should do the following:
Create a Java class, something like this (you need to clean and adjust it):
public class Idan {
public String basicHash(String user, String password) {
BASE64Encoder base64Encoder = new BASE64Encoder();
String authorization = user + ":" + password;
return base64Encoder.encode(authorization.getBytes());
}
public static void main(String[] args) {
Idan i = new Idan();
System.out.println(i.basicHash("idan", "somepassword"));
}
}
In the adapter .js file, declare globally:
var idan = new org.Idan();
And the procedure:
function test(){
WL.Logger.debug(idan.basicHash("username_test", "secret_password"));
}
source
share