You do not need to change all existing requests, you only need to change the logic that sets up your MongoClient. Most applications do this as a kind of Singleton, so adding authentication is just a matter of modifying Singleton. This is a pain in essence, that there is no signature that takes only String, String for the user's password, but its Mongo Java API gets used to disappointment.
MongoURI, ...
MongoClient mongo = new MongoClient(
new MongoClientURI( "mongodb://app_user:bestPo55word3v3r@localhost/data" )
);
<MongoCredential>
List<ServerAddress> seeds = new ArrayList<ServerAddress>();
seeds.add( new ServerAddress( "localhost" );
List<MongoCredential> credentials = new ArrayList<MongoCredential>();
credentials.add(
MongoCredential.createMongoCRCredential(
"app_user",
"data",
"bestPo55word3v3r".toCharArray()
)
);
MongoClient mongo = new MongoClient( seeds, credentials );