Grate the zest from the lemon into a small bowl. Halve the lemon and squeeze the juice from half of it on top of the zest. Add the white beans, shallot or onion, grated garlic, red-pepper flakes and a large pinch of salt and toss well. Drizzle in 1 tablespoon olive oil and set aside.
Bring a large pot of heavily salted water to a boil. Add pasta and cook until just shy of al dente, usually 2 minutes less than the package directs.
Meanwhile, heat a 12-inch sauté pan over medium-high heat. When hot, add the remaining 3 tablespoons oil, then add the asparagus. Sauté until the asparagus is tender and starting to brown at the edges, 7 to 10 minutes. Add a big pinch of salt and the sliced garlic and sauté until the garlic is lightly golden, 1 to 2 minutes longer.
Dip a coffee mug or glass measuring cup into the pasta water and scoop out about 1/2 cup of it to use for the sauce. Drain pasta, shaking it well. Add pasta, bean mixture, parsley and Parmesan to sauté pan and cook until the beans are hot and the pasta is al dente. If the mixture looks dry, splash in some (or all) of the reserved pasta water. Squeeze remaining lemon half over pasta, toss and taste. Season with pepper; add more salt, red-pepper flakes and lemon juice, if desired.