One day before roasting: In a plastic container large enough to hold the ham, stir the water with the salt and brown sugar until dissolved. Add the spices. Score ham in a diamond pattern through the skin and fat, taking care not to cut into the meat. Add ham to brine, weight it with a plate to keep it submerged, and refrigerate for at least 4 but no more than 8 hours. Drain, rinse, pat the ham dry, and refrigerate.
One hour before roasting, remove the ham from the refrigerator. Preheat the oven to 450 degrees F. For the rub: Pulse the olive oil, mustard, parsley, sage, garlic, red pepper, salt, and black pepper in a food processor to make a paste. Rub it all over ham. In a large roasting pan, toss the onion wedges with 1 cup of the apple cider, and set the ham on top. Roast the ham for 30 minutes, reduce the oven temperature 325 degrees F, and roast until an instant-read thermometer inserted into the thickest part registers 165 degrees F, about 4 hours. After the first hour, loosely wrap aluminum foil around the bone to keep it from burning.
Meanwhile, for the glaze: Boil, then simmer, the remaining apple cider in a saucepan, skimming as needed, until syrupy and reduced to about 2 cups, about 1 1/2 hours.
During the last 1 1/2 hours of cooking the ham, brush it with the glaze every 30 minutes. Transfer the cooked ham to an ovenproof platter and let it rest in the turned-off oven for 30 minutes. Loosely cover the onions in a bowl, and put them in the oven as well. Strain the pan juices into a saucepan, skim off any excess fat, and bring to a boil. Make a paste with the flour and butter and whisk a bit at a time into the juices. Boil until thick. Carve the ham and serve with the onions and sauce.