1 Reply Latest reply on Mar 31, 2011 5:16 AM by Johan Andrén

    Custom principal from standalone client

    Johan Andrén Newbie

      We are working on a standalone swing client for our own enterprise application running on jboss. From the information available on the net we have managed to get simple authentication against database tables with jboss up and running without much fuss.


      The problem is that we need an additional property on our Principal. The property is a code that specifies which set of our pretty complex configuration rules should apply for a specific user session.


      We have implemented our own Principal and subclassed DatabaseServerLoginModule to create an instance of it instead of the default principal. The problem is that the additional property is not a property of the user in the user database but rather a runtime property that the user sets in the login dialog when starting the application. This is solved by doing a remote ejb-call directly after the initial context is setup that sets the 'code'.


      There must be a better way to do this, we have tried to set initialcontext properties but they do not seem accessible from the LoginModule, we have tried creating the custom principal on the client side and sending that - no success.


      Can someone give us a good pointer to a good way to do this?

        • 1. Custom principal from standalone client
          Johan Andrén Newbie

          So, three years and five hundred reads but no one chiming in... To explain the final solution if anyone is interested:

           

          After having some problems with the above solution and remote client managing the transaction we changed our solution to actually concatenating the code with the username upon authentication and then a custom LoginModule that splits the username and configuration code and creates a custom principal which can then be used inside the JEE app.

           

          So the user logs in with "username1" "password1" and "code1" which becomes "username1:code1" before beeing given to the JBoss authentication classes on the client, the server module separates "username1" and "code1" again and creates a new instance of CustomPrincipal which has a field for code.