Comments (4)
Yes, seems like a good idea. Go for it :)
from vertx-web.
After some investigation client sessions are tricky to implement due to the fact that the store needs to access the context both to load the session cookie to the session object and to serialize back the session object to the cookie at the end of the request.
In order to keep the API simple and minimal we might need to refactor the session store interface otherwise we need to duplicate the cookie handler and session handler code.
from vertx-web.
Storing the sessionData
on a cookie is the same as using just a Cookie
. Assume the following scenario: you have a webshop application and user {userId: 1}
adds a book to the basket, you would then do: session.put('basket', [ 'item1' ])
and you expect that at the end of the request a cookie is sent to the client with: {userId: 1, basket: [ 'item1' ]}
, so what is the role of the session store?
To me it seems that this is exactly the same as:
context.response().addCookie(Cookie.create('session',
JSON.stringify({userId: 1, basket: [ 'item1' ]}))
Now if you do this, then you can totally skip the server side and add items to your session at the client side since clients can read and write cookies (is this is configured to be allowed).
So from the the server side all you need in fact is to read the cookie which is trivial:
context.getCookie('session').getValue()
In reply to your other comment about security, well if you're sending all your session data in a cookie then there is always a chance that it will expose private information, if you want to encrypt the data, that is also simple, starting from the example above:
context.response().addCookie(
Cookie.create('session',
someEncryptionFunction(JSON.stringify({userId: 1, basket: [ 'item1' ]})))
you just need to implement your encryption function with your preferred algorithm.
I don't think we should refactor the current API just to implement a NO-OP store @stephane-bastian WDYT?
from vertx-web.
Since there is no feedback on this issue I'll close it for now and it can be re-open if there is interest.
from vertx-web.
Related Issues (20)
- How to upgrade Snakeyaml to 2.0 in vertx 4.x? HOT 1
- When the WebSocket connection is closed, the registrations is not clear! HOT 3
- CSRF Handler can "trap" users HOT 7
- BodyHandler: document setDeleteUploadedFilesOnEnd HOT 2
- FileUpload API improvements
- BodyHandler default body limit change HOT 1
- Vertx Web Validation circular refs tests are failing
- fail() in RoutingContextImpl constructor causes "Unhandled exception in router" even if error was handled
- converting routing context request to web socket returns text handler id as null. HOT 1
- ForwardedParser parse XFF IPV6. HOT 4
- sqlConnection.updateWithParams HOT 1
- VertxRest HOT 1
- Investigate if Vertx WebClient can support HTTP proxy server proxying HTTPS requests HOT 1
- Add webUser() method to io.vertx.ext.web.handler.graphql.ws.Message HOT 2
- vertx-web-graphql subscription onError() is not returning a payload of an array of GraphQLErrors HOT 1
- `BodyHandler` with `deleteUploadedFilesOnEnd=true` fail to clean temporary file HOT 1
- GraphQLWS: store the RoutingContext in GraphQLContext HOT 1
- Deprecate GraphQLHandler#getRoutingContext HOT 1
- Support request forwarding to Web API Service with new OpenAPI Router
- Handling close connection with GraphQLWSHandler HOT 8
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 vertx-web.