-
Notifications
You must be signed in to change notification settings - Fork 65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow access to $app from within authenticator, error #25
Comments
Sorry I do not understand. Can you show some example code what you are trying to achieve. |
I may be wrong about it, but here's the error part definition. How could I access $app without using "global"?
Probably the __construct of HttpBasicAuthentication could take $app as argument, and also pass it as arguments to its callbacks. |
PHP has the $app = new \Slim\App;
$app->add(new \Slim\Middleware\HttpBasicAuthentication([
"error" => function ($request, $response, $arguments) use ($app) {
/* do something with $app */
}
])); |
I've completely forgotten about that. Thanks a lot for your time and advice ! |
Useful in many cases to have access to $app and container. E.g. In error, it would be useful to have access to the renderer ($app->getContainer()->get('view') in order to render an error page.
In authenticator, also useful to access app's Model methods, settings, etc.
The text was updated successfully, but these errors were encountered: