Class ResolvedConnectionMongoDBExtensions

Namespace
Cratis.Arc.MongoDB
Assembly
Cratis.Arc.MongoDB.dll

Provides extension methods for applying a ResolvedConnection to MongoDB.

public static class ResolvedConnectionMongoDBExtensions
Inheritance
ResolvedConnectionMongoDBExtensions
Inherited Members

Fields

DefaultAuthenticationSource

The authentication database used when neither the connection string nor its database name says otherwise.

public const string DefaultAuthenticationSource = "admin"

Field Value

string

Methods

ToMongoClientSettings(ResolvedConnection, MongoUrl, IOidcCallback?)

Create MongoDB.Driver.MongoClientSettings from a ResolvedConnection applied over a configured server.

public static MongoClientSettings ToMongoClientSettings(this ResolvedConnection resolved, MongoUrl configured, IOidcCallback? accessTokenCallback = null)

Parameters

resolved ResolvedConnection

The ResolvedConnection.

configured MongoUrl

The configured MongoDB.Driver.MongoUrl, used when no connection string was resolved.

accessTokenCallback IOidcCallback

The MongoDB.Driver.Authentication.Oidc.IOidcCallback giving access tokens; required for refreshing tokens. When not given, a resolved access token is used as it is.

Returns

MongoClientSettings

The MongoDB.Driver.MongoClientSettings.

Remarks

A user name and password become a SCRAM credential against the authentication source of the connection string, else its database, else DefaultAuthenticationSource. An access token becomes a MONGODB-OIDC credential.