Authenticates to db with the given credentials. If this method (or {@code authenticateCommand} has already beencalled with the same credentials and the authentication test succeeded, this method will return true. If this method has already been called with different credentials and the authentication test succeeded, this method will throw an {@code IllegalStateException}. If this method has already been called with any credentials and the authentication test failed, this method will re-try the authentication test with the given credentials.
@param username name of user for this database
@param password password of user for this database
@return true if authenticated, false otherwise
@throws MongoException if authentication failed due to invalid user/pass, or other exceptions like I/O
@throws IllegalStateException if authentiation test has already succeeded with different credentials
@see #authenticateCommand(String,char[])
@dochub authenticate
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.