authentication - Slim framework route middleware arguments -


i'm writing custom route authorization middleware slim. if understand "route middleware" different "middleware".

i use custom router middleware way:

$app->get('/',$acl->allow(["users","admins"]),function () use ($app) {     ... }); 

where

$acl->allow route middleware:

public function allow($auth=[]){     return function() use($auth){         ...     }; } 

in docs http://docs.slimframework.com/#route-middleware read this:

what arguments passed each route middleware callable?

each middleware callable invoked 1 argument, matched \slim\route object.

how use standard param \slim\route object , custom parameter (in example ["users","admins"])

this simple answer both custom , route param in route middleware callable:

public function allow($auth=[]){     return function($route) use($auth){         //this route:         $route     }; } 

Comments

Popular posts from this blog

java - Plugin org.apache.maven.plugins:maven-install-plugin:2.4 or one of its dependencies could not be resolved -

Round ImageView Android -

How can I utilize Yahoo Weather API in android -