Barack Obama praised Harvard for its rejection of President Donald Trump's demands as the university faces a funding freeze for alleged inaction on antisemitism.