AxGuard plugin is created by combining three plugins - QueryMutationGuardPlugin,
SubscriptionGuardPlugin and PermissionDefinitionExporterPlugin.
This plugin handles authorization for GraphQL resources exposed by the APIs.
For Queries and Mutations an error is thrown if the authorization fails.
In addition, the PermissionDefinitionExporterPlugin exports the permission definition
for the respective service to a file as given by the permissionDefinitionExportPath parameter.
For subscriptions, if the JWT token expires while subscription events are emitted,
the websocket connection is closed with 4403 code, allowing the client to automatically
re-establish the connection.
For authorization errors, the websocket is closed with 4401 code.
!!!!!!!!!! IMPORTANT !!!!!!!!!!
When using this plugin with subscriptions, it's mandatory to send the reference to
the websocket through Extended GraphQL Context with the key name websocket.
getWebsocketFromRequest from @axinom/mosaic-service-common can be used to extract the
websocket from request.
AxGuard plugin is created by combining three plugins -
QueryMutationGuardPlugin,SubscriptionGuardPluginandPermissionDefinitionExporterPlugin.This plugin handles authorization for GraphQL resources exposed by the APIs. For Queries and Mutations an error is thrown if the authorization fails.
In addition, the
PermissionDefinitionExporterPluginexports the permission definition for the respective service to a file as given by thepermissionDefinitionExportPathparameter.For subscriptions, if the JWT token expires while subscription events are emitted, the websocket connection is closed with
4403code, allowing the client to automatically re-establish the connection. For authorization errors, the websocket is closed with4401code.!!!!!!!!!! IMPORTANT !!!!!!!!!!
When using this plugin with subscriptions, it's mandatory to send the reference to the websocket through Extended GraphQL Context with the key name
websocket.getWebsocketFromRequestfrom@axinom/mosaic-service-commoncan be used to extract the websocket from request.