Comments (8)
Great to hear that you are working on a plugin!
The most basic answer to your question is: Add the event handler to the header
event. This event will be triggered once all headers have been recieved but before the body gets loaded, so it's a natural place to put this sort of behaviour. The semantics is that if the last handler returns FALSE
the response is send back without being processed in the request loop. Take a look at the size_limit route in routr
for a possible approach to cutting of processing (this time based on content-length instead of authentication).
Implementation-wise, I would urge you to build this on top of routr
()if you plan to release it) as it makes it easier for others to add other pieces of functionality. The way I would do it is to check the server for existance of a header_routr
plugin during attach_to
. If it exists simply add the handler to the router, if not, create a new header routr with your handler and attach that to the server...
from fiery.
Thanks for your answer.
After looking at sizelimit_route
, I wonder if it would not be easier to write a simple function like this instead of a plugin ?
from fiery.
Indeed, that is also possible... the upside of making it a plugin rather than a route is that the attached plugins can be queried from the app and other plugins can depend on your plugin - I agree that in this case it might be an edge case... may I ask what authentication you’re implementing?
from fiery.
it is for a JWT authentication
from fiery.
I commited a first draft of a JWT plugin here: https://github.com/aneuraz/JWTroutr
what do you think ?
from fiery.
Great - I’ll have a look through tomorrow or next week
from fiery.
Looks exactly like I would have imagined :-) I've made a little PR with some proposed changed but these are minor...
Are you planning on adding functionality for creating new tokens?
from fiery.
Thank you for the PR.
Regarding the creation of new tokens: yes! it is the next step
from fiery.
Related Issues (20)
- Error in get(“PATHINFO”, envir = request) : object ‘PATHINFO’ not found HOT 2
- Log the location of errors
- Stack trace reporting HOT 1
- Consider running on random port in tests HOT 3
- Example linking fiery and vue.js (or react)? HOT 2
- Request Body is Empty HOT 4
- a newcomer's question about Cycle, Message and Block HOT 1
- Writing to the log in a loop, results in only the last 'i' being written N times.
- Test failure with upcoming version of later HOT 1
- Release fiery 1.1.2
- Merge fiery with vue framework HOT 1
- Is there a way I can create Plotly graph in fiery HOT 2
- Add option to run a non-blocking server? HOT 2
- Force HTTPS with Dash for R using Fiery on Heroku HOT 1
- add docker image?
- TLS 1.2 support? HOT 1
- Release fiery 1.1.4
- future::multiprocess is deprecated since long and soon to become defunct HOT 5
- Release fiery 1.2.0
- FYI: parallelly::supportsMulticore()
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fiery.