File tree Expand file tree Collapse file tree 2 files changed +4
-6
lines changed
versioned_docs/version-v22 Expand file tree Collapse file tree 2 files changed +4
-6
lines changed Original file line number Diff line number Diff line change @@ -84,8 +84,7 @@ class AuthorisationDirective implements SchemaDirectiveWiring {
8484 DataFetcher authDataFetcher = new DataFetcher () {
8585 @Override
8686 public Object get (DataFetchingEnvironment dataFetchingEnvironment ) throws Exception {
87- Map <String , Object> contextMap = dataFetchingEnvironment.getContext ();
88- AuthorisationCtx authContext = (AuthorisationCtx ) contextMap .get ("authContext" );
87+ AuthorisationCtx authContext = dataFetchingEnvironment .getGraphQlContext ().get ("authContext" );
8988
9089 if (authContext .hasRole (targetAuthRole )) {
9190 return originalDataFetcher .get (dataFetchingEnvironment );
@@ -119,7 +118,7 @@ AuthorisationCtx authCtx = AuthorisationCtx.obtain();
119118
120119ExecutionInput executionInput = ExecutionInput . newExecutionInput()
121120 .query(query)
122- .context( authCtx)
121+ .graphQLContext(builder - > builder . put( " authContext " , authCtx) )
123122 .build();
124123```
125124
Original file line number Diff line number Diff line change @@ -84,8 +84,7 @@ class AuthorisationDirective implements SchemaDirectiveWiring {
8484 DataFetcher authDataFetcher = new DataFetcher () {
8585 @Override
8686 public Object get (DataFetchingEnvironment dataFetchingEnvironment ) throws Exception {
87- Map <String , Object> contextMap = dataFetchingEnvironment.getContext ();
88- AuthorisationCtx authContext = (AuthorisationCtx ) contextMap .get ("authContext" );
87+ AuthorisationCtx authContext = dataFetchingEnvironment .getGraphQlContext ().get ("authContext" );
8988
9089 if (authContext .hasRole (targetAuthRole )) {
9190 return originalDataFetcher .get (dataFetchingEnvironment );
@@ -119,7 +118,7 @@ AuthorisationCtx authCtx = AuthorisationCtx.obtain();
119118
120119ExecutionInput executionInput = ExecutionInput . newExecutionInput()
121120 .query(query)
122- .context( authCtx)
121+ .graphQLContext(builder - > builder . put( " authContext " , authCtx) )
123122 .build();
124123```
125124
You can’t perform that action at this time.
0 commit comments