File tree Expand file tree Collapse file tree 2 files changed +17
-4
lines changed
driver-core/src/main/com/mongodb Expand file tree Collapse file tree 2 files changed +17
-4
lines changed Original file line number Diff line number Diff line change @@ -104,17 +104,29 @@ public final class MongoCredential {
104104 */
105105 public static final String CANONICALIZE_HOST_NAME_KEY = "CANONICALIZE_HOST_NAME" ;
106106
107- /*
108- * Mechanism property key for overriding the SasClient properties for GSSAPI authentication.
107+ /**
108+ * Mechanism property key for overriding the SaslClient properties for GSSAPI authentication.
109+ *
110+ * The value of this property must be a {@code Map<String, Object>}. In most cases there is no need to set this mechanism property.
111+ * But if an application does:
112+ * <ul>
113+ * <li>Generally it must set the {@link javax.security.sasl.Sasl#CREDENTIALS} property to an instance of
114+ * {@link org.ietf.jgss.GSSCredential}.</li>
115+ * <li>It's recommended that it set the {@link javax.security.sasl.Sasl#MAX_BUFFER} property to "0" to ensure compatibility with all
116+ * versions of MongoDB.</li>
117+ * </ul>
109118 *
110119 * @see #createGSSAPICredential(String)
111120 * @see #withMechanismProperty(String, Object)
121+ * @see javax.security.sasl.Sasl
122+ * @see javax.security.sasl.Sasl#CREDENTIALS
123+ * @see javax.security.sasl.Sasl#MAX_BUFFER
112124 * @since 3.3
113125 */
114126 public static final String JAVA_SASL_CLIENT_PROPERTIES_KEY = "JAVA_SASL_CLIENT_PROPERTIES" ;
115127
116- /*
117- * Mechanism property key for overriding the {@link javax.security.Subject} under which GSSAPI authentication executes.
128+ /**
129+ * Mechanism property key for overriding the {@link javax.security.auth. Subject} under which GSSAPI authentication executes.
118130 *
119131 * @see #createGSSAPICredential(String)
120132 * @see #withMechanismProperty(String, Object)
Original file line number Diff line number Diff line change @@ -65,6 +65,7 @@ protected SaslClient createSaslClient(final ServerAddress serverAddress) {
6565 Map <String , Object > saslClientProperties = getCredential ().getMechanismProperty (JAVA_SASL_CLIENT_PROPERTIES_KEY , null );
6666 if (saslClientProperties == null ) {
6767 saslClientProperties = new HashMap <String , Object >();
68+ saslClientProperties .put (Sasl .MAX_BUFFER , "0" );
6869 saslClientProperties .put (Sasl .CREDENTIALS , getGSSCredential (credential .getUserName ()));
6970 }
7071
You can’t perform that action at this time.
0 commit comments