mobiledev/user-bundle

Symfony user bundle

Installs: 367

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Forks: 0

Type:symfony-bundle

dev-master 2020-10-13 11:27 UTC

This package is not auto-updated.

Last update: 2024-04-24 04:15:35 UTC


README

Symfony user bundle

Configuration

# config/packages/doctrine.yaml
    orm:
        resolve_target_entities:
            Symfony\Component\Security\Core\User\UserInterface: App\Entity\User
# config/packages/security.yaml

security:
    encoders:
        Symfony\Component\Security\Core\User\UserInterface: sha512

    # https://symfony.com/doc/current/security.html#where-do-users-come-from-user-providers
    providers:
        # used to reload user from session & other features (e.g. switch_user)
        app_user_provider:
            entity:
                class: Symfony\Component\Security\Core\User\UserInterface
                property: email

        main:
            pattern: ^/
            form_login:
                csrf_token_generator: security.csrf.token_manager
                login_path:     mobiledev_user_login
                use_forward:    false
                check_path:     app_login

            logout:
                path:   mobiledev_user_logout
            anonymous:    true
            switch_user:  { role: ROLE_DEVELOPER }
            guard:
                authenticators:
                    - Mobiledev\UserBundle\Security\FormLoginAuthenticator

# Add this in symfony recipes
mobiledev_user:
  resource: "@MobiledevUserBundle/Controller/"
  type: annotation