All!
I just see that symfony2 router doesn't use the host part of the uri. I need to separate COUNTRY as third subdomain and locale as first element in route path
http://{country}.mysite.com/{_locale}/myaction, i.e.
en.mysite.com/en/action --- english companies & english language
de.mysite.com/ru/action --- deutschland companies & russian language
ru.mysite.com/uk/action --- russian companies & ukrainian language
The problem solved with service like below:
-- config.yml
services:
kernel.listener.subdomain_listener:
class: Acme\DemoBundle\Listener\SubdomainListener
tags:
- { name: kernel.event_listener, event: kernel.request, method: onDomainParse }
-- SubdomainListener.php
<?php
namespace Acme\DemoBundle\Listener;
use Symfony\Component\EventDispatcher\EventDispatcher;
use Symfony\Component\EventDispatcher\Event;
class SubdomainListener
{
public function onDomainParse(Event $event)
{
$request = $event->getRequest();
$session = $request->getSession();
// todo: parsing subdomain to detect country
$session->set('subdomain', $request->getHost());
}
}
BUT... The question is: how It's possIble (right wAy) to implement AUTH process between several subdomains transparently only once ??
user logged via en.mysite.com/{_locale}/...
user going to de.mysite.com/{_locale}/... but system knows about him(her) and doesn't ask the login/password credentials again
Does anybody help me ? Thanks for advance! Certified Senior Oracle Developer/DBA