Table of Contents

Class SaslAuthenticator

Namespace
MongoDB.Driver.Core.Authentication
Assembly
MongoDB.Driver.Core.dll

Base class for a SASL authenticator.

public abstract class SaslAuthenticator : IAuthenticator
Inheritance
SaslAuthenticator
Implements
Derived
Inherited Members

Constructors

SaslAuthenticator(ISaslMechanism)

Initializes a new instance of the SaslAuthenticator class.

[Obsolete("Use the newest overload instead.")]
protected SaslAuthenticator(SaslAuthenticator.ISaslMechanism mechanism)

Parameters

mechanism SaslAuthenticator.ISaslMechanism

The mechanism.

SaslAuthenticator(ISaslMechanism, ServerApi)

Initializes a new instance of the SaslAuthenticator class.

protected SaslAuthenticator(SaslAuthenticator.ISaslMechanism mechanism, ServerApi serverApi)

Parameters

mechanism SaslAuthenticator.ISaslMechanism

The mechanism.

serverApi ServerApi

The server API.

Properties

DatabaseName

Gets the name of the database.

public abstract string DatabaseName { get; }

Property Value

string

The name of the database.

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 virtual void Authenticate(IConnection connection, ConnectionDescription description, CancellationToken cancellationToken)

Parameters

connection IConnection

The connection.

description ConnectionDescription

The connection description.

cancellationToken CancellationToken

The cancellation token.

AuthenticateAsync(IConnection, ConnectionDescription, CancellationToken)

Authenticates the connection.

public virtual Task AuthenticateAsync(IConnection connection, ConnectionDescription description, CancellationToken cancellationToken)

Parameters

connection IConnection

The connection.

description ConnectionDescription

The connection description.

cancellationToken CancellationToken

The cancellation token.

Returns

Task

A Task.

CustomizeInitialHelloCommand(BsonDocument)

Optionally customizes hello or legacy hello command.

public virtual BsonDocument CustomizeInitialHelloCommand(BsonDocument helloCommand)

Parameters

helloCommand BsonDocument

Initial command.

Returns

BsonDocument

Optionally mutated command.