mirror of
https://github.com/directus/directus.git
synced 2026-04-25 03:00:53 -04:00
Global cookie parser (#5071)
* removed local cookie parser * add global cookie parser Co-authored-by: Rijk van Zanten <rijkvanzanten@me.com>
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import expressLogger from 'express-pino-logger';
|
||||
import cookieParser from 'cookie-parser';
|
||||
import bodyParser from 'body-parser';
|
||||
import express from 'express';
|
||||
import logger from './logger';
|
||||
@@ -89,6 +90,8 @@ export default async function createApp() {
|
||||
return next();
|
||||
});
|
||||
});
|
||||
|
||||
app.use(cookieParser())
|
||||
|
||||
app.use(extractToken);
|
||||
|
||||
|
||||
@@ -6,7 +6,6 @@ import grant from 'grant';
|
||||
import getEmailFromProfile from '../utils/get-email-from-profile';
|
||||
import { InvalidPayloadException } from '../exceptions/invalid-payload';
|
||||
import ms from 'ms';
|
||||
import cookieParser from 'cookie-parser';
|
||||
import env from '../env';
|
||||
import { UsersService, AuthenticationService } from '../services';
|
||||
import grantConfig from '../grant';
|
||||
@@ -77,7 +76,6 @@ router.post(
|
||||
|
||||
router.post(
|
||||
'/refresh',
|
||||
cookieParser(),
|
||||
asyncHandler(async (req, res, next) => {
|
||||
const accountability = {
|
||||
ip: req.ip,
|
||||
@@ -126,7 +124,6 @@ router.post(
|
||||
|
||||
router.post(
|
||||
'/logout',
|
||||
cookieParser(),
|
||||
asyncHandler(async (req, res, next) => {
|
||||
const accountability = {
|
||||
ip: req.ip,
|
||||
|
||||
@@ -3,14 +3,12 @@ import { GraphQLService } from '../services';
|
||||
import { respond } from '../middleware/respond';
|
||||
import asyncHandler from '../utils/async-handler';
|
||||
import { parseGraphQL } from '../middleware/graphql';
|
||||
import cookieParser from 'cookie-parser';
|
||||
|
||||
const router = Router();
|
||||
|
||||
router.use(
|
||||
'/system',
|
||||
parseGraphQL,
|
||||
cookieParser(),
|
||||
asyncHandler(async (req, res, next) => {
|
||||
const service = new GraphQLService({
|
||||
accountability: req.accountability,
|
||||
@@ -28,7 +26,6 @@ router.use(
|
||||
router.use(
|
||||
'/',
|
||||
parseGraphQL,
|
||||
cookieParser(),
|
||||
asyncHandler(async (req, res, next) => {
|
||||
const service = new GraphQLService({
|
||||
accountability: req.accountability,
|
||||
|
||||
Reference in New Issue
Block a user