security:
    # https://symfony.com/doc/current/security.html#where-do-users-come-from-user-providers
    encoders:
        App\Entity\RavUser:
            algorithm: bcrypt
    providers:
        database_users:
            entity:
                class: App\Entity\RavUser
                property: username
    firewalls:
        dev:
            pattern: ^/(_(profiler|wdt)|css|images|js)/
            security: false
            # anonymous: true
        main:
            pattern: ^/

            anonymous: true

            provider: database_users

            # activate different ways to authenticate

            # http_basic: true
            # https://symfony.com/doc/current/security.html#a-configuring-how-your-users-will-authenticate

            # https://symfony.com/doc/current/security/form_login_setup.html
            form_login:
                # user provider
                provider: database_users
                # login form location
                check_path: ravLogin
                # bad login redirection
                login_path: ravLogin
                # token CSRF
                csrf_token_generator: security.csrf.token_manager
                # redirect on successful login
                default_target_path: ravBooks

            logout:
                # logout route
                path: ravLogout
                # logout redirect route
                target: ravHome


    # Easy way to control access for large sections of your site
    # Note: Only the *first* access control that matches will be used
    access_control:
        # - { path: ^/admin, roles: ROLE_ADMIN }
        # - { path: ^/profile, roles: ROLE_USER }
        - { path: '^/user', roles: [ROLE_USER, ROLE_ADMIN] }
        - { path: '^/admin', roles: ROLE_ADMIN }
