private void validateSecurePathIfRequired(RestRequest restRequest, String prefixToCheck, String expectSecurePath)
      throws RestServiceException {
    Container targetContainer = getContainerFromArgs(restRequest.getArgs());
    if (targetContainer.isSecurePathRequired()) {
      String securePath = prefixToCheck.startsWith("/") ? prefixToCheck.substring(1) : prefixToCheck;
      if (!securePath.equals(expectSecurePath)) {
        frontendMetrics.securePathValidationFailedCount.inc();
        throw new RestServiceException("Secure path in restRequest doesn't match the expected one",
            RestServiceErrorCode.AccessDenied);
      }
    }
  }
Validate the secure path in the URI if required for specific {@link Container}.
@param restRequest the {@link RestRequest} that contains the {@link Account} and {@link Container} details.
@param prefixToCheck the prefix from URI which may contain secure path.
@param expectSecurePath the expected secure path specified in {@link com.github.ambry.config.FrontendConfig}.
@throws RestServiceException
ambry-frontend/src/main/java/com/github/ambry/frontend/AmbrySecurityService.java