Sometimes when working on a portal implementation project you need to show an external page that has been protected by BASIC authentication. For connecting to page protected by form based authentication the AppIntegrator works fine, however it fails for a basic authentication page.
This is because Microsoft has applied security patch applied to the IE that prevents sending the username and password in the URL directly like this https://username:email@example.com@server.com.
The only alternative is to send the username and password in the HTTP headers of the request. Also the username/password combination should be BASE64 encoded.
Here’s how you can do it in your abstract portal component.
In the lines
String userPassword = “username:password”;
String encoding = new sun.misc.BASE64Encoder().encode (userPassword.getBytes());
we are creating the credentials string and encoding it using the BASE64 encoding.
And in the line
uc.setRequestProperty (“Authorization”, “Basic ” + encoding);
we are adding the encoded credentials string to the HTTP request headers.
Now you should be able to see the web pages that require BASIC authentication.