mirror of
https://github.com/a2nt/silverstripe-webpack.git
synced 2024-10-22 17:05:31 +02:00
FIX: GraphQL API Auth
This commit is contained in:
parent
b2691a7112
commit
f56ff9069e
@ -17,10 +17,14 @@ class APIKeyAuthenticator implements AuthenticatorInterface
|
||||
public function authenticate(HTTPRequest $request)
|
||||
{
|
||||
$member = Security::getCurrentUser();
|
||||
if (($member && Permission::checkMember($member, 'CMS_ACCESS')) || (
|
||||
Director::isLive()
|
||||
|
||||
if (Director::isLive()
|
||||
&& $request->getHeader('apikey') !== WebpackTemplateProvider::config()['GRAPHQL_API_KEY']
|
||||
)) {
|
||||
) {
|
||||
if ($member && Permission::checkMember($member, 'CMS_ACCESS')) {
|
||||
return $member;
|
||||
}
|
||||
|
||||
throw new ValidationException('Restricted resource', 401);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user