Cover of the book Symfony 5: The Fast Track

Symfony 5: The Fast Track is the best book to learn modern Symfony development, from zero to production. +300 pages showcasing Symfony with Docker, APIs, queues & async tasks, Webpack, SPAs, etc.

SecurityBundle integration

SecurityBundle integration

A user provider is available for your MongoDB projects if you use Symfony SecurityBundle. It works exactly the same way as the entity user provider described in the cookbook:

  • YAML
    1
    2
    3
    4
    5
    # config/packages/security.yaml
    security:
        providers:
            my_mongo_provider:
                mongodb: {class: App\Document\User, property: username}
    
  • XML
    1
    2
    3
    4
    5
    6
    <!-- config/packages/security.xml -->
    <config>
        <provider name="my_mongo_provider">
            <mongodb class="App\Document\User" property="username" />
        </provider>
    </config>
    

This work, including the code samples, is licensed under a Creative Commons BY-SA 3.0 license.