How do I apply a graphql-middleware to my Apollo Federation?

Hello, I don’t use the managed Apollo federation instead I have a solution which looks like this:

const server = new ApolloServer({
  gateway: new ApolloGateway({
    
    supergraphSdl: new IntrospectAndCompose({
      subgraphs: [
        // ...
      ],
    }),
    
  }),
});

How do I apply a graphql-middleware to my federation GraphQL schema? I’d like to add a middleware which does access control in my gateway server before the request reaches the downstream services.