@Test void testAclQueryString() throws SecurityException, NoSuchMethodException { HttpRequest request = putBucketAcl(); StringBuilder builder = new StringBuilder(); ((RequestAuthorizeSignatureV2) filter).appendUriPath(request, builder); assertEquals(builder.toString(), "/" + bucketName + "?acl"); }
@VisibleForTesting void appendUriPath(HttpRequest request, StringBuilder toSign) { toSign.append(request.getEndpoint().getRawPath()); if (request.getEndpoint().getQuery() != null) { Multimap<String, String> params = queryParser().apply(request.getEndpoint().getQuery()); char separator = '?'; for (String paramName : Ordering.natural().sortedCopy(params.keySet())) { if (!SIGNED_PARAMETERS.contains(paramName)) { continue; } toSign.append(separator).append(paramName); String paramValue = get(params.get(paramName), 0); if (paramValue != null) { toSign.append("=").append(paramValue); } separator = '&'; } } }
RequestAuthorizeSignatureV2 implements RequestAuthorizeSignature, RequestSigner { @VisibleForTesting void appendUriPath(HttpRequest request, StringBuilder toSign) { toSign.append(request.getEndpoint().getRawPath()); if (request.getEndpoint().getQuery() != null) { Multimap<String, String> params = queryParser().apply(request.getEndpoint().getQuery()); char separator = '?'; for (String paramName : Ordering.natural().sortedCopy(params.keySet())) { if (!SIGNED_PARAMETERS.contains(paramName)) { continue; } toSign.append(separator).append(paramName); String paramValue = get(params.get(paramName), 0); if (paramValue != null) { toSign.append("=").append(paramValue); } separator = '&'; } } } }
RequestAuthorizeSignatureV2 implements RequestAuthorizeSignature, RequestSigner { @VisibleForTesting void appendUriPath(HttpRequest request, StringBuilder toSign) { toSign.append(request.getEndpoint().getRawPath()); if (request.getEndpoint().getQuery() != null) { Multimap<String, String> params = queryParser().apply(request.getEndpoint().getQuery()); char separator = '?'; for (String paramName : Ordering.natural().sortedCopy(params.keySet())) { if (!SIGNED_PARAMETERS.contains(paramName)) { continue; } toSign.append(separator).append(paramName); String paramValue = get(params.get(paramName), 0); if (paramValue != null) { toSign.append("=").append(paramValue); } separator = '&'; } } } @Inject  RequestAuthorizeSignatureV2(SignatureWire signatureWire, @Named(PROPERTY_AUTH_TAG) String authTag,
         @Named(PROPERTY_S3_VIRTUAL_HOST_BUCKETS) boolean isVhostStyle,
         @Named(PROPERTY_S3_SERVICE_PATH) String servicePath, @Named(PROPERTY_HEADER_TAG) String headerTag,
         @org.jclouds.location.Provider Supplier<Credentials> creds,
         @TimeStamp Provider<String> timeStampProvider, Crypto crypto, HttpUtils utils,
         DateService dateService); }
RequestAuthorizeSignatureV2 implements RequestAuthorizeSignature, RequestSigner { @VisibleForTesting void appendUriPath(HttpRequest request, StringBuilder toSign) { toSign.append(request.getEndpoint().getRawPath()); if (request.getEndpoint().getQuery() != null) { Multimap<String, String> params = queryParser().apply(request.getEndpoint().getQuery()); char separator = '?'; for (String paramName : Ordering.natural().sortedCopy(params.keySet())) { if (!SIGNED_PARAMETERS.contains(paramName)) { continue; } toSign.append(separator).append(paramName); String paramValue = get(params.get(paramName), 0); if (paramValue != null) { toSign.append("=").append(paramValue); } separator = '&'; } } } @Inject  RequestAuthorizeSignatureV2(SignatureWire signatureWire, @Named(PROPERTY_AUTH_TAG) String authTag,
         @Named(PROPERTY_S3_VIRTUAL_HOST_BUCKETS) boolean isVhostStyle,
         @Named(PROPERTY_S3_SERVICE_PATH) String servicePath, @Named(PROPERTY_HEADER_TAG) String headerTag,
         @org.jclouds.location.Provider Supplier<Credentials> creds,
         @TimeStamp Provider<String> timeStampProvider, Crypto crypto, HttpUtils utils,
         DateService dateService); HttpRequest filter(HttpRequest request); String createStringToSign(HttpRequest request); String sign(String toSign); @Override HttpRequest signForTemporaryAccess(HttpRequest request, long timeInSeconds); }
RequestAuthorizeSignatureV2 implements RequestAuthorizeSignature, RequestSigner { @VisibleForTesting void appendUriPath(HttpRequest request, StringBuilder toSign) { toSign.append(request.getEndpoint().getRawPath()); if (request.getEndpoint().getQuery() != null) { Multimap<String, String> params = queryParser().apply(request.getEndpoint().getQuery()); char separator = '?'; for (String paramName : Ordering.natural().sortedCopy(params.keySet())) { if (!SIGNED_PARAMETERS.contains(paramName)) { continue; } toSign.append(separator).append(paramName); String paramValue = get(params.get(paramName), 0); if (paramValue != null) { toSign.append("=").append(paramValue); } separator = '&'; } } } @Inject  RequestAuthorizeSignatureV2(SignatureWire signatureWire, @Named(PROPERTY_AUTH_TAG) String authTag,
         @Named(PROPERTY_S3_VIRTUAL_HOST_BUCKETS) boolean isVhostStyle,
         @Named(PROPERTY_S3_SERVICE_PATH) String servicePath, @Named(PROPERTY_HEADER_TAG) String headerTag,
         @org.jclouds.location.Provider Supplier<Credentials> creds,
         @TimeStamp Provider<String> timeStampProvider, Crypto crypto, HttpUtils utils,
         DateService dateService); HttpRequest filter(HttpRequest request); String createStringToSign(HttpRequest request); String sign(String toSign); @Override HttpRequest signForTemporaryAccess(HttpRequest request, long timeInSeconds);  }