chungen0126 commented on code in PR #10652:
URL: https://github.com/apache/ozone/pull/10652#discussion_r3673640814


##########
hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/AWSV4AuthValidator.java:
##########
@@ -75,25 +75,18 @@ private static byte[] sign(byte[] key, String msg) {
     }
   }
 
-  /**
-   * Returns signing key.
-   *
-   * @param key
-   * @param strToSign
-   *
-   * SignatureKey = HMAC-SHA256(HMAC-SHA256(HMAC-SHA256(HMAC-SHA256("AWS4" +
-   * "<YourSecretAccessKey>","20130524"),"us-east-1"),"s3"),"aws4_request")
-   *
-   * For more details refer to AWS documentation: https://docs.aws.amazon
-   * .com/AmazonS3/latest/API/sig-v4-header-based-auth.html
-   *
-   * */
-  private static byte[] getSigningKey(String key, String strToSign) {
-    String[] signData = StringUtils.split(StringUtils.split(strToSign,
-        '\n')[2], '/');
+  public static byte[] getSigningKey(String key, String strToSign) {
+    String credentialScope = StringUtils.split(strToSign, '\n')[2];
+    return getSigningKeyFromCredentialScope(key, credentialScope);
+  }
+
+  private static byte[] getSigningKeyFromCredentialScope(String key, String 
credentialScope) {
+    String[] signData = StringUtils.split(credentialScope, '/');
     String dateStamp = signData[0];
     String regionName = signData[1];
     String serviceName = signData[2];
+    LOG.info("key: {}, dateStamp: {}, regionName: {}, serviceName: {}",

Review Comment:
   Removed. Nice catch. Added this earlier for debugging and forgot to clean it 
up.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to