Class DefaultAuthenticator
- Namespace
- MongoDB.Driver.Core.Authentication
- Assembly
- MongoDB.Driver.Core.dll
The default authenticator. If saslSupportedMechs is not present in the hello or legacy hello results for mechanism negotiation uses SCRAM-SHA-1. Else, uses SCRAM-SHA-256 if present in the list of mechanisms. Otherwise, uses SCRAM-SHA-1 the default, regardless of whether SCRAM-SHA-1 is in the list.
public class DefaultAuthenticator : IAuthenticator
- Inheritance
-
DefaultAuthenticator
- Implements
- Inherited Members
Constructors
DefaultAuthenticator(UsernamePasswordCredential)
Initializes a new instance of the DefaultAuthenticator class.
[Obsolete("Use the newest overload instead.")]
public DefaultAuthenticator(UsernamePasswordCredential credential)
Parameters
credential
UsernamePasswordCredentialThe credential.
DefaultAuthenticator(UsernamePasswordCredential, ServerApi)
Initializes a new instance of the DefaultAuthenticator class.
public DefaultAuthenticator(UsernamePasswordCredential credential, ServerApi serverApi)
Parameters
credential
UsernamePasswordCredentialThe credential.
serverApi
ServerApiThe server API.
Properties
Name
Gets the name of the authenticator.
public string Name { get; }
Property Value
- string
The name.
Methods
Authenticate(IConnection, ConnectionDescription, CancellationToken)
Authenticates the connection.
public void Authenticate(IConnection connection, ConnectionDescription description, CancellationToken cancellationToken)
Parameters
connection
IConnectionThe connection.
description
ConnectionDescriptionThe connection description.
cancellationToken
CancellationTokenThe cancellation token.
AuthenticateAsync(IConnection, ConnectionDescription, CancellationToken)
Authenticates the connection.
public Task AuthenticateAsync(IConnection connection, ConnectionDescription description, CancellationToken cancellationToken)
Parameters
connection
IConnectionThe connection.
description
ConnectionDescriptionThe connection description.
cancellationToken
CancellationTokenThe cancellation token.
Returns
- Task
A Task.
CustomizeInitialHelloCommand(BsonDocument)
Optionally customizes hello or legacy hello command.
public BsonDocument CustomizeInitialHelloCommand(BsonDocument helloCommand)
Parameters
helloCommand
BsonDocumentInitial command.
Returns
- BsonDocument
Optionally mutated command.