1 Reply Latest reply on Dec 20, 2015 8:36 AM by Arkady Zelekman

    Wildfly - get username/password from security context into jndi invocation interceptor

    Arkady Zelekman Newbie

      Hi,

       

      I have a simple client application (not web) which puts username and password into security context and I want to read them from jndi invocation interceptor on Wildfly side.

      My problem is: it comes to my interceptor, but without this information (or I just don't know how to read it).

       

      My Wildfly version is 8.2.0

       

      CLIENT APPLICATION:

       

      SecurityContextAssociation.setClient();

      SecurityClient client = SecurityClientFactory.getSecurityClient();

      client.setVmwideAssociation(true);

      client.setSimple(myUsername, myPassword);

      client.login();

      .........

      Do some jndi invocation.

       

      SERVER APPLICATION:

       

      public class MyInterceptor {

           @Resource

           SessionContext ctx;

       

             @AroundInvoke

             public Object validate(InvocationContext invocationContext) throws Exception {

                     Principal principal = ctx.getCallerPrincipal(); //NOT CONTAIN myUsername

                     SecurityContextAssociation.getPrincipal(); //NOT CONTAIN myUsername


                }

      }

       

      P.S. Client application gets username and password as input from user, we don't know in advance which values we can get, so we don't want to add new users into ../configuration/application-users.properties

       

      May be something is missing in standalone.xml  or something wrong on client application ? (We would prefer not to change code of client application...).

       

      Do you have any suggestions ?

       

      Thank you in advance.