Forums / Developer / Single login through different SiteAccess (using sub-domains)

Single login through different SiteAccess (using sub-domains)

Author Message

Hakim Bouras

Sunday 09 May 2010 8:14:40 am

Hi,

I am using 3 SiteAccess for a multilingual site (ez 4.3) - with a "Host" access:

  • eng.mysite.com
  • fr.mysite.com
  • admin.mysite.com

I would like to be able to log on "eng.mysite.com" and go to "fr.mysite.com" without having to log again.

I have set in site.ini :

[Session]
SessionNameHandler=default
SessionNamePerSiteAccess=disabled

But it does not work, the cookies set by the application still have a cookie_domain set to "eng.mysite.com" - and I have to log on each siteaccess.

Any idea, if it is possible to do and if so how ?

Thanks,
Hakim

In my php.ini, I have default settings such as:

  • session.cookie_path = /
  • session.cookie_domain =

Hakim Bouras

Friday 14 May 2010 6:35:45 am

Hi,

Based on the doc written in site.ini (see below), I was expecting that it is possible to go through different site access with the same login by setting the SessionNameHandler to "default". But it does not work for me.

Any help to find out :

  1. if it is feasable
  2. what are the correct settings to use

will be greatly appreciated.

Thanks,
Hakim

Extract from site.ini (eZ PUblish 4.3)

# Decides how the name of the session value is handled.
# Possible values are:
# default - Let PHP decide the session name, this also rules
# out the possiblity for per-siteaccess sessions.
# custom - Use SessionNamePrefix for name. per-siteaccess sessions are possible.
SessionNameHandler=default

# Whether the session name should be unique per siteaccess.
# By enabling this you will be able to get one unique login per siteaccess.
# Session name is md5 encoded to avoid issues with non alphanumeric characters.
# Note: Will only work if SessionNameHandler is set to custom
SessionNamePerSiteAccess=enabled

Yannick Olympio

Thursday 09 September 2010 1:46:57 am

Hi Hakim,

Don't know if you've found something to make it work on your side ... Theses days I was working on a similar thing. Here is the workaround I've found :

Edit your site.ini like that :

[Session]
SessionNameHandler=custom
SessionNamePerSiteAccess=disabled

Set a common cookie_domain for all your sub domains! To do that you can edit your apache virtual_host and add that line into it :

php_value session.cookie_domain ".mysite.com"

Or you can redefine that php option directly in ez publish by editing the config.php file (in the root of your install) by adding that :

$hostSlices = explode('.', $_SERVER['SERVER_NAME']);
$hostSlices = array_slice($hostSlices, -2, 2);
$hostName = join('.', $hostSlices);
ini_set('session.cookie_domain', '.'.$hostName);

Hope it will be useful for several of us ;)

Gabriel Finkelstein

Wednesday 15 September 2010 10:05:30 am

Maybe this is what you need:

http://share.ez.no/articles/ez-publish/using-a-sso-in-ez-publish/