Symfony http basic auth only for non authenticated users

Viewed 782

in a symfony application we have preview domains for our clients. they start with client. if the client is logged in they should not have to enter http basic auth credentials.

So what i want to achieve is:

  • Client is logged in -> access to this firewall part without http basic
  • Client is not logged in -> has to enter http basic credentials

This is my configuration:

  providers:
    preview_users:
       memory:
          users:
            'client':
              password: 'mypass'
              roles: ROLE_PREVIEWER
  firewalls:
    preview_domain:
      provider: preview_users
      host: ^client-\d+
      http_basic:
        realm: "Client Preview"

  encoders:
   "Symfony\Component\Security\Core\User\User": plaintext

  access_control:
   - { host: ^client-\d+, roles: ROLE_PREVIEWER } 

what am i missing?

1 Answers
Related