0 Replies Latest reply on Jun 6, 2014 6:16 AM by Mylos Kathos

    Getting logged users: getSubject returns null

    Mylos Kathos Master

      Dear all,

      I need to log the user that has logged in certain parts of my code. So I've included a jboss-web.xml which is temporarly using the "other" security domain:

      <jboss-web>

      <security-domain>other</security-domain>

      </jboss-web>

      Login works, however if I try to extract the Subject from any part of my code it returns null. For example:

       

      protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

        Subject subject =

        Subject.getSubject(AccessController.getContext());

        System.out.println(" Subject is "+subject); // NULL!

       

      }

      I've found in an old JBoss 5 thread to use this property in the login-module:

      <module-option name="restore-login-identity" value="true" /> 

      However this property seems not recognized from the server:

      11:37:47,129 WARN  [org.jboss.security] (default task-1) PBOX000234: Invalid or misspelled module option: restore-login-identity

      Any idea how can I workaround this issue ?

      Ps I'm using WildFly 8.1.0 Final for my tests

       

      Thanks!

      Mylos