Skip to content

Commit d10b4f1

Browse files
committed
add documentation about new features
1 parent 734c88a commit d10b4f1

File tree

1 file changed

+20
-7
lines changed

1 file changed

+20
-7
lines changed

README.md

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -122,20 +122,34 @@ $config->addField(new Field([
122122
```
123123

124124
### Security:
125-
Bundle provides two type of security check:
126-
* check access to resolve root level operation
127-
* check access to resolve any field (include root level fields, child field, ast fields).
125+
Bundle provides two ways to guard your application: using black/white operation list or using security voter.
126+
127+
#### Black/white list
128+
Used to guard some root operations. To enable it you need to write following in your config.yml file:
129+
```yaml
130+
graph_ql:
131+
132+
#...
133+
134+
security:
135+
black_list: ['hello'] # or white_list: ['hello']
136+
137+
```
138+
#### Using security voter:
139+
Used to guard any field resolve and support two types of guards: root operation and any other field resolving (including internal fields, scalar type fields, root operations). To guard root operation with your specified logic you need to enable it in configuration and use `SecurityManagerInterface::RESOLVE_ROOT_OPERATION_ATTRIBUTE` attribute. The same things need to do to enable field guard, but in this case use `SecurityManagerInterface::RESOLVE_FIELD_ATTRIBUTE` attribute.
140+
[Official documentation](http://symfony.com/doc/current/security/voters.html) about voters.
128141

129142
> Note: Enabling field security lead to a significant reduction in performance
130143

131-
To enable security you need to write following in your config.yml file:
144+
Config example:
132145
```yaml
133146
graph_ql:
134147
security:
135148
field_resolve: true # for any field security
136149
root_operation_resolve: true # for root level security
137150
```
138-
Then to create standard security voter for that ([official documentation](http://symfony.com/doc/current/security/voters.html)), as in example below:
151+
152+
Voter example (add in to your `services.yml` file with tag `security.voter`):
139153
```php
140154
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
141155
use Symfony\Component\Security\Core\Authorization\Voter\Voter;
@@ -176,11 +190,10 @@ class GraphQLVoter extends Voter
176190
}
177191
}
178192
```
179-
Now GraphQL executor will check access for every field/operation, based on configuration.
180193

181194

182195
## GraphiQL extension:
183-
To run [graphiql extension](https://github.com/graphql/graphiql) just try to access to `http://your_domain/explorer`
196+
To run [graphiql extension](https://github.com/graphql/graphiql) just try to access to `http://your_domain/graphql/explorer`
184197

185198
## Documentation
186199
All detailed documentation is available on the main GraphQL repository – http://github.com/youshido/graphql/.

0 commit comments

Comments
 (0)