You have to look at the Tomcat authentication process.
JBoss Portal rely on this common feature of Tomcat to get the authentication done.
Look at the /deploy/jboss-portal.sar/portal-server.war war to see how it is done.
The web.xml define the authentication requierments and process.
Then it is as any web servlet application. (that is I don't really know how to... ;-)
Look also at the login.jsp in this war.
It is in the form of this jsp (called by tomcat, not by the portal) that the password is sent back to the server.
You may find a way to retrieve the password...