Preheat your oven to 375°F (190°C).
In a large bowl, lightly mash the cooked white beans with a fork, leaving some texture.
Whisk in the eggs and Parmesan cheese until just combined.
Heat 2 tablespoons (30 ml / 1 fl oz) of the olive oil or butter in a small skillet over medium-high heat.
Add the minced onion and garlic, cooking and stirring frequently until soft and golden, about 2-3 minutes.
Stir in the rosemary and remove from the heat.
Add the flour, baking powder, a pinch of salt, and a few grinds of black pepper to the bean mixture.
Pour in the cooked onion and garlic mixture.
Stir with a fork until everything is just combined. The mixture should have the consistency of a thick cookie dough; add a tablespoon more flour if it seems too wet.
Use the remaining 2 tablespoons (30 ml / 1 fl oz) of oil or butter to grease a large baking sheet.
Using your hands or a large spoon, form the mixture into 8 evenly-sized patties and arrange them on the prepared sheet.
Bake for about 30 minutes, or until the cakes are golden brown and crisp on the outside.
Serve immediately or at room temperature.