Class NativeAuthenticationHelper


  • public final class NativeAuthenticationHelper
    extends java.lang.Object
    Utility class for working with MongoDB native authentication.

    This class should not be considered a part of the public API.

    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String createAuthenticationHash​(java.lang.String userName, char[] password)
      Creates a hash of the given user name and password, which is the hex encoding of MD5( <userName> + ":mongo:" + <password> ).
      static BsonDocument getAuthCommand​(java.lang.String userName, char[] password, java.lang.String nonce)  
      static BsonDocument getAuthCommand​(java.lang.String userName, java.lang.String authHash, java.lang.String nonce)  
      static BsonDocument getNonceCommand()  
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • createAuthenticationHash

        public static java.lang.String createAuthenticationHash​(java.lang.String userName,
                                                                char[] password)
        Creates a hash of the given user name and password, which is the hex encoding of MD5( <userName> + ":mongo:" + <password> ).
        Parameters:
        userName - the user name
        password - the password
        Returns:
        the hash as a string
      • getAuthCommand

        public static BsonDocument getAuthCommand​(java.lang.String userName,
                                                  char[] password,
                                                  java.lang.String nonce)
      • getAuthCommand

        public static BsonDocument getAuthCommand​(java.lang.String userName,
                                                  java.lang.String authHash,
                                                  java.lang.String nonce)
      • getNonceCommand

        public static BsonDocument getNonceCommand()