From 769ba20d92dbbe45c18693615d9cd86b2a2e90b7 Mon Sep 17 00:00:00 2001 From: mehle Date: Tue, 9 Apr 2024 08:04:51 -0600 Subject: [PATCH] Resolve line ending canonicalization issue on Windows (#84) --- .../java/com/duosecurity/client/Http.java | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/duo-client/src/main/java/com/duosecurity/client/Http.java b/duo-client/src/main/java/com/duosecurity/client/Http.java index 1ab443b..e2ba187 100644 --- a/duo-client/src/main/java/com/duosecurity/client/Http.java +++ b/duo-client/src/main/java/com/duosecurity/client/Http.java @@ -314,30 +314,30 @@ protected String canonRequest(String date, int sigVersion) String canonParam; String canonBody; if (sigVersion == 1) { - canon += method.toUpperCase() + System.lineSeparator(); - canon += host.toLowerCase() + System.lineSeparator(); - canon += uri + System.lineSeparator(); + canon += method.toUpperCase() + "\n"; + canon += host.toLowerCase() + "\n"; + canon += uri + "\n"; canon += canonQueryString(); } else if (sigVersion == 2) { - canon += date + System.lineSeparator(); - canon += method.toUpperCase() + System.lineSeparator(); - canon += host.toLowerCase() + System.lineSeparator(); - canon += uri + System.lineSeparator(); + canon += date + "\n"; + canon += method.toUpperCase() + "\n"; + canon += host.toLowerCase() + "\n"; + canon += uri + "\n"; canon += canonQueryString(); } else if (sigVersion == 5) { - canon += date + System.lineSeparator(); - canon += method.toUpperCase() + System.lineSeparator(); - canon += host.toLowerCase() + System.lineSeparator(); - canon += uri + System.lineSeparator(); + canon += date + "\n"; + canon += method.toUpperCase() + "\n"; + canon += host.toLowerCase() + "\n"; + canon += uri + "\n"; if ("POST".equals(method) || "PUT".equals(method)) { - canonParam = System.lineSeparator(); + canonParam = "\n"; canonBody = Util.bytes_to_hex(Util.hash(hashingAlgorithm, canonJSONBody())); } else { - canonParam = canonQueryString() + System.lineSeparator(); + canonParam = canonQueryString() + "\n"; canonBody = Util.bytes_to_hex(Util.hash(hashingAlgorithm, "")); } canon += canonParam; - canon += canonBody + System.lineSeparator(); + canon += canonBody + "\n"; canon += Util.bytes_to_hex(Util.hash(hashingAlgorithm, canonXDuoHeaders())); }