mobiledev/user-bundle

Symfony 用户组件包

安装: 368

依赖者: 0

建议者: 0

安全: 0

星标: 0

分支: 0

类型:symfony-bundle

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

This package is not auto-updated.

Last update: 2024-09-25 06:17:22 UTC


README

Symfony 用户组件包

配置

# 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.cn/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