Class MongoDBConnectionResolutionHooks

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

Represents the hooks that let a MongoDB client follow a resolved connection after it has been created.

[IgnoreConvention]
public class MongoDBConnectionResolutionHooks : IOidcCallback
Inheritance
MongoDBConnectionResolutionHooks
Implements
IOidcCallback
Inherited Members
Extension Methods

Remarks

As an MongoDB.Driver.Authentication.Oidc.IOidcCallback it hands the driver the resolved access token. The driver only asks when it has no valid token — at first, when one expires, or when the server rejected one — so the cached resolution is dropped first.

Through ConfigureCluster(ClusterBuilder) it drops the cached resolution when a connection fails to authenticate, so the next connection resolved for the request picks up rotated credentials.

Keep one instance per request: the driver compares credentials, and so callbacks, when deciding whether two settings describe the same client.

Constructors

MongoDBConnectionResolutionHooks(ICachingConnectionResolver, ConnectionRequest, TimeProvider)

Represents the hooks that let a MongoDB client follow a resolved connection after it has been created.

public MongoDBConnectionResolutionHooks(ICachingConnectionResolver resolver, ConnectionRequest request, TimeProvider timeProvider)

Parameters

resolver ICachingConnectionResolver

The ICachingConnectionResolver to resolve through.

request ConnectionRequest

The ConnectionRequest to resolve.

timeProvider TimeProvider

The TimeProvider for the current time.

Remarks

As an MongoDB.Driver.Authentication.Oidc.IOidcCallback it hands the driver the resolved access token. The driver only asks when it has no valid token — at first, when one expires, or when the server rejected one — so the cached resolution is dropped first.

Through ConfigureCluster(ClusterBuilder) it drops the cached resolution when a connection fails to authenticate, so the next connection resolved for the request picks up rotated credentials.

Keep one instance per request: the driver compares credentials, and so callbacks, when deciding whether two settings describe the same client.

Methods

ConfigureCluster(ClusterBuilder)

Configure the cluster to drop the cached resolution when a connection fails to authenticate.

public void ConfigureCluster(ClusterBuilder builder)

Parameters

builder ClusterBuilder

The MongoDB.Driver.Core.Configuration.ClusterBuilder.

GetOidcAccessToken(OidcCallbackParameters, CancellationToken)

Get OIDC callback response.

public OidcAccessToken GetOidcAccessToken(OidcCallbackParameters parameters, CancellationToken cancellationToken)

Parameters

parameters OidcCallbackParameters

The information used by callbacks to authenticate with the Identity Provider.

cancellationToken CancellationToken

The cancellation token.

Returns

OidcAccessToken

OIDC callback response

GetOidcAccessTokenAsync(OidcCallbackParameters, CancellationToken)

Get OIDC callback response.

public Task<OidcAccessToken> GetOidcAccessTokenAsync(OidcCallbackParameters parameters, CancellationToken cancellationToken)

Parameters

parameters OidcCallbackParameters

The information used by callbacks to authenticate with the Identity Provider.

cancellationToken CancellationToken

The cancellation token.

Returns

Task<OidcAccessToken>

OIDC callback response