Commits

eugenio pombi  committed 7fcdffb

adds security for create route

  • Participants
  • Parent commits 922a6a5
  • Tags cap7

Comments (0)

Files changed (2)

File app/config/security.yml

 security:
-    encoders:
-        Symfony\Component\Security\Core\User\User: plaintext
-
-    role_hierarchy:
-        ROLE_ADMIN:       ROLE_USER
-        ROLE_SUPER_ADMIN: [ROLE_USER, ROLE_ADMIN, ROLE_ALLOWED_TO_SWITCH]
-
+    firewalls:
+        secured_area:
+            pattern:    ^/
+            anonymous: ~
+            http_basic:
+                realm: "Secured Book Creation"
+    access_control:
+        - { path: ^/books/create, roles: ROLE_USER }
     providers:
         in_memory:
             memory:
                 users:
-                    user:  { password: userpass, roles: [ 'ROLE_USER' ] }
-                    admin: { password: adminpass, roles: [ 'ROLE_ADMIN' ] }
-
-    firewalls:
-        dev:
-            pattern:  ^/(_(profiler|wdt)|css|images|js)/
-            security: false
-
-        login:
-            pattern:  ^/demo/secured/login$
-            security: false
-
-        secured_area:
-            pattern:    ^/demo/secured/
-            form_login:
-                check_path: _security_check
-                login_path: _demo_login
-            logout:
-                path:   _demo_logout
-                target: _demo
-            #anonymous: ~
-            #http_basic:
-            #    realm: "Secured Demo Area"
-
-    access_control:
-        - { path: ^/demo/secured/hello/admin/, roles: ROLE_ADMIN }
-        #- { path: ^/login, roles: IS_AUTHENTICATED_ANONYMOUSLY, requires_channel: https }
+                    user1:  { password: 1234, roles: 'ROLE_USER' }
+    encoders:
+        Symfony\Component\Security\Core\User\User: plaintext

File src/PUGX/BookBundle/Tests/Controller/DefaultControllerTest.php

 
     public function testCreate()
     {
-        $client = static::createClient();
+        $client = static::createClient(array(), array(
+            'PHP_AUTH_USER' => 'user1',
+            'PHP_AUTH_PW'   => '1234',
+        ));
         $em = static::$kernel->getContainer()->get('doctrine')->getManager();
 
         $crawler = $client->request('GET', '/books/create');