From 2886d4b61a17fb2c43cf3cab3edefda9da4c79c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20N=C3=A9grier?= Date: Mon, 26 Aug 2019 12:10:31 +0200 Subject: [PATCH] Improving authentication management documentation --- docs/authentication_authorization.md | 11 +++++++++++ .../Fixtures/Mocks/MockResolvableInputObjectType.php | 1 - 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/docs/authentication_authorization.md b/docs/authentication_authorization.md index ef85e98266..690c77f95c 100644 --- a/docs/authentication_authorization.md +++ b/docs/authentication_authorization.md @@ -153,3 +153,14 @@ interface AuthorizationServiceInterface public function isAllowed(string $right): bool; } ``` + +You need to write classes that implement these interfaces. Then, you must register those classes with GraphQLite. +It you are [using the `SchemaFactory`](other-frameworks.md), you can register your classes using: + +```php +// Configure an authentication service (to resolve the @Logged annotations). +$schemaFactory->setAuthenticationService($myAuthenticationService); +// Configure an authorization service (to resolve the @Right annotations). +$schemaFactory->setAuthorizationService($myAuthorizationService); +``` + diff --git a/tests/Fixtures/Mocks/MockResolvableInputObjectType.php b/tests/Fixtures/Mocks/MockResolvableInputObjectType.php index e0282e0771..f9fe0f6b44 100644 --- a/tests/Fixtures/Mocks/MockResolvableInputObjectType.php +++ b/tests/Fixtures/Mocks/MockResolvableInputObjectType.php @@ -8,7 +8,6 @@ use GraphQL\Type\Definition\InputObjectType; use GraphQL\Type\Definition\ResolveInfo; use LogicException; -use function parent; use TheCodingMachine\GraphQLite\Types\ResolvableMutableInputInterface; class MockResolvableInputObjectType extends InputObjectType implements ResolvableMutableInputInterface