mongo-csharp-driver / Authentication
AGENTS.md3.2k starsChanged 4 months agoApache-2.0View on GitHub
The authentication subsystem under src/MongoDB.Driver/Authentication/ plus the optional sibling project src/MongoDB.Driver.Authentication.AWS/. Responsible for credential storage, mechanism negotiation, the SASL conversation, the speculativeAuthenticate handshake optimization, and integration with Core/Connections/ConnectionInitializer. Files: ScramShaSaslMechanism.cs, ScramShaFirstSaslStep.cs, ScramShaSecondSaslStep.cs, ScramShaLastSaslStep.cs, IScramShaAlgorithm.cs, ScramSha1Algorithm.cs, ScramSha256Algorithm.cs, ScramCache.cs. Conversation: client-first → server-first → client-final → server-final (RFC 5802). Salted password computed via PBKDF2; ClientKey, StoredKey, ClientProof, ServerSignature derived per the spec. DefaultAuthenticator picks the mechanism: if the hello reply includes saslSupportedMechs and SCRAM-SHA-256 is in the list, use SHA-256; otherwise SHA-1…
Trending
Quiet since September.about the whole repository
Who's talking about mongodb/mongo-csharp-driver
- jbogard/MongoDB.Driver.Core.Extensions.DiagnosticSources“Support for latest MongoDB library with signing”GitHub · Jul 28, 2024 · 13 reactions
- opensearch-project/opensearch-net“[FEATURE] Add LINQ Support to the OpenSearch C# Client”GitHub · Sep 18, 2023 · 5 reactions
- nopSolutions/nopCommerce“MongoDB database support”GitHub · Apr 30, 2019 · 4 reactions
- microsoft/aspire“MongoDB.Driver v3 breaks Aspire.MongoDB.Driver integration”GitHub · Oct 18, 2024 · 3 reactions
- jbogard/MongoDB.Driver.Core.Extensions.DiagnosticSources“Deprecate this package”GitHub · Apr 21, 2026 · 2 reactions
The biggest 5 of 40 mentions linking to the repository that our crawl found. Each line is their own headline.
See all 40
Talked about on GitHub (40 times).
On GitHub · 40
- Jul 28, 2024Support for latest MongoDB library with signing — jbogard/MongoDB.Driver.Core.Extensions.DiagnosticSources13 reactions · 5 comments
- Sep 18, 2023[FEATURE] Add LINQ Support to the OpenSearch C# Client — opensearch-project/opensearch-net5 reactions · 1 comment
- Apr 30, 2019MongoDB database support — nopSolutions/nopCommerce4 reactions · 24 comments
- Oct 18, 2024MongoDB.Driver v3 breaks Aspire.MongoDB.Driver integration — microsoft/aspire3 reactions · 9 comments
- Apr 21, 2026Deprecate this package — jbogard/MongoDB.Driver.Core.Extensions.DiagnosticSources2 reactions · 1 comment
35 more on GitHub
- Nov 5, 2025Corrected Membership Session Handling — OrleansContrib/Orleans.Providers.MongoDB2 reactions · 2 comments
- Jun 4, 2016Support .NET Core — tugberkugurlu/AspNetCore.Identity.MongoDB2 reactions · 1 comment
- Jul 12, 2026Upgrade MongoDB.Driver to 3.9.0 to fix Snappier and SharpCompress vulnerabilities — madelson/DistributedLock1 reaction
- May 28, 2026Upgrade MongoDB.Driver to 3.9.0 — abpframework/abp1 reaction · 1 comment
- May 12, 2026Upgrade MongoDB.Driver to 3.8.1 — abpframework/abp1 reaction
- Mar 19, 2026bump MongoDB.Driver to 3.7.1 — abpframework/abp1 reaction
- Jan 18, 2026Update MongoDB.Driver package version to 3.6.0 — abpframework/abp1 reaction · 1 comment
- Nov 20, 2025Update MongoDB.Driver to version 3.5.1 — abpframework/abp1 reaction
- Jan 30, 2023Hangfire.Mongo is incompatible with the MongoDB.Driver LINQ3 provider — gottscj/Hangfire.Mongo1 reaction · 1 comment
- Jun 6, 2022Mongo Driver Compatibility — alirezanet/Gridify1 reaction · 3 comments
- Mar 31, 2015Support for 2.0 async driver — RobThree/MongoRepository1 reaction · 35 comments
- Sep 29, 2026Bump MongoDB.Driver from 2.11.5 to 2.19.0 — ramonaoldf/run-devops0 reactions
- Sep 15, 2026Bump the nuget group with 1 update — ApurvSinghal/ApurvXam0 reactions
- Aug 2, 2026Bump MongoDB.Driver from 2.8.1 to 2.19.0 — mohaom/TailwindTraders-Website0 reactions
- Jan 12, 2025Bump MongoDB.Driver from 2.14.1 to 2.19.0 in /src/Infrastructure — vigovlugt/LeagueOfItemsBackend0 reactions
- Aug 6, 2024Update dependency MongoDB.Driver to 2.19.0 [SECURITY] — MrDariusAD/DynamicFilter0 reactions
- Aug 6, 2024Update dependency MongoDB.Driver to 2.12.2 [SECURITY] — ShamKarthikS-Hexaware/recicd0 reactions
- Aug 6, 2024Update dependency MongoDB.Driver to 2.12.2 [SECURITY] — MrDariusAD/GirlfriendAdventskalender0 reactions
- Jan 15, 2024Bump MongoDB.Driver.Core and MongoDB.Bson — kravvya/GardenLog.V20230 reactions
- Nov 17, 2023build(deps): bump MongoDb_Version from 2.19.0 to 2.22.0 — AntonioFalcaoJr/EventualShop0 reactions
- Mar 28, 2023Bump MongoDB.Driver from 2.19.0 to 2.19.1 — eincioch/dotnet-microservices-boilerplate0 reactions
- Mar 27, 2023Bump MongoDB.Driver from 2.19.0 to 2.19.1 — niaz-ali-khan/microservise0 reactions
- Mar 3, 2023Bump MongoDB.Driver from 2.13.1 to 2.19.0 in /DotNet/POC/DatabaseBenchmark — AdamNagy/Nadam.Tryouts0 reactions
- Mar 3, 2023Bump MongoDB.Driver from 2.12.3 to 2.19.0 in /Esiur.Stores.MongoDB — esiur/esiur-dotnet0 reactions
- Oct 17, 2022Bump MongoDB.Driver from 2.17.1 to 2.18.0 in /src/backend — ScottishTapWater/OrderBook0 reactions
- Oct 17, 2022fix(deps): bump MongoDB.Driver from 2.16.1 to 2.18.0 — Manu0912/doppler-push-contact0 reactions
- Oct 17, 2022Bump MongoDB.Driver from 2.13.0 to 2.18.0 — uruk-project/uruk-server0 reactions
- Oct 17, 2022Bump MongoDB.Driver from 2.15.1 to 2.18.0 — joelbyford/ApiPatternsClient0 reactions
- Oct 14, 2022Bump MongoDB.Driver from 2.13.1 to 2.18.0 in /examples/AspNetCoreMvc — brucehu123/opentelemetry-dotnet-instrumentation0 reactions
- Oct 14, 2022Bump MongoDB.Driver from 2.12.4 to 2.18.0 in /services/common/Platform.Common — frogsbreath-games/eucre0 reactions
- Oct 14, 2022Bump MongoDB.Driver from 2.12.4 to 2.18.0 in /services/lobby/Platform.Lobby.Tests — frogsbreath-games/eucre0 reactions
- Oct 14, 2022Bump MongoDB.Driver from 2.12.4 to 2.18.0 in /services/eucre-game/Games.Eucre.Api — frogsbreath-games/eucre0 reactions
- Oct 14, 2022Bump MongoDB.Driver from 2.12.4 to 2.18.0 in /services/weather/Weather.Api — frogsbreath-games/eucre0 reactions
- Oct 14, 2022Bump MongoDB.Driver from 2.12.4 to 2.18.0 in /services/library/Platform.Library.Api — frogsbreath-games/eucre0 reactions
- May 24, 2022Bump MongoDB.Driver from 2.13.1 to 2.15.1 in /examples/AspNetCoreMvc — brucehu123/opentelemetry-dotnet-instrumentation0 reactions
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about checking a change actually works.
Of the AGENTS.md files we read, the 11,773 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository35 other files it gives its agents.
- AGENTS.mdAGENTS.md
- src/MongoDB.Bson/AGENTS.mdAGENTS.md
- src/MongoDB.Driver/AGENTS.mdAGENTS.md
- src/MongoDB.Driver.Authentication.AWS/AGENTS.mdAGENTS.md
- src/MongoDB.Driver/Core/AGENTS.mdAGENTS.md
- src/MongoDB.Driver/Core/Bindings/AGENTS.mdAGENTS.md
- src/MongoDB.Driver/Core/Events/AGENTS.mdAGENTS.md
- src/MongoDB.Driver/Core/Logging/AGENTS.mdAGENTS.md
- src/MongoDB.Driver/Core/Operations/AGENTS.mdAGENTS.md
- src/MongoDB.Driver.Encryption/AGENTS.mdAGENTS.md
- src/MongoDB.Driver/Encryption/AGENTS.mdAGENTS.md
- src/MongoDB.Driver/GeoJsonObjectModel/AGENTS.mdAGENTS.md
- src/MongoDB.Driver/GridFS/AGENTS.mdAGENTS.md
- src/MongoDB.Driver/Linq/AGENTS.mdAGENTS.md
- src/MongoDB.Driver/Search/AGENTS.mdAGENTS.md
- tests/MongoDB.Driver.TestHelpers/AGENTS.mdAGENTS.md
- tests/MongoDB.Driver.Tests/Specifications/AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- src/MongoDB.Bson/CLAUDE.mdCLAUDE.md
- src/MongoDB.Driver.Authentication.AWS/CLAUDE.mdCLAUDE.md
- src/MongoDB.Driver/Authentication/CLAUDE.mdCLAUDE.md
- src/MongoDB.Driver/CLAUDE.mdCLAUDE.md
- src/MongoDB.Driver/Core/Bindings/CLAUDE.mdCLAUDE.md
- src/MongoDB.Driver/Core/CLAUDE.mdCLAUDE.md
- src/MongoDB.Driver/Core/Events/CLAUDE.mdCLAUDE.md
- src/MongoDB.Driver/Core/Logging/CLAUDE.mdCLAUDE.md
- src/MongoDB.Driver/Core/Operations/CLAUDE.mdCLAUDE.md
- src/MongoDB.Driver.Encryption/CLAUDE.mdCLAUDE.md
- src/MongoDB.Driver/Encryption/CLAUDE.mdCLAUDE.md
- src/MongoDB.Driver/GeoJsonObjectModel/CLAUDE.mdCLAUDE.md
- src/MongoDB.Driver/GridFS/CLAUDE.mdCLAUDE.md
- src/MongoDB.Driver/Linq/CLAUDE.mdCLAUDE.md
- src/MongoDB.Driver/Search/CLAUDE.mdCLAUDE.md
- tests/MongoDB.Driver.TestHelpers/CLAUDE.mdCLAUDE.md
- tests/MongoDB.Driver.Tests/Specifications/CLAUDE.mdCLAUDE.md
The file
We split this AGENTS.md into the rules it gives an agent
3 rules. About 0 are common, 2 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 17
If speculative auth completed (speculativeAuthenticate.done == true), nothing more to do.
- Distinctive: line 113
X.509 username mismatch: If you specify a username, it must match the cert subject DN/SAN.
- Distinctive: line 136
If a test you need requires an env var that's not set, stop and tell the user — don't work around it.
≈ “Common” is an estimate: at least 1 in 5 of the 16,595 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Authentication — AGENTS.md
The authentication subsystem under src/MongoDB.Driver/Authentication/ plus the optional sibling project src/MongoDB.Driver.Authentication.AWS/. Responsible for credential storage, mechanism negotiation, the SASL conversation, the speculativeAuthenticate handshake optimization, and integration with Core/Connections/ConnectionInitializer.
High-level flow
- User configures
MongoCredentialonMongoClientSettings(or a connection string). MongoClientinitialization callsAuthenticatorFactory.Create()→ anIAuthenticator(typicallyDefaultAuthenticator).- During connection open,
ConnectionInitializer.SendHello()may injectspeculativeAuthenticate(via the authenticator'sCustomizeInitialHelloCommand) to fold the first auth step into the hello. - If speculative auth completed (
speculativeAuthenticate.done == true), nothing more to do. - Otherwise,
ConnectionInitializer.Authenticate()invokes the authenticator. For SASL mechanisms,SaslAuthenticatororchestrates asaslStart/saslContinueloop, feeding bytes between eachISaslStepand the server. - Servers 7.0+ may demand re-auth mid-session via error 391 (
ReauthenticationRequired, GA'd alongside OIDC); mechanisms implementOnReAuthenticationRequiredto clear caches and reset.
Common abstractions
IAuthenticator—Authenticate/AuthenticateAsync/CustomizeInitialHelloCommand. Implementations:DefaultAuthenticator(negotiates SCRAM-SHA-1/256),SaslAuthenticator(wraps anyISaslMechanism),MongoDBX509Authenticator.ISaslMechanism— algorithm-specific. PropertiesNameandDatabaseName; methodsInitialize,CreateSpeculativeAuthenticationStep,CustomizeSaslStartCommand,OnReAuthenticationRequired,TryHandleAuthenticationException.ISaslStep— one round-trip.Execute/ExecuteAsyncreturn a(byte[] BytesToSendToServer, ISaslStep NextStep)value tuple — there is no namedSaslStepResulttype.SaslAuthenticator— drives the loop; callssaslStart(new conversation) orsaslContinue(existingconversationId) per step.MongoClientSettings.Extensionsis apublic static readonly IExtensionManageraccessor (not an instance property), so the registry is reached via the static callMongoClientSettings.Extensions.SaslMechanismsand returns anISaslMechanismRegistry— pluggable mechanism factories. Built-in mechanisms register at startup; consumers registerMONGODB-AWSby explicitly callingMongoClientSettings.Extensions.AddAWSAuthentication()from the AWS assembly — registration is not automatic.
Mechanisms
SCRAM-SHA-1 / SCRAM-SHA-256 (ScramSha/)
Files: ScramShaSaslMechanism.cs, ScramShaFirstSaslStep.cs, ScramShaSecondSaslStep.cs, ScramShaLastSaslStep.cs, IScramShaAlgorithm.cs, ScramSha1Algorithm.cs, ScramSha256Algorithm.cs, ScramCache.cs.
Conversation: client-first → server-first → client-final → server-final (RFC 5802). Salted password computed via PBKDF2; ClientKey, StoredKey, ClientProof, ServerSignature derived per the spec.
DefaultAuthenticator picks the mechanism: if the hello reply includes saslSupportedMechs and SCRAM-SHA-256 is in the list, use SHA-256; otherwise SHA-1 (including the case where saslSupportedMechs is absent on older servers).
ScramCache keys on (SaslPreppedPassword, salt, iterations) and stores derived keys (ClientKey, ServerKey) as the cache values. The SASLprep-normalized password is held in the cache key (ScramCacheKey) as a SecureString — the same handling UsernamePasswordCredential uses for the in-memory password — so the key can gate lookups without keeping a managed string copy of plaintext-equivalent material in scope. Single-entry cache; primarily skips PBKDF2 on re-authentication.
Speculative auth supported here for SCRAM (SHA-1 and SHA-256). The hello carries speculativeAuthenticate: { saslStart: ... } and the server replies with the first server-first message inline. Across this directory, the mechanisms that speculate are: SCRAM (this section, both SHA variants), X.509 (non-SASL — see that section), and OIDC (only when a non-expired token is cached). PLAIN, GSSAPI, and MONGODB-AWS all return null from CreateSpeculativeAuthenticationStep and do not speculate.
X.509 (MongoDBX509Authenticator)
Mechanism: MONGODB-X509. Not SASL — a single authenticate command after a TLS mutual-auth handshake. Username is optional; if omitted, the server uses the cert subject DN. Speculative auth supported.
Requires tlsCertificateKeyFile (or programmatic SslSettings.ClientCertificates). Never use without TLS — the entire security argument relies on it.
GSSAPI / Kerberos (Gssapi/)
Files: GssapiSaslMechanism.cs, GssapiFirstSaslStep.cs, GssapiNegotiateSaslStep.cs, GssapiInitializeSaslStep.cs, ISecurityContext.cs, SecurityContextFactory.cs (platform dispatch — SSPI on Windows, libgssapi on Linux/macOS), Sspi/ (Windows SSPI P/Invoke), Libgssapi/ (Linux/macOS dynamic load).
Mechanism properties: SERVICE_NAME (default mongodb), CANONICALIZE_HOST_NAME (DNS-resolve to FQDN), REALM / SERVICE_REALM. SPN format: <SERVICE_NAME>/<FQDN>[@REALM].
Native dependency. On Linux/macOS, libgssapi must be installed at runtime; missing library throws on first auth attempt, not at MongoClient construction. No speculative auth (stateful handshake; can't be embedded in hello).
Cross-platform fragile because of (a) DNS canonicalization variance, (b) SPN canonical form expectations on the KDC, (c) GSSAPI library version skew on the host.
OIDC (Oidc/)
Files: OidcSaslMechanism.cs, OidcConfiguration.cs, OidcCredentials.cs, IOidcCallback.cs, OidcCallbackAdapter.cs, OidcCallbackAdapterFactory.cs, FileOidcCallback.cs, AzureOidcCallback.cs, GcpOidcCallback.cs, HttpRequestOidcCallback.cs, OidcSaslStep.cs (abstract base), OidcCachedCredentialsSaslStep.cs, OidcObtainCredentialsSaslStep.cs.
Two production flows, selected by the ENVIRONMENT mechanism property on MongoCredential:
- Callback —
ENVIRONMENTunset; user suppliesIOidcCallback. For custom integrations (CI tokens, vault, etc.). - Environment —
ENVIRONMENTset to one of the values in the private__supportedEnvironmentsset inOidcConfiguration:test,azure(IMDS),gcp(metadata service),k8s(mounted token). Thetestvalue is for the spec test harness;azure/gcp/k8sare the real cloud paths. (The set isprivate static readonly— there is no publicSupportedEnvironmentsmember to grep for.)
The OIDC_ENV environment variable is read only by the test suite to pick which environment-flow to exercise — see tests/MongoDB.Driver.Tests/Specifications/auth/OidcAuthenticationProseTests.cs (the OidcEnvironmentName constant) and tests/MongoDB.Driver.Tests/UnifiedTestOperations/UnifiedEntityMap.cs. Production code reads the ENVIRONMENT mechanism property.
OidcCallbackAdapter caches OidcCredentials (token + expiry + optional refresh token). Speculative auth engages only when there's a non-expired cached token; otherwise it returns null (so the main flow can refresh).
Mid-operation token expiry: TryHandleAuthenticationException can refresh and replay the SASL exchange. The retry is at the auth layer, not the operations layer — operation-level retry doesn't help here.
PLAIN (Plain/)
PlainSaslMechanism.cs, PlainSaslStep.cs. Single round-trip: base64-encoded \0username\0password per RFC 4616. Used for LDAP-backed deployments. TLS is mandatory — PLAIN over plaintext is a credential leak. No speculative auth.
AWS IAM (separate project: src/MongoDB.Driver.Authentication.AWS/)
Mechanism: MONGODB-AWS. Lives in its own NuGet package to avoid forcing the AWS SDK on every consumer. Files: AWSSaslMechanism.cs, CredentialsSources/IAWSCredentialsSource.cs (the abstraction), CredentialsSources/AWSInstanceCredentialsSource.cs, CredentialsSources/AWSFallbackCredentialsSource.cs, SaslSteps/AWSFirstSaslStep.cs, SaslSteps/AWSLastSaslStep.cs, AWSSignatureVersion4.cs. The MONGODB-AWS mechanism is wired into the global ISaslMechanismRegistry via ExtensionManagerExtensions.cs.
Credential resolution: explicit credentials supplied via MongoCredential.CreateCredential("$external", username, password) with mechanism=MONGODB-AWS (or via the connection-string equivalent) are handled by AWSInstanceCredentialsSource. There is no CreateAwsIam factory on MongoCredential. Anything else is delegated to the AWS SDK's DefaultAWSCredentialsIdentityResolver (via AWSFallbackCredentialsSource), which owns the chain — see the AWS SDK for the authoritative ordering of sources (env vars, AppConfig/profile, AssumeRoleWithWebIdentity, ECS task role, EC2 instance profile via IMDS, etc.). Don't go hunting for chain logic in this tree; the SDK owns it.
Wire format: SigV4-signed sts service request (hard-coded in AWSSignatureVersion4.cs per the MONGODB-AWS spec) embedded in the SASL payload. Region is derived from the STS host header — AWSSignatureVersion4.GetRegion(host) hard-codes us-east-1 for the exact host sts.amazonaws.com, splits any other host on . and takes the segment after the first dot (i.e. split[1], e.g. sts.us-west-2.amazonaws.com → us-west-2), and falls back to us-east-1 when no such segment is present. It is not parsed from the connection string or fetched from EC2 metadata. No speculative auth — AWSSaslMechanism.CreateSpeculativeAuthenticationStep() returns null; only SCRAM, X.509, and OIDC (with a non-expired cached token) speculate.
External (External/)
Non-SASL credential providers shared by OIDC and AWS — ExternalCredentialsAuthenticators (singleton holder), IExternalAuthenticationCredentialsProvider, CacheableCredentialsProvider, plus AzureAuthenticationCredentialsProvider and GcpAuthenticationCredentialsProvider.
These fetch tokens from cloud metadata endpoints; the OIDC mechanism then sends the token over SASL. Caching with TTL prevents storms on the metadata service.
Connection-time integration
Entry: Core/Connections/ConnectionInitializer. Sequence inside BinaryConnection.Open:
- Open TCP/TLS stream.
ConnectionInitializer.SendHello— possibly withspeculativeAuthenticateinjected.ConnectionInitializer.Authenticate— callsIAuthenticator.Authenticate. IfspeculativeAuthenticate.done == true, this is a no-op.- Compression negotiation.
ConnectionDescriptionis finalized (immutable).
Auth occurs per connection, not per operation. A pooled connection holds its authenticated state until reset (e.g., on pool clear, fork detection, or re-auth required).
Common pitfalls
- Default mechanism on old servers. No
saslSupportedMechsin hello → SCRAM-SHA-1. Don't assume SHA-256 is universal. - Explicit mechanism mismatch. User sets
mechanism=SCRAM-SHA-256against an old server →NotSupportedException. UseMongoCredential.CreateCredential(the default-mechanism path) and letDefaultAuthenticatornegotiate; MONGODB-CR is removed and there is noCreateMongoDBCRfactory. - GSSAPI library missing. Throws at first auth, not at construction. Surface a clear error in deployment docs.
- OIDC token expiry mid-operation. Auth-layer retry refreshes the token, but if the user's callback blocks (e.g., interactive prompt), the operation stalls.
- AWS metadata server blocked. Some VPC configs disable IMDS. Provide explicit credentials or use a sidecar.
- PLAIN without TLS. The driver doesn't enforce TLS when PLAIN is configured — your deployment must. This is a known gap; enforcement could be added in
PlainSaslMechanismby checkingSslSettings.UseTlsbefore proceeding, but it has not been done. Don't treat the absence of enforcement as intentional design. - Speculative auth assumption skew.
DefaultAuthenticatoronly reuses speculative results if the hello reply confirms. Don't shortcut by trusting the request. - X.509 username mismatch. If you specify a username, it must match the cert subject DN/SAN; mismatched username is a confusing "auth failed".
- Auth failures are not retried. The Operations layer doesn't retry
MongoAuthenticationException— the connection is closed, and a fresh connection re-auths from scratch. Re-auth-required (error 391) is handled at the mechanism layer, not retry. - Per-mechanism cache lifetime.
ScramCacheis per mechanism instance;OidcCallbackAdaptercaches across connections in the same client. NewMongoClient→ fresh cache.
How to test
Required env vars by mechanism (see root AGENTS.md for the full table):
| Mechanism | Env vars |
| AWS IAM | AWS_TESTS_ENABLED |
| GSSAPI | GSSAPI_TESTS_ENABLED, AUTH_HOST, AUTH_GSSAPI |
| OIDC | OIDC_ENV (one of test, azure, gcp, k8s) |
| X.509 | MONGO_X509_CLIENT_CERTIFICATE_PATH, MONGO_X509_CLIENT_CERTIFICATE_PASSWORD |
| PLAIN | PLAIN_AUTH_TESTS_ENABLED |
dotnet test tests/MongoDB.Driver.Tests/MongoDB.Driver.Tests.csproj -f net10.0 \
--filter "FullyQualifiedName~Authentication"JSON-driven runners under tests/MongoDB.Driver.Tests/Specifications/auth/ exercise the cross-driver test suite.
If a test you need requires an env var that's not set, stop and tell the user — don't work around it.
Boundaries
- vs
Core/Connections. That layer drives connection establishment and calls into the authenticator. Authentication doesn't open sockets. - vs
Driverroot (MongoCredential,MongoIdentity,MongoX509Identity, etc.). The root types are public API — adding/changing them is SemVer. The mechanisms here are internal. - vs
Driver.Authentication.AWS. Optional dependency; the driver functions without it. AWS-specific code stays in that project.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

