1

How should I login a user to ONLY to their own subdomain from a main domain? (btw, I'm using Yii. Raw PHP ideas would be welcome too, but I'd like Yii compatible ideas)

I've looked at other questions such as this one but they seem to log the user into ALL subdomains. (basically they seem to be basic sso authentication, which is NOT exactly what I want)

Each user in my app has their own subdomain. They visit the main domain website (so no subdomain yet) and then login. In the login process I need to log the user into their subdomain and then redirect them to their subdomain. In other words, I need to transfer their login session from the main domain to their subdomain, but I can't seem to get this working.

I also tried using the CHttpSession class that Yii provides to set session vars and stuff, but that hasn't been working either.

I'd appreciate any help.

Community
  • 1
  • 1
train
  • 610
  • 2
  • 11
  • 20
  • Have you adjusted the cookie domain that you are setting? What have you tried? – acorncom Jan 12 '14 at 02:12
  • Specifically, I've tried setting the session name to be something else than the default with session_name() and then setting the cookie params with session_set_cookie_params(0, '/', '.some_domain.com') manually in PHP and with Yii's CHtppSession class. These are from the link I provided above and they don't work the way I need it to work. – train Jan 12 '14 at 17:24
  • I've also tried setting the cookie domain in the yii main config, but again, that doesn't accomplish what I need to do. That just enabled a user to log into ALL subdomains. I only need the user to log into their own subdomains. – train Jan 12 '14 at 17:25
  • 1
    I not sure that i fully understand what you need, but you can store session in DB, then load it on your subdomain. To make user log in only to his subdomain, put name to session and then check it with filter or even in brforeAction() in base controller. – ineersa Jan 13 '14 at 08:06

0 Answers0