Ultrahigh energy cosmic rays from shocks in the lobes of powerful radio galaxies