public interface Authenticator extends Cloneable
A single Authenticator instance will only ever be used with a single Connection and set of credentials. The "clone()" method is used to quickly allocate a new instance for a connection allowing for shared "preauthentication" work to be done.
The startAuthentication(Credential, Connection)
method may assume
that it is only invoked from a single thread. The "result" method should not
make the same assumption.
Modifier and Type | Method and Description |
---|---|
Authenticator |
clone()
Provides the ability to clone the authenticator.
|
boolean |
result()
Returns the results of the authentication attempt.
|
void |
startAuthentication(Credential credentials,
Connection connection)
Starts to authenticate the user with the specified credentials.
|
Authenticator 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.
boolean result() throws MongoDbAuthenticationException
MongoDbAuthenticationException
- On a failure in the protocol to authenticate the user on the
connection.void startAuthentication(Credential credentials, Connection connection) throws MongoDbAuthenticationException
credentials
- 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.Copyright © 2011–2014 Allanbank Consulting, Inc.. All rights reserved.