edk12564 commented on code in PR #133:
URL: 
https://github.com/apache/fineract-consumer-facing/pull/133#discussion_r3955206202


##########
consumer/src/main/java/org/apache/fineract/consumer/infrastructure/stepup/service/StepUpTokenService.java:
##########
@@ -46,27 +46,34 @@ public class StepUpTokenService {
     private final JwtIssuer jwtIssuer;
     private final JwtDecoder jwtDecoder;
 
-    public String actionFingerprint(String endpoint, Long fromAccountId, Long 
toAccountId, BigDecimal amount) {
-        String canonical =
-                endpoint + "|" + fromAccountId + "|" + toAccountId + "|" + 
amount.stripTrailingZeros().toPlainString();
-        return hash(canonical);
-    }
-
-    public String actionFingerprint(
-            String endpoint, Long fromAccountId, Long toAccountId, String 
toAccountType, BigDecimal amount) {
-        String canonical = endpoint + "|" + fromAccountId + "|" + toAccountId 
+ "|" + toAccountType + "|"
-                + amount.stripTrailingZeros().toPlainString();
-        return hash(canonical);
-    }
-
-    public String actionFingerprint(String endpoint, Long fromAccountId, Long 
toAccountId) {
-        String canonical = endpoint + "|" + fromAccountId + "|" + toAccountId;
-        return hash(canonical);
+    public String actionFingerprint(String endpoint, Object... parts) {
+        // String.valueOf preserves the prior null-endpoint behavior 
("null|...") without NPE.
+        StringBuilder canonical = new 
StringBuilder(String.valueOf(endpoint)).append('|');
+        for (int i = 0; i < parts.length; i++) {
+            if (i > 0) {
+                canonical.append('|');
+            }
+            canonical.append(fingerprintPart(parts[i]));
+        }
+        return hash(canonical.toString());
     }

Review Comment:
   I think this is unnecessary. We don't want to create fingerprints from null 
arguments. Better to fail closed here.



-- 
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]

Reply via email to