Skip to content

Commit

Permalink
feat: drop generic envelop auth plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
n1ru4l committed Oct 22, 2024
1 parent bf2b274 commit e03c912
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 52 deletions.
1 change: 0 additions & 1 deletion packages/services/server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
},
"devDependencies": {
"@envelop/core": "5.0.2",
"@envelop/generic-auth": "7.0.0",
"@envelop/graphql-jit": "8.0.3",
"@envelop/graphql-modules": "6.0.0",
"@envelop/opentelemetry": "6.3.1",
Expand Down
10 changes: 2 additions & 8 deletions packages/services/server/src/graphql-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import {
import { createYoga, Plugin, useErrorHandler, useExecutionCancellation } from 'graphql-yoga';
import hyperid from 'hyperid';
import { isGraphQLError } from '@envelop/core';
import { useGenericAuth } from '@envelop/generic-auth';
import { useGraphQlJit } from '@envelop/graphql-jit';
import { useGraphQLModules } from '@envelop/graphql-modules';
import { useOpenTelemetry } from '@envelop/opentelemetry';
Expand Down Expand Up @@ -157,13 +156,6 @@ export const graphqlHandler = (options: GraphQLHandlerOptions): RouteHandlerMeth
}
}
}),
useGenericAuth({
mode: 'resolve-only',
contextFieldName: 'session',
async resolveUserFn(ctx: Context) {
return options.authN.authenticate(ctx);
},
}),
useHive({
debug: true,
enabled: !!options.hiveConfig,
Expand Down Expand Up @@ -259,6 +251,7 @@ export const graphqlHandler = (options: GraphQLHandlerOptions): RouteHandlerMeth
return async (req, reply) => {
const requestIdHeader = req.headers['x-request-id'] ?? reqIdGenerate();
const requestId = cleanRequestId(requestIdHeader);
const session = await options.authN.authenticate({ req, reply });

await asyncStorage.run(
{
Expand All @@ -271,6 +264,7 @@ export const graphqlHandler = (options: GraphQLHandlerOptions): RouteHandlerMeth
reply,
headers: req.headers,
requestId,
session,
});
});

Expand Down
44 changes: 1 addition & 43 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit e03c912

Please sign in to comment.