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/

eZ debug

Timing: Jan 17 2025 23:52:56
Script start
Timing: Jan 17 2025 23:52:56
Module start 'content'
Timing: Jan 17 2025 23:52:57
Module end 'content'
Timing: Jan 17 2025 23:52:57
Script end

Main resources:

Total runtime1.1190 sec
Peak memory usage4,096.0000 KB
Database Queries199

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0071 594.9297180.7969
Module start 'content' 0.00711.0002 775.7266597.5703
Module end 'content' 1.00730.1117 1,373.2969337.3359
Script end 1.1189  1,710.6328 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00420.3731210.0002
Check MTime0.00160.1409210.0001
Mysql Total
Database connection0.00060.057510.0006
Mysqli_queries1.035392.52251990.0052
Looping result0.00180.16401970.0000
Template Total1.086697.120.5433
Template load0.00250.219520.0012
Template processing1.084296.885220.5421
Template load and register function0.00010.009110.0001
states
state_id_array0.00220.200210.0022
state_identifier_array0.00080.073420.0004
Override
Cache load0.00220.1981730.0000
Sytem overhead
Fetch class attribute can translate value0.00090.082040.0002
Fetch class attribute name0.00130.114870.0002
XML
Image XML parsing0.00180.165340.0005
class_abstraction
Instantiating content class attribute0.00000.001580.0000
General
dbfile0.00260.2315380.0001
String conversion0.00000.000730.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
4content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
4content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
15content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
3content/datatype/view/ezxmltags/li.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/li.tplEdit templateOverride template
2content/datatype/view/ezxmltags/ul.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/ul.tplEdit templateOverride template
12content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1content/datatype/view/ezxmltags/ol.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/ol.tplEdit templateOverride template
12content/datatype/view/ezxmltags/emphasize.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/emphasize.tplEdit templateOverride template
3content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 58
 Number of unique templates used: 11

Time used to render debug report: 0.0003 secs