Existence and uniqueness of global Koopman eigenfunctions for stable fixed points and periodic orbits