/** * Assemble the components of the HTTP request into the correct format so that they can be signed or hashed. * @param request {@link CanonicalHttpRequest} that provides the necessary components * @return {@link String} encoding the canonical form of this request as required for constructing {@link JwtConstants.Claims#QUERY_HASH} values * @throws UnsupportedEncodingException {@link UnsupportedEncodingException} if the {@link java.net.URLEncoder} cannot encode the request's field's characters */ public static String canonicalize(CanonicalHttpRequest request) throws UnsupportedEncodingException { return String.format("%s%s%s%s%s", canonicalizeMethod(request), CANONICAL_REQUEST_PART_SEPARATOR, canonicalizeUri(request), CANONICAL_REQUEST_PART_SEPARATOR, canonicalizeQueryParameters(request)); }