Regarding your query u have various links which deals with subject bein propagated. U need to use a modify in login-config.xml which include ClientLoginModule which will make ur things done.
For further details u can check
Also the whole source code with proper discussion are here on this link and even the souce code is there in zip files attached in one of the reply
Hope this helps.