code: private void setJettyAuthentication(Subject subject) {
          // In unit test environments there may not be a current connection.  If any nulls are encountered
          // then, by definition, there is no container to update.
          HttpConnection connection = HttpConnection.getCurrentConnection();
          if (connection == null) {
              return;
          }
          Request jettyRequest = connection.getHttpChannel().getRequest();
          if (jettyRequest == null) {
              return;
          }
  
          // This cast down is safe; subject is always created with this type of principal
          PrincipalWithRoles principal = (PrincipalWithRoles) subject.getPrincipal();
          UserIdentity identity = principal.toUserIdentity();
  
          jettyRequest.setAuthentication(new UserAuthentication(SecurityContext.BASIC_AUTH, identity));
      }
docs: Certain aspects of the container, such as logging, need the authentication information to behave properly.
  This method updates the request with the necessary objects to recognize the authenticated user.