1.)  The apps in the IFRAMEs don't belong to me and I have no influence on the design of those servers.
2.)  The login at HostA is arbitrary and slightly irrelevant; It's kind of like, I have subscriptions to four commercial sites        that use Basic/SSL validation and
I want to condense the logins into a single one of my choosing.
Ahhh, then on portal you'll have to save the login info somewhere and supply it to the other hosts. I think the key that you need to know is how to use basic auth.
Does something like this not work for you?
my $req = new HTTP::Request('GET', $url_1);
$uid = 'user1';
$pass = 'pass1';
$req->authorization_basic($uid, $pass);