1 Reply Latest reply on Dec 15, 2006 3:46 AM by Michael Martinsen

    how to get username of logged in user

    Anoras Lorenzo Newbie


      I use authentication in my application this way:

      Hashtable props = new Hashtable();
      props.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");
      props.put(Context.SECURITY_PRINCIPAL, user);
      props.put(Context.SECURITY_CREDENTIALS, password);
      props.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.security.jndi.JndiLoginInitialContextFactory");
      props.put(Context.PROVIDER_URL, "jnp://" + readingPropertiesForConnection() + ":" + "1099");
      Context ctx = new InitialContext(props);
      dispecerat = (DispeceratEntityManager) ctx.lookup("capitol/DispeceratEntityManagerBean/remote");

      and define the users and roles in the user.properties and roles.properties property files. What I want is to log user actions on the server which is running jboss. So in the business methods of my session bean I want to find out what user is requesting the operation to log the user requesting the operation. How could I do this? Thanks.