src/Synapse/User/UserServiceProvider.php
protected function setFirewallsAndAccessRules(Application $app)
    {
        $app->extend('security.firewalls', function ($firewalls, $app) {
            $createUser = new RequestMatcher('^/users$', null, ['POST']);
            $verifyRegistration = new RequestMatcher('^/users/[0-9]+/verify-registration$', null, ['POST']);

            $userFirewalls = [
                'create-users' => [
                    'pattern'   => $createUser, // User registration endpoint is public
                    'anonymous' => true,
                ],
                'verify-registration' => [
                    'pattern'   => $verifyRegistration, // User registration endpoint is public
                    'anonymous' => true,
                ],
                'reset-password' => [
                    'pattern'   => '^/user/reset-password$',
                    'anonymous' => true,
                ],
            ];

            return array_merge($userFirewalls, $firewalls);
        });

        $app->extend('security.access_rules', function ($rules, $app) {
            $usersAdminFunctionRequestMatcher = new RequestMatcher('^/users/\d+$', null, ['GET']);
            $newRules = [
                [$usersAdminFunctionRequestMatcher, 'ROLE_ADMIN']
            ];
            return array_merge($newRules, $rules);
        });
    }
protected function setFirewallsAndAccessRules(Application $app)
    {
        $app->extend('security.firewalls', function ($firewalls, $app) {
            $createUser = new RequestMatcher('^/users$', null, ['POST']);
            $verifyRegistration = new RequestMatcher('^/users/[0-9]+/verify-registration$', null, ['POST']);

            $userFirewalls = [
                'create-users' => [
                    'pattern'   => $createUser, // User registration endpoint is public
                    'anonymous' => true,
                ],
                'verify-registration' => [
                    'pattern'   => $verifyRegistration, // User registration endpoint is public
                    'anonymous' => true,
                ],
                'reset-password' => [
                    'pattern'   => '^/user/reset-password$',
                    'anonymous' => true,
                ],
            ];

            return array_merge($userFirewalls, $firewalls);
        });

        $app->extend('security.access_rules', function ($rules, $app) {
            $usersAdminFunctionRequestMatcher = new RequestMatcher('^/users/\d+$', null, ['GET']);
            $newRules = [
                [$usersAdminFunctionRequestMatcher, 'ROLE_ADMIN']
            ];
            return array_merge($newRules, $rules);
        });
    }
protected function setFirewallsAndAccessRules ( Application $ app ) { $ app -> extend ( 'security.firewalls' , function ( $ firewalls , $ app ) { $ createUser = new RequestMatcher ( '^/users$' , null , [ 'POST' ] ) ; $ verifyRegistration = new RequestMatcher ( '^/users/[0-9]+/verify-registration$' , null , [ 'POST' ] ) ; $ userFirewalls = [ 'create-users' => [ 'pattern' => $ createUser , // User registration endpoint is public 'anonymous' => true , ] , 'verify-registration' => [ 'pattern' => $ verifyRegistration , // User registration endpoint is public 'anonymous' => true , ] , 'reset-password' => [ 'pattern' => '^/user/reset-password$' , 'anonymous' => true , ] , ] ; return array_merge ( $ userFirewalls , $ firewalls ) ; } ) ; $ app -> extend ( 'security.access_rules' , function ( $ rules , $ app ) { $ usersAdminFunctionRequestMatcher = new RequestMatcher ( '^/users/\d+$' , null , [ 'GET' ] ) ; $ newRules = [ [ $ usersAdminFunctionRequestMatcher , 'ROLE_ADMIN' ] ] ; return array_merge ( $ newRules , $ rules ) ; } ) ; }
Set user related firewalls

@param Application $app
Set user related firewalls