This plugin wraps around the subscribe method for subscriptions
and performs authorization, making sure that that JwtToken subject is authorized to access a GraphQL resource.
The websocket is closed with error code 4403 if the access token has expired, allowing the client
to re-establish the connection.
If any other error is thrown, the websocket is closed with error code 4401.
!!!!!!!!!! IMPORTANT !!!!!!!!!!
When using this plugin, 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.
This plugin wraps around the
subscribe
method for subscriptions and performs authorization, making sure that that JwtToken subject is authorized to access a GraphQL resource.The websocket is closed with error code 4403 if the access token has expired, allowing the client to re-establish the connection. If any other error is thrown, the websocket is closed with error code 4401.
!!!!!!!!!! IMPORTANT !!!!!!!!!!
When using this plugin, 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.