From 91337150e77b1eba5a2f7f2f8d7e7c0357d413fe Mon Sep 17 00:00:00 2001 From: Florian Schmaus Date: Thu, 2 Jul 2020 13:07:17 +0200 Subject: [PATCH] [sasl] Rename getChannelBindingName() to getGs2CbindFlag() As this returns the value of the SCRAM gs2-cbind-flag. --- .../jivesoftware/smack/sasl/core/ScramMechanism.java | 12 +++++++++--- .../smack/sasl/core/ScramPlusMechanism.java | 4 ++-- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/smack-core/src/main/java/org/jivesoftware/smack/sasl/core/ScramMechanism.java b/smack-core/src/main/java/org/jivesoftware/smack/sasl/core/ScramMechanism.java index 6fadfd3a8..bf8a4a224 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/sasl/core/ScramMechanism.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/sasl/core/ScramMechanism.java @@ -1,6 +1,6 @@ /** * - * Copyright 2014-2019 Florian Schmaus + * Copyright 2014-2020 Florian Schmaus * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -227,7 +227,7 @@ public abstract class ScramMechanism extends SASLMechanism { authzidPortion = "a=" + authorizationId; } - String cbName = getChannelBindingName(); + String cbName = getGs2CbindFlag(); assert StringUtils.isNotEmpty(cbName); return cbName + ',' + authzidPortion + ","; @@ -244,7 +244,13 @@ public abstract class ScramMechanism extends SASLMechanism { return ByteUtils.concat(gs2Header, cbindData); } - protected String getChannelBindingName() { + /** + * Get the SCRAM GSS-API Channel Binding Flag value. + * + * @return the gs2-cbind-flag value. + * @see RFC 5802 ยง 6. + */ + protected String getGs2CbindFlag() { // Check if we are using TLS and if a "-PLUS" variant of this mechanism is enabled. Assuming that the "-PLUS" // variants always have precedence before the non-"-PLUS" variants this means that the server did not announce // the "-PLUS" variant, as otherwise we would have tried it. diff --git a/smack-core/src/main/java/org/jivesoftware/smack/sasl/core/ScramPlusMechanism.java b/smack-core/src/main/java/org/jivesoftware/smack/sasl/core/ScramPlusMechanism.java index 0aa7eee3f..849eee55d 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/sasl/core/ScramPlusMechanism.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/sasl/core/ScramPlusMechanism.java @@ -1,6 +1,6 @@ /** * - * Copyright 2016-2019 Florian Schmaus + * Copyright 2016-2020 Florian Schmaus * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -43,7 +43,7 @@ public abstract class ScramPlusMechanism extends ScramMechanism { } @Override - protected String getChannelBindingName() { + protected String getGs2CbindFlag() { return "p=tls-server-end-point"; }