@Override
  public void verifySignedRequest(RestRequest restRequest) throws RestServiceException {
    if (!isRequestSigned(restRequest)) {
      throw new RestServiceException("Request is not signed - method should not have been called",
          RestServiceErrorCode.InternalServerError);
    }
    Map<String, Object> args = restRequest.getArgs();
    long expiryTimeSecs = RestUtils.getLongHeader(args, LINK_EXPIRY_TIME, true);
    if (time.seconds() > expiryTimeSecs) {
      throw new RestServiceException("Signed URL has expired", RestServiceErrorCode.Unauthorized);
    }
    RestMethod restMethodInUrl = RestMethod.valueOf(RestUtils.getHeader(args, RestUtils.Headers.URL_TYPE, true));
    if (!restRequest.getRestMethod().equals(restMethodInUrl)) {
      // If the signed url is for download, we also want to support HEAD request against that signed url.
      if (!(restRequest.getRestMethod().equals(RestMethod.HEAD) && restMethodInUrl.equals(RestMethod.GET))) {
        throw new RestServiceException("Type of request being made not compatible with signed URL",
            RestServiceErrorCode.Unauthorized);
      }
    }
  }
Constructor
@param uploadEndpoint the endpoint in all signed POST URLs.
@param downloadEndpoint the endpoint in all signed GET URLs.
@param defaultUrlTtlSecs the default ttl of signed URLs if the request does not customize it.
@param defaultMaxUploadSize the default max size of upload from signed POST URLs if the request does not customize
                            it.
@param maxUrlTtlSecs the maximum ttl of signed URLs. If the request specifies a higher TTL, it will be lowered
@param chunkUploadInitialChunkTtlSecs the preconfigured blob TTL for chunks of a stitched upload. These chunks
                                      will be made permanent once the blob is stitched together.
@param chunkUploadMaxChunkSize the preconfigured max size for chunks of a stitched upload.
@param time the {@link Time} instance to use.
@param clusterMap the {@link ClusterMap} object.
@param clusterMapConfig the {@link ClusterMapConfig} object.
@param routerConfig the {@link RouterConfig} object.
ambry-frontend/src/main/java/com/github/ambry/frontend/AmbryUrlSigningService.java