Advertisement
homelleon

security symfony

May 11th, 2017
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.72 KB | None | 0 0
  1. # routing
  2. file:
  3.     resource: "@FileBundle/Controller/"
  4.     type:     annotation
  5.     prefix:   /
  6.  
  7. admin:
  8.     resource: "@AdminBundle/Controller/"
  9.     type:     annotation
  10.     prefix:   /
  11.  
  12. blog:
  13.     resource: "@BlogBundle/Controller/"
  14.     type:     annotation
  15.     prefix:   /
  16.  
  17. logout:
  18.     path: /logout
  19.  
  20.  
  21.  
  22. # To get started with security, check out the documentation:
  23. # http://symfony.com/doc/current/security.html
  24. security:
  25.  
  26.     # http://symfony.com/doc/current/security.html#b-configuring-how-users-are-loaded
  27.    providers:
  28.         in_memory:
  29.             memory:
  30.                 users:                  
  31.                     admin:
  32.                         password: href
  33.                         roles: 'ROLE_ADMIN'
  34.  
  35.     encoders:
  36.         Symfony\Component\Security\Core\User\User: plaintext
  37.        
  38.     firewalls:
  39.         # disables authentication for assets and the profiler, adapt it according to your needs
  40.        dev:
  41.             pattern: ^/(_(profiler|wdt)|css|images|js)/
  42.             security: false
  43.  
  44.         main:
  45.             anonymous: ~
  46.             # activate different ways to authenticate
  47.  
  48.             # http://symfony.com/doc/current/security.html#a-configuring-how-your-users-will-authenticate
  49.            http_basic: ~
  50.  
  51.             # http://symfony.com/doc/current/cookbook/security/form_login_setup.html
  52.            #form_login: ~            
  53.      
  54.             logout:
  55.                 path: /logout
  56.                 target: /
  57.                    
  58.     access_control:
  59.         # require ROLE_ADMIN for /admin*
  60.        - { path: ^/admin, roles: ROLE_ADMIN }
  61.        
  62.     role_hierarchy:
  63.         ROLE_ADMIN:       ROLE_USER
  64.         ROLE_SUPER_ADMIN: [ROLE_ADMIN, ROLE_ALLOWED_TO_SWITCH]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement