@envelop/generic-auth 5.0.0 → 5.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -6
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -78,7 +78,7 @@ This mode offers complete protection for the entire API. It protects your entire
|
|
|
78
78
|
To setup this mode, use the following config:
|
|
79
79
|
|
|
80
80
|
```ts
|
|
81
|
-
import { parse, validate, execute, subscribe } from 'graphql'
|
|
81
|
+
import { parse, validate, specifiedRules, execute, subscribe } from 'graphql'
|
|
82
82
|
import { envelop, useEngine } from '@envelop/core'
|
|
83
83
|
import { useGenericAuth, ResolveUserFn, ValidateUserFn } from '@envelop/generic-auth'
|
|
84
84
|
|
|
@@ -94,7 +94,7 @@ const validateUser: ValidateUserFn<UserType> = params => {
|
|
|
94
94
|
|
|
95
95
|
const getEnveloped = envelop({
|
|
96
96
|
plugins: [
|
|
97
|
-
useEngine({ parse, validate, execute, subscribe }),
|
|
97
|
+
useEngine({ parse, validate, specifiedRules, execute, subscribe }),
|
|
98
98
|
// ... other plugins ...
|
|
99
99
|
useGenericAuth({
|
|
100
100
|
resolveUserFn,
|
|
@@ -149,7 +149,7 @@ const GraphQLQueryType = new GraphQLObjectType({
|
|
|
149
149
|
This mode uses the plugin to inject the authenticated user into the `context`, and later you can verify it in your resolvers.
|
|
150
150
|
|
|
151
151
|
```ts
|
|
152
|
-
import { parse, validate, execute, subscribe } from 'graphql'
|
|
152
|
+
import { parse, validate, specifiedRules, execute, subscribe } from 'graphql'
|
|
153
153
|
import { envelop, useEngine } from '@envelop/core'
|
|
154
154
|
import { useGenericAuth, ResolveUserFn, ValidateUserFn } from '@envelop/generic-auth'
|
|
155
155
|
|
|
@@ -165,7 +165,7 @@ const validateUser: ValidateUserFn<UserType> = async params => {
|
|
|
165
165
|
|
|
166
166
|
const getEnveloped = envelop({
|
|
167
167
|
plugins: [
|
|
168
|
-
useEngine({ parse, validate, execute, subscribe }),
|
|
168
|
+
useEngine({ parse, validate, specifiedRules, execute, subscribe }),
|
|
169
169
|
// ... other plugins ...
|
|
170
170
|
useGenericAuth({
|
|
171
171
|
resolveUserFn,
|
|
@@ -196,7 +196,7 @@ const resolvers = {
|
|
|
196
196
|
This mode is similar to option #2, but it uses the `@auth` SDL directive or `auth` field extension for protecting specific GraphQL fields.
|
|
197
197
|
|
|
198
198
|
```ts
|
|
199
|
-
import { parse, validate, execute, subscribe } from 'graphql'
|
|
199
|
+
import { parse, validate, specifiedRules, execute, subscribe } from 'graphql'
|
|
200
200
|
import { envelop, useEngine } from '@envelop/core'
|
|
201
201
|
import { useGenericAuth, ResolveUserFn, ValidateUserFn } from '@envelop/generic-auth'
|
|
202
202
|
|
|
@@ -212,7 +212,7 @@ const validateUser: ValidateUserFn<UserType> = params => {
|
|
|
212
212
|
|
|
213
213
|
const getEnveloped = envelop({
|
|
214
214
|
plugins: [
|
|
215
|
-
useEngine({ parse, validate, execute, subscribe }),
|
|
215
|
+
useEngine({ parse, validate, specifiedRules, execute, subscribe }),
|
|
216
216
|
// ... other plugins ...
|
|
217
217
|
useGenericAuth({
|
|
218
218
|
resolveUserFn,
|
package/package.json
CHANGED