-
-
Notifications
You must be signed in to change notification settings - Fork 918
fix(laravel): fixes to secure a graphql endpoint #6691
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
Conversation
8ee5f60
to
9ce74cc
Compare
@@ -936,51 +940,6 @@ public function register(): void | |||
); | |||
}); | |||
|
|||
if ($this->app['config']->get('api-platform.graphql.enabled')) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's not good to read configuration inside the register method as it may change when boot
is called
$app->make(CallableProcessor::class), | ||
); | ||
}); | ||
|
||
$app->singleton(ResolverFactoryInterface::class, function (Application $app) { | ||
return new ResolverFactory( | ||
$app->make('api_platform.graphql.state_provider'), | ||
$app->make('api_platform.graphql.state_provider.access_checker'), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@vinceAmstoutz I splitted the system providers for Laravel!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@soyuka 🎉 Can we prepare documentation now and merge it when your PR will be merged?
if (isset($values[$parsedKey[0]])) { | ||
$values = $values[$parsedKey[0]]; | ||
|
||
if ($filter instanceof FilterInterface) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
at some point this will get deprecated
As @toitzi reported GraphQl endpoints had no way to be secured. After a few messages we decided to introduce a new configuration option:
This gives the ability to plugin in a global auth middleware and to use Policies with GraphQl operations.