code: public synchronized HttpContext getHttpContext() {
          if (jolokiaHttpContext == null) {
              final String user = getConfiguration(USER);
              final String authMode = getConfiguration(AUTH_MODE);
              if (user == null) {
                  if (ServiceAuthenticationHttpContext.shouldBeUsed(authMode)) {
                      jolokiaHttpContext = new ServiceAuthenticationHttpContext(bundleContext, authMode);
                  } else {
                      jolokiaHttpContext = new DefaultHttpContext();
                  }
              } else {
                  jolokiaHttpContext =
                      new BasicAuthenticationHttpContext(getConfiguration(REALM),
                                                         createAuthenticator(authMode));
              }
          }
          return jolokiaHttpContext;
      }
docs: Get the security context for out servlet. Dependent on the configuration,
  this is either a no-op context or one which authenticates with a given user
  
  @return the HttpContext with which the agent servlet gets registered.