func (ah *authHandshaker) FinishHandshake(ctx context.Context, conn driver.Connection) error {
	performAuth := ah.options.PerformAuthentication
	if performAuth == nil {
		performAuth = func(serv description.Server) bool {
			// Authentication is possible against all server types except arbiters
			return serv.Kind != description.RSArbiter
		}
	}
	desc := conn.Description()
	if performAuth(desc) && ah.options.Authenticator != nil {
		err := ah.options.Authenticator.Auth(ctx, desc, conn)
		if err != nil {
			return newAuthError("auth error", err)
		}
	}

	if ah.wrapped == nil {
		return nil
	}
	return ah.wrapped.FinishHandshake(ctx, conn)
}
// FinishHandshake performs authentication for conn if necessary.
FinishHandshake performs authentication for conn if necessary.
// FinishHandshake performs authentication for conn if necessary .
func (ah *authHandshaker) FinishHandshake(ctx context.Context, conn driver.Connection) error {
	performAuth := ah.options.PerformAuthentication
	if performAuth == nil {
		performAuth = func(serv description.Server) bool {
			return serv.Kind != description.RSArbiter
		}
	}
	desc := conn.Description()
	if performAuth(desc) && ah.options.Authenticator != nil {
		err := ah.options.Authenticator.Auth(ctx, desc, conn)
		if err != nil {
			return newAuthError("auth error", err)
		}
	}
	if ah.wrapped == nil {
		return nil
	}
	return ah.wrapped.FinishHandshake(ctx, conn)
}
func ( ah * authHandshaker ) FinishHandshake ( ctx context . Context , conn driver . Connection ) error { performAuth := ah . options . PerformAuthentication if performAuth == nil { performAuth = func ( serv description . Server ) bool { return serv . Kind != description . RSArbiter } } desc := conn . Description ( ) if performAuth ( desc ) && ah . options . Authenticator != nil { err := ah . options . Authenticator . Auth ( ctx , desc , conn ) if err != nil { return newAuthError ( " " , err ) } } if ah . wrapped == nil { return nil } return ah . wrapped . FinishHandshake ( ctx , conn ) }
FinishHandshake performs authentication for conn if necessary.
FinishHandshake performs authentication for conn if necessary .
// Authentication is possible against all server types except arbiters