# Question about router, Middleware and handler

**URL:** <https://discourse.laminas.dev/t/question-about-router-middleware-and-handler/2813>\
**Category:** Components & MVC\
**Tags:** middleware, laminas-mvc, laminas-router, laminas-mvc-middleware\
**Created:** [March 14, 2022, 6:19am UTC](https://discourse.laminas.dev/t/question-about-router-middleware-and-handler/2813 "2022-03-14T06:19:49Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![voltan](https://yyz2.discourse-cdn.com/flex032/user_avatar/discourse.laminas.dev/voltan/32/710_2.png) [@voltan](https://discourse.laminas.dev/u/voltan)\
**Post date:** [March 14, 2022, 6:19am UTC](https://discourse.laminas.dev/t/question-about-router-middleware-and-handler/2813/1 "2022-03-14T06:19:49Z")

</div>

Hello  
I worked on some modules via laminas MVC and Middleware, I needed some parameters like `validator` name for request or `permission` for each handler to manage RBAC and same.

I put all of them in route default options and have access and use them in Middleware and handler. like this example

```auto
    'child_routes' => [
        'login' => [
            'type' => Literal::class,
            'options' => [
                'route' => '/login',
                'defaults' => [
                    'module' => 'user',
                    'section' => 'api',
                    'package' => 'profile',
                    'handler' => 'login',
                    'permissions' => 'user_login',
                    'validation' => 'login',
                    'controller' => PipeSpec::class,
                    'middleware' => new PipeSpec(
                        Middleware\SecurityMiddleware::class,
                        Middleware\ValidationMiddleware::class,
                        Handler\Api\LoginHandler::class
                    ),
                ],
            ],
        ],
    ],

```

Is true? or better I should use another way?

thanks
