graphql-shieldを保護するために使用していsubgraphます。
const isAuthenticated = rule({ cache: 'contextual' })(async (parent, args, ctx, info) => {
return ctx.isAuthenticated
})
const permissions = shield({
Query: {
'*': and(isAuthenticated)
},
Mutation: {
'*': and(isAuthenticated)
}
})
const server = new ApolloServer({
schema: applyMiddleware(buildSubgraphSchema([{ typeDefs, resolvers }]), permissions),
introspection: global.configuration.ENVIRONMENT === 'development'
})
私のビルド プロセスでは、Apollo Studiorover CLIの更新に使用しています。supergraph schema
rover subgraph introspect http://localhost/graphql | rover subgraph publish super-graph@development --routing-url http://localhost/graphql --schema - --name persons
アクセス許可シールドがエラーをスローするため、rover更新は失敗しNot Authorised!ます。
subgraphwithを保護し、操作graphql-shieldを許可するにはどうすればよいSubgraphIntrospectQueryですか?
ローバー イントロスペクト コマンドにベアラー トークンを追加できることを理解しています。
rover subgraph introspect http://localhost/graphql --header "Authorization: Bearer token"
ただし、ビルド プロセス中にアクセス トークンを生成する方法はありません。