'Yes We Did,' Obama Says in Farewell Address, but Warns of Threats to Democracy