driver-core/src/main/com/mongodb/MongoCredential.java
public static MongoCredential createScramSha256Credential(final String userName, final String source, final char[] password) {
        return new MongoCredential(SCRAM_SHA_256, userName, source, password);
    }
public static MongoCredential createScramSha256Credential(final String userName, final String source, final char[] password) {
        return new MongoCredential(SCRAM_SHA_256, userName, source, password);
    }
Creates a MongoCredential instance for the SCRAM-SHA-256 SASL mechanism.

@param userName the non-null user name
@param source the source where the user is defined.
@param password the non-null user password
@return the credential
@see #createCredential(String, String, char[])

@since 3.8
@mongodb.server.release 4.0
@mongodb.driver.manual core/authentication/#authentication-scram-sha-256 SCRAM-SHA-256