title: how to login to subdomain using symfony security if already loggedin on main domain in other app?
body: <p>I am already loggedin to main domain. Say <strong>example.com</strong> (app developed in legacy kohana). I am trying to login to subdmain, say <strong>foo.bar.example.com</strong> . </p>
  
  <p>foo.example.com is symfony app. Below is my configuration. Dev too bar displays "anonymous" user. It doesn't loggin user from session id in cookie. </p>
  
  <p>security.yml</p>
  
  <pre><code># To get started with security, check out the documentation:
  # http://symfony.com/doc/current/book/security.html
  security:
  
      # http://symfony.com/doc/current/book/security.html#where-do-users-come-from-user-providers
      providers:
          in_memory:
              memory: ~
  
      firewalls:
          # disables authentication for assets and the profiler, adapt it according to your needs
          dev:
              pattern: ^/(_(profiler|wdt)|css|images|js)/
              security: false
  
          main:
              anonymous: ~
              # activate different ways to authenticate
  
              # http_basic: ~
              # http://symfony.com/doc/current/book/security.html#a-configuring-how-your-users-will-authenticate
  
              # form_login: ~
              # http://symfony.com/doc/current/cookbook/security/form_login_setup.html
  </code></pre>
  
  <p>Config.yml</p>
  
  <pre><code>framework:
      #esi:             ~
      #translator:      { fallbacks: ["%locale%"] }
      secret:          "%secret%"
      router:
          resource: "%kernel.root_dir%/config/routing.yml"
          strict_requirements: ~
      form:            ~
      csrf_protection: ~
      validation:      { enable_annotations: true }
      #serializer:      { enable_annotations: true }
      default_locale:  "%locale%"
      trusted_hosts:   ~
      trusted_proxies:  %trusted_proxies%
      session:
          # handler_id set to null will use default session handler from php.ini
          handler_id:  'snc_redis.session.handler'
          name: 'MY_COOKIE_NAME'
          cookie_domain: '.example.com'
      fragments:       ~
      http_method_override: true
      request:
          formats:
              pdf: 'application/pdf'
              epub: 'application/epub+zip'
  
  
  snc_redis:
      session:
          client: session
          prefix: ''
      clients:
          default:
              type: predis
              alias: default
              dsn: %redis_dsn%
              logging: false
              options:
  #                profile: 2.6
                  profile: 2.2
                  connection_persistent: false
          slave:
              type: predis
              alias: slave
              logging: false
              dsn: %redis_dsn_slave%
  
          session:
              type: predis
              alias: session
              dsn: %redis_dsn%
  </code></pre>
  
  <p>Do I need to have atleast one authentication provider configured ? or
  I need to write custom authentication provider something which works like remember me ?</p>
  
  <p>Symfony\Component\Security\Http\Firewall\AbstractAuthenticationListener->handle</p>
  
  <p>has </p>
  
  <pre><code>  if ($this-&gt;options['require_previous_session'] &amp;&amp; !$request-&gt;hasPreviousSession()) {
                  throw new SessionUnavailableException('Your session has timed out, or you have disabled cookies.');
              }
  </code></pre>
  
  <p>and Request has</p>
  
  <pre><code>public function hasPreviousSession()
  {
      // the check for $this-&gt;session avoids malicious users trying to fake a session cookie with proper name
      return $this-&gt;hasSession() &amp;&amp; $this-&gt;cookies-&gt;has($this-&gt;session-&gt;getName());
  }
  </code></pre>