minimaloriginal/security-bundle

The security bundle for Minimal

Installs: 6

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 0

Language:HTML

Type:symfony-bundle

dev-master 2017-10-11 12:47 UTC

This package is not auto-updated.

Last update: 2022-11-26 18:55:43 UTC


README

The security bundle for Minimal

Command to launch

bin/console fos:user:create testuser test@example.com p@ssword --super-admin

Register bundle

$bundles = [ ... new FOS\UserBundle\FOSUserBundle(), new MinimalOriginal\SecurityBundle\MinimalSecurityBundle(), ];

Register routes

minimal_security: resource: "@MinimalSecurityBundle/Resources/config/routing.yml" prefix: /

Security configuration

security: encoders: MinimalOriginal\SecurityBundle\Entity\User: bcrypt

role_hierarchy:
    ROLE_ADMIN:       ROLE_USER
    ROLE_SUPER_ADMIN: ROLE_ADMIN

providers:
    minimal_security:
        id: fos_user.user_provider.username_email

firewalls:
    main:
        pattern: ^/
        form_login:
            provider: minimal_security
            csrf_token_generator: security.csrf.token_manager
            # if you are using Symfony < 2.8, use the following config instead:
            # csrf_provider: form.csrf_provider

        logout:       true
        anonymous:    true

access_control:
    - { path: ^/login$, role: IS_AUTHENTICATED_ANONYMOUSLY }
    - { path: ^/register, role: IS_AUTHENTICATED_ANONYMOUSLY }
    - { path: ^/resetting, role: IS_AUTHENTICATED_ANONYMOUSLY }
    - { path: ^/admin/, role: ROLE_USER }