Comments (6)
There's still an option in Rocket to handle plain-text cookies by using the "add" and "get" functions instead of the "add_private" and "get_private" functions. So I think if someone wants to opt-out from the Rocket cookie encryption system and implement their own, it's possible. I was concentrating on making cookie encryption work out-of-the-box in my PR, but if this is a requirement, we can definitely create some generics for cookie handling for advanced users, but still using the Rocket internal handling by default for new users.
However when you say "additional validation", I imagine a validator trait for custom validations AFTER the cookie decryption happens. This could be used to check DBs and stuff based on the data received in the cookie.
Which option would you prefer? Do you think custom encryption is required or is it enough to provide a custom validator for decrypted cookies?
from auth-rs.
Thanks for your input.
I think the option to return another type than a string for user_id would be a meaningful addition.
The best way to do this in my opinion would be to use an extra type parameter and a trait that provides functions to serialise and deserialiaze the user specified type to a string that can be stored inside the private cookie.
The user can then decide to serialise a User struct to a user id. To deserialise it can make a connection to a database.
As for other encryption methods, I think we should stick with rocket private cookies but provide an option to the user to override this behaviour.
from auth-rs.
Alright. I implemented a way for the user to specify what kind the user field should be in UserPass.
I also got rid of Authenticator::COOKIE_IDENTIFIER because I thought I didn't really belong there, because someone who implements Authenticator shouldn't worry about cookie storage, the library should handle that. Instead the correct cookie identifier is fetched from Rocket's config in case the user wants to change it.
from auth-rs.
It's looking good, I especially like the config option for the cookie identifier.
The example login form is a good idea as well, could help a lot for new Rocket users.
One comment:
format!("Restricted administration area, user logged in with ID: {}", info.user)
This should be changed as well, the info.user is not an "ID" anymore.
from auth-rs.
You are right about that, I will fix it now.
from auth-rs.
The library is also updated on crates.io now.
from auth-rs.
Related Issues (5)
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 auth-rs.