title: SESN0008E: A user authenticated as anonymous has attempted to access a session owned by user
body: <p>Environment:</p>
  
  <ul>
  <li>MFP 6.3 Studio Windows 7 </li>
  <li>MFP 6.3 Server (WAS LC)</li>
  </ul>
  
  <p>Downloaded the <a href="https://developer.ibm.com/mobilefirstplatform/documentation/getting-started-6-3/authentication-security/form-based-authentication/form-based-authentication-hybrid-applications/" rel="nofollow">form-based sample</a> from the IBM MobileFirst Platform Developer Center.</p>
  
  <p>In MFP 6.3 Studio, the sample runs fine.  </p>
  
  <p>I then change my build settings and Build All Environment -> get the new wlapp file.</p>
  
  <p>I get my war file from the MFP 6.3 Server.  Open up and put in the modified authenticationConfig.xml
  Basically it's just transferring the one snippet from the studio authenticationConfig.xml to the xml file within the WAR file.</p>
  
  <pre><code>&lt;customSecurityTest name="DummyAdapter-securityTest"&gt;
      &lt;test isInternalUserID="true" realm="SampleAppRealm"/&gt;
  &lt;/customSecurityTest&gt;       
  </code></pre>
  
  <p>I restart the server and deploy the .wlapp and .adapter files.</p>
  
  <p>In the standalone server, I run the preview mode. I Enter the username and password and login.  It didn't login and I see these errors on the server console.log.</p>
  
  <pre><code>[ERROR   ] SESN0008E: A user authenticated as anonymous has attempted to access a session owned by user:BasicRegistry/demo.
  [ERROR   ] SRVE0232E: Internal Server Error. Exception Message: [com.ibm.ws.webcontainer.webapp.WebAppErrorReport: com.ibm.websphere.servlet.session.UnauthorizedSessionRequestException: SESN0008E: A user authenticated as anonymous has attempted to access a session owned by user:BasicRegistry/demo.
      at com.ibm.ws.webcontainer.session.impl.HttpSessionContextImpl.checkSecurity(HttpSessionContextImpl.java:686)
      at [internal classes]
      at com.worklight.core.auth.impl.AuthenticationFilter.associateAuthContextWithThread(AuthenticationFilter.java:426)
      at com.worklight.core.auth.impl.AuthenticationFilter.doFilter(AuthenticationFilter.java:145)
      at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:194)
      at [internal classes]
  Caused by: com.ibm.websphere.servlet.session.UnauthorizedSessionRequestException: SESN0008E: A user authenticated as anonymous has attempted to access a session owned by user:BasicRegistry/demo.
      ... 7 more
  ]
  [ERROR   ] SRVE0777E: Exception thrown by application class 'com.worklight.core.auth.impl.AuthenticationContext.checkAuthentication:604'
  com.worklight.server.auth.api.WorkLightAuthenticationException
      at com.worklight.core.auth.impl.AuthenticationContext.checkAuthentication(AuthenticationContext.java:604)
      at com.worklight.core.auth.impl.AuthenticationContext.processRealms(AuthenticationContext.java:469)
      at com.worklight.core.auth.impl.AuthenticationContext.pushCurrentResource(AuthenticationContext.java:443)
      at com.worklight.core.auth.impl.AuthenticationServiceBean.accessResource(AuthenticationServiceBean.java:75)
      at com.worklight.integration.services.impl.DataAccessServiceImpl.invokeProcedureInternal(DataAccessServiceImpl.java:430)
      at com.worklight.integration.services.impl.DataAccessServiceImpl.invokeProcedure(DataAccessServiceImpl.java:139)
      at com.worklight.gadgets.serving.handler.BackendQueryHandler.getContent(BackendQueryHandler.java:95)
      at com.worklight.gadgets.serving.handler.BackendQueryHandler.doPost(BackendQueryHandler.java:56)
      at com.worklight.gadgets.serving.GadgetAPIServlet.doGetOrPost(GadgetAPIServlet.java:148)
      at com.worklight.gadgets.serving.GadgetAPIServlet.doPost(GadgetAPIServlet.java:108)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:595)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:668)
      at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1240)
      at [internal classes]
      at com.worklight.core.auth.impl.AuthenticationFilter$1.execute(AuthenticationFilter.java:217)
      at com.worklight.core.auth.impl.AuthenticationServiceBean.accessResource(AuthenticationServiceBean.java:76)
      at com.worklight.core.auth.impl.AuthenticationFilter.doFilter(AuthenticationFilter.java:222)
      at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:194)
      at [internal classes]
  </code></pre>