func (a *DefaultAuthenticator) Auth(ctx context.Context, desc description.Server, conn driver.Connection) error {
	var actual Authenticator
	var err error

	switch chooseAuthMechanism(desc) {
	case SCRAMSHA256:
		actual, err = newScramSHA256Authenticator(a.Cred)
	case SCRAMSHA1:
		actual, err = newScramSHA1Authenticator(a.Cred)
	default:
		actual, err = newMongoDBCRAuthenticator(a.Cred)
	}

	if err != nil {
		return newAuthError("error creating authenticator", err)
	}

	return actual.Auth(ctx, desc, conn)
}
// Auth authenticates the connection.
Auth authenticates the connection.
// Auth authenticates the connection .
func (a *DefaultAuthenticator) Auth(ctx context.Context, desc description.Server, conn driver.Connection) error {
	var actual Authenticator
	var err error
	switch chooseAuthMechanism(desc) {
	case SCRAMSHA256:
		actual, err = newScramSHA256Authenticator(a.Cred)
	case SCRAMSHA1:
		actual, err = newScramSHA1Authenticator(a.Cred)
	default:
		actual, err = newMongoDBCRAuthenticator(a.Cred)
	}
	if err != nil {
		return newAuthError("error creating authenticator", err)
	}
	return actual.Auth(ctx, desc, conn)
}
func ( a * DefaultAuthenticator ) Auth ( ctx context . Context , desc description . Server , conn driver . Connection ) error { var actual Authenticator var err error switch chooseAuthMechanism ( desc ) { case SCRAMSHA256 : actual , err = newScramSHA256Authenticator ( a . Cred ) case SCRAMSHA1 : actual , err = newScramSHA1Authenticator ( a . Cred ) default : actual , err = newMongoDBCRAuthenticator ( a . Cred ) } if err != nil { return newAuthError ( " " , err ) } return actual . Auth ( ctx , desc , conn ) }
Auth authenticates the connection.
Auth authenticates the connection .