McCain 's Democratic rival , Barack Obama , praised the Supreme Court ruling .