security.yml 1.6 KB
Newer Older
Mat's avatar
Mat committed
1
security:
2 3 4 5 6 7
    encoders:
        FOS\UserBundle\Model\UserInterface: bcrypt

    role_hierarchy:
        ROLE_ADMIN:       ROLE_USER
        ROLE_SUPER_ADMIN: ROLE_ADMIN
Mat's avatar
Mat committed
8 9

    providers:
10
        fos_userbundle:                           #1
11
            id: fos_user.user_provider.username
Mat's avatar
Mat committed
12

13 14 15
        my_tokenkey_provider:                     #2
            entity:
                class: PotageBundle:User
16 17
                #property: tokenKey
                # je ne peux me référer à une simple propriété puisque c'est un tableau qui peut contenir plusieurs tokens
18

Mat's avatar
Mat committed
19 20
    firewalls:
        main:
21 22
            pattern: ^/
            form_login:
23
                provider: fos_userbundle          #1
24 25 26
                csrf_token_generator: security.csrf.token_manager
                login_path: fos_user_security_login
                check_path: fos_user_security_check
27
                default_target_path: potage_today
28 29 30 31 32
                use_referer : true
            logout:
                path:       fos_user_security_logout
                target:     fos_user_security_login
            anonymous:    true
Mat's avatar
Mat committed
33

34 35 36 37 38
            guard:
                provider: my_tokenkey_provider    #2
                authenticators:
                    - PotageBundle\Security\TokenAuthenticator

39 40 41 42
    access_control:
        - { path: ^/login$, role: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/register, role: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/resetting, role: IS_AUTHENTICATED_ANONYMOUSLY }
43
        - { path: ^/member/, role: ROLE_USER }
44
        - { path: ^/admin/, role: ROLE_ADMIN }
Mat's avatar
Mat committed
45
        - { path: ^/API/, role: ROLE_ADMIN }
46

47