jclouds-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Aliaksandra Kharushka <notificati...@github.com>
Subject Re: [jclouds/jclouds] [JCLOUDS-1428] Support for SAS token based Authentication for Azure Blob Storage (#1270)
Date Fri, 01 Feb 2019 10:08:26 GMT
ak58588 commented on this pull request.



> +	* 
+	*/
+	public HttpRequest filterSAS(HttpRequest request, String credential) throws HttpException
{
+		String containerName = "";
+		String blobName = "";
+		String requestLine = request.getRequestLine();
+		String[] containerBlob = cutUri(requestLine);
+		if (containerBlob[0] != null) {
+			containerName = containerBlob[0];
+		} 
+		if (containerBlob[1] != null) {
+			blobName = containerBlob[1];
+		}
+		request = request.toBuilder().endpoint(Uris.uriBuilder(storageUrl).appendPath(containerName).appendPath(blobName).query(credential).build()).build();
+		request = replaceDateHeader(request);
+		request = removeAuthorizationHeader(request);

replaceDateHeader(HttpRequest) and removeAuthorizationHeader(request) both belong to ShareKeyLiteAuthentication
class, not the HttpMessage Builder class. 
The original code is written the same way as I did initially: 
```
 public HttpRequest filter(HttpRequest request) throws HttpException {
      request = replaceDateHeader(request);
      String signature = calculateSignature(createStringToSign(request));
      request = replaceAuthorizationHeader(request, signature);
      utils.logRequest(signatureLog, request, "<<");
      return request;
   } 
```


-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/1270#discussion_r252995035
Mime
View raw message