<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="/stylesheets/rss.css" type="text/css"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
  <channel>
    <title>Dev411 Blog: Single Sign-On (SSO) with and without subdomains</title>
    <link>http://www.dev411.com/blog/2007/06/16/single-sign-on-sso-with-and-without-subdomains</link>
    <language>en-us</language>
    <ttl>40</ttl>
    <description>John Wang on Technology</description>
    <item>
      <title>Single Sign-On (SSO) with and without subdomains</title>
      <description>&lt;p&gt;If you are running a site without a subdomain, e.g. http://dev411.com and need to maintain cookie-based sessions across other server names with subdomains, e.g. blog.dev411.com and wiki.dev411.com, you will need to customize your session cookies.&lt;/p&gt;

&lt;p&gt;To have your session cookie be used across multiple subdomains, set a wildcard domain which starts with a dot followed by the base domain name, e.g. ".dev411.com", which will make it qualify for all subdomains of dev411.com. This, however, will not work for http://dev411.com where there is no subdomain.&lt;/p&gt;

&lt;p&gt;The have the same session used for http://dev411.com, set a second session cookie without domain. This way the domain-less cookie will be used for http://dev411.com and the wildcard domain cookie will be used for all subdomains.&lt;/p&gt;

&lt;p&gt;Catalyst 5.7007 will only set one cookie per cookie name, however, this solution works best when you can set both cookies with the same name but different cookie domains. I put together a &lt;a class="fix" href="http://www.dev411.com/catalyst/misc/Engine.pm.multi_cookie.patch"&gt;quick patch for &lt;span class="fix"&gt;Catalyst::Engine&lt;/span&gt;&lt;/a&gt; to allow multiple cookies when the cookie value is set to an arrayref.&lt;/p&gt;

</description>
      <pubDate>Sat, 16 Jun 2007 20:06:00 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:a880c3da-4cab-4d9d-9c56-f8298f432a09</guid>
      <author>John Wang</author>
      <link>http://www.dev411.com/blog/2007/06/16/single-sign-on-sso-with-and-without-subdomains</link>
      <category>catalyst</category>
      <category>authentication</category>
      <category>singlesignon</category>
    </item>
    <item>
      <title>"Single Sign-On (SSO) with and without subdomains" by kaylie</title>
      <description>&lt;p&gt;Hi, i&amp;#8217;m setting a cookie for my site using the function below:&lt;/p&gt;


	&lt;p&gt;PHP Code:
$cookieURL = &amp;#8221;.mysite.com&amp;#8221; ; 
$duration= 1&lt;strong&gt;10&lt;/strong&gt;60 + time(); // for 10 minutes 
setcookie(&amp;#8216;cookie1&amp;#8217;,$duration,$duration,$cookiePath,$cookieURL); 
$value=$_COOKIE[&amp;#8216;cookie1&amp;#8217;]; echo &amp;#8220;The value: &amp;#8221;.$value; 
}&lt;/p&gt;


	&lt;pre&gt;&lt;code&gt;if(!isset($_COOKIE['cookie1'])) { $cookiePath = "/" ;&lt;/code&gt;&lt;/pre&gt;


	&lt;p&gt;However, it only works in mozilla.&lt;/p&gt;


	&lt;p&gt;I also tried to playing with the $duration, if i out the $duration to time()+60&lt;strong&gt;60&lt;/strong&gt;24 , the cookie is working in IE&amp;#8230;&lt;/p&gt;


	&lt;p&gt;Why is it when I put the $duration=time()+60*60, it is not working in IE?&lt;/p&gt;


	&lt;p&gt;Do youn know why?&lt;/p&gt;</description>
      <pubDate>Wed, 14 Nov 2007 22:38:42 -0600</pubDate>
      <guid isPermaLink="false">urn:uuid:1e1ea119-43fa-43b7-b729-cacd0980ae09</guid>
      <link>http://www.dev411.com/blog/2007/06/16/single-sign-on-sso-with-and-without-subdomains#comment-216</link>
    </item>
  </channel>
</rss>
