code: @Override
      public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)
          throws IOException {
          final XmAuthenticationContext authContext = xmAuthContextHolder.getContext();
  
          boolean isFullyAuthenticated = authContext.isFullyAuthenticated();
  
          // getValue tenant name
          Optional<String> tenantName;
          if (isFullyAuthenticated) {
              // getValue tenant name from authentication token
              tenantName = authContext.getDetailsValue(XmTenantConstants.AUTH_CONTEXT_TENANT_NAME);
          } else {
              // getValue tenant name from request header
              String tenantNameValue = request.getHeader(XmTenantConstants.HTTP_HEADER_TENANT_NAME);
              tenantName = StringUtils.isNotBlank(tenantNameValue) ? Optional.of(tenantNameValue) : Optional.empty();
          }
  
          if (tenantName.isPresent()) {
              PlainTenant tenant = new PlainTenant(TenantKey.valueOf(tenantName.get()));
              LOGGER.debug("Init tenant '{}' context", tenant.getTenantKey().getValue());
              getPrivilegedTenantContext().setTenant(tenant);
              return true;
          } else {
              if (isFullyAuthenticated) {
                  LOGGER.warn("Can't obtain tenant name from authentication details");
              } else {
                  LOGGER.warn("Can't obtain tenant name from non auth http request header '{}'",
                              XmTenantConstants.HTTP_HEADER_TENANT_NAME);
              }
              InterceptorUtil.sendResponse(response, JSON_ERROR_NO_TENANT_SUPPLIED);
              return false;
          }
      }
docs: {@inheritDoc}