From d478f1060c051cf13d063870baeefb840715640f Mon Sep 17 00:00:00 2001 From: jgomer2001 Date: Mon, 13 Nov 2023 08:23:55 -0500 Subject: [PATCH] fix: ensure uri has no colon #265 --- .../plugins/authnmethod/service/otp/HOTPAlgorithmService.java | 2 +- .../plugins/authnmethod/service/otp/TOTPAlgorithmService.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/org/gluu/casa/plugins/authnmethod/service/otp/HOTPAlgorithmService.java b/app/src/main/java/org/gluu/casa/plugins/authnmethod/service/otp/HOTPAlgorithmService.java index bd9e2f8b..7ecf3aa7 100644 --- a/app/src/main/java/org/gluu/casa/plugins/authnmethod/service/otp/HOTPAlgorithmService.java +++ b/app/src/main/java/org/gluu/casa/plugins/authnmethod/service/otp/HOTPAlgorithmService.java @@ -46,7 +46,7 @@ public String generateSecretKeyUri(byte[] secretKey, String displayName) { String secretKeyBase32 = BaseEncoding.base32().omitPadding().encode(secretKey); OTPKey otpKey = new OTPKey(secretKeyBase32, OTPType.HOTP); - OTPAuthURIBuilder uribe = OTPAuthURIBuilder.fromKey(otpKey).label(displayName); + OTPAuthURIBuilder uribe = OTPAuthURIBuilder.fromKey(otpKey).label(displayName.replace(':', ' ')); uribe = uribe.issuer(issuer).digits(conf.getDigits()); logger.trace("Generating secret key URI"); diff --git a/app/src/main/java/org/gluu/casa/plugins/authnmethod/service/otp/TOTPAlgorithmService.java b/app/src/main/java/org/gluu/casa/plugins/authnmethod/service/otp/TOTPAlgorithmService.java index c135c40c..0785d57e 100644 --- a/app/src/main/java/org/gluu/casa/plugins/authnmethod/service/otp/TOTPAlgorithmService.java +++ b/app/src/main/java/org/gluu/casa/plugins/authnmethod/service/otp/TOTPAlgorithmService.java @@ -48,7 +48,7 @@ public String generateSecretKeyUri(byte[] secretKey, String displayName) { String secretKeyBase32 = BaseEncoding.base32().omitPadding().encode(secretKey); OTPKey otpKey = new OTPKey(secretKeyBase32, OTPType.TOTP); - OTPAuthURIBuilder uribe = OTPAuthURIBuilder.fromKey(otpKey).label(displayName); + OTPAuthURIBuilder uribe = OTPAuthURIBuilder.fromKey(otpKey).label(displayName.replace(':', ' ')); uribe = uribe.issuer(issuer).digits(conf.getDigits()); uribe = uribe.timeStep(TimeUnit.SECONDS.toMillis(conf.getTimeStep()));