QHttpServer - middleware /route pre-process?
-
Hey
I may be mistaken as to middleware... but is there a way to set up route pre process/middleware?Say I want to validate request before pushing it to /XX/XX route.
Is there a way to install it in current lib/server?
Or I need to build my own kind-of-wrapper?
Regards
Dariusz -
Hi,
apologies, but I fail to understand what your question is.
BRgds
Axel -
Hi,
apologies, but I fail to understand what your question is.
BRgds
Axel@Axel-Spoerl essentially it goes something like this if I remember correctly...
void middleWareAuth(QNetworkRequest *request ){ /// Perform login check. request.setXX/YY if need to. return True if accept/False if ignore request/stop action. } // Order of route/middleware registration matters. server.addMiddleware(&someSpamProtection) // as example. server.route("/api/login") // we allow for login access from anywhere server.addMiddleware(&middleWareAuth) // anything after this has to be logged in server.route("/api/userAccount") // only call when user/request is verified as logged/cokie/auth etc.
Hope this makes somehow sense...
@SGaist Yep hear of that lib, however I'm trying to stick to official Qt libs only, seeing as then my plugins/etc will work out of the box on DCC apps (maya/vred/nuke/etc/etc)
-
@Axel-Spoerl essentially it goes something like this if I remember correctly...
void middleWareAuth(QNetworkRequest *request ){ /// Perform login check. request.setXX/YY if need to. return True if accept/False if ignore request/stop action. } // Order of route/middleware registration matters. server.addMiddleware(&someSpamProtection) // as example. server.route("/api/login") // we allow for login access from anywhere server.addMiddleware(&middleWareAuth) // anything after this has to be logged in server.route("/api/userAccount") // only call when user/request is verified as logged/cokie/auth etc.
Hope this makes somehow sense...
@SGaist Yep hear of that lib, however I'm trying to stick to official Qt libs only, seeing as then my plugins/etc will work out of the box on DCC apps (maya/vred/nuke/etc/etc)
@Dariusz if I understand correctly you need to write yourself a wrapper (or a separate gateway class for creating and submitting requests) around QNAM. As far as I can tell there is no such analytical proxy-like thing built in.
Mind you, usually where those things are needed you do have a gateway/proxy prohibiting traffic or redirecting it accordingly. But I also thing I understand the need, so I'll stick with the idea of wrapping QNAM in a more tailored fashion.
-
@Dariusz if I understand correctly you need to write yourself a wrapper (or a separate gateway class for creating and submitting requests) around QNAM. As far as I can tell there is no such analytical proxy-like thing built in.
Mind you, usually where those things are needed you do have a gateway/proxy prohibiting traffic or redirecting it accordingly. But I also thing I understand the need, so I'll stick with the idea of wrapping QNAM in a more tailored fashion.
-