public class MongoDbAuthenticator extends Object implements Authenticator
Modifier and Type | Field and Description |
---|---|
static Charset |
ASCII
The UTF-8 character encoding.
|
protected FutureCallback<Boolean> |
myResults
The result of the Authentication attempt.
|
Constructor and Description |
---|
MongoDbAuthenticator()
Creates a new MongoDbAuthenticator.
|
Modifier and Type | Method and Description |
---|---|
MongoDbAuthenticator |
clone()
Provides the ability to clone the authenticator.
|
String |
passwordHash(Credential credentials)
Creates the MongoDB authentication hash of the password.
|
protected String |
passwordHash(MessageDigest md5,
Credential credentials)
Creates the MongoDB authentication hash of the password.
|
boolean |
result()
Returns the results of the authentication attempt.
|
void |
startAuthentication(Credential credential,
Connection connection)
Starts to authenticate the user with the specified credentials.
|
public static final Charset ASCII
protected FutureCallback<Boolean> myResults
public MongoDbAuthenticator()
public MongoDbAuthenticator clone()
Authenticator
instance is created for each physical connection in
use.
Using clone allows users to create a "template" version of the authenticator that is then copied prior to use by each connection.
Overridden to return a new authenticator.
clone
in interface Authenticator
clone
in class Object
public String passwordHash(Credential credentials) throws NoSuchAlgorithmException
credentials
- The credentials to hash.NoSuchAlgorithmException
- On a failure to create a MD5 message digest.public boolean result() throws MongoDbAuthenticationException
Overridden to returns the results of the authentication, once complete.
result
in interface Authenticator
MongoDbAuthenticationException
- On a failure in the protocol to authenticate the user on the
connection.public void startAuthentication(Credential credential, Connection connection) throws MongoDbAuthenticationException
Overridden to authenticate with MongoDB using the native/legacy authentication mechanisms.
startAuthentication
in interface Authenticator
credential
- The credentials to use to login to the database.connection
- The connection to authenticate the user with.MongoDbAuthenticationException
- On a failure in the protocol to authenticate the user on the
connection.protected String passwordHash(MessageDigest md5, Credential credentials)
md5
- The MD5 digest to compute the hash.credentials
- The credentials to hash.Copyright © 2011–2014 Allanbank Consulting, Inc.. All rights reserved.