Session sharing across sub domains with one app serving multiple top domains

I want to introduce session sharing across sub domains. I'm aware of the sessionCookieDomain=".domain.com" option, but in my case, I use the same application to serve multiple top domains, domain1.com, domain2.com

What would be the best way to have for each top domain the ability to share sessions across its sub domains?