Hi,
I am trying to implement a standalone client application that is able to login to multiple JBoss 3.0 servers using JBossSX. The logins must be active concurrently and the desired scenario would be to create a LoginContext for each server prior to getting the InitialContext and to switch between them as EJB calls are made to a paricular server. Obviously it would not be very convenient or efficient to create a new LoginContext and recreate the IntialContext prior to each EJB call.
I have not tried coding any this yet and I still have a basic mystery around the magic of how the LoginContext and the IntialContext relate, and how the Subject ultimately gets passed over to the serverside during the EJB call.
One solution I have considered is to cache the JASS particulars with calls such as:
Object currentCredential = org.jboss.security.SecurityAssociation.getCredential();
java.security.Principal currentPrincipal = org.jboss.security.SecurityAssociation.getPrincipal();
javax.security.auth.Subject currentSubject = org.jboss.security.SecurityAssociation.getSubject();
when I intially create the connection to a particular server and to reinstate them before each EJB call to that particular server. This approach seems a littler heavy handed and I am not even certian yet that it will produce the desired effect.
Is there a better way to accomplish this?
Thanks for your thoughts.
- joel