where the Extensions are stored? #2312
-
im trying to store the authorized User in the Extensions and later use them in handlers for identity purposes, I want to know if extensions are reliable for such tasks, can users somehow... change them? or is it possible to access them from external sources? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 5 replies
-
Yep that's a valid use case.
By "users" I suppose you mean clients calling your API, in which case no, users cannot change them. Extensions are purely a thing in http crate.. It's just a way to store additional data at runtime. They're not transmitted as part of the request or anything (that'd require serialization among other things). For more details on how extensions are implemented see https://lucumr.pocoo.org/2022/1/6/rust-extension-map/ |
Beta Was this translation helpful? Give feedback.
Yep that's a valid use case.
By "users" I suppose you mean clients calling your API, in which case no, users cannot change them. Extensions are purely a thing in http crate.. It's just a way to store additional data at runtime. They're not transmitted as part of the request or anything (that'd require serialization among other things).
For more details on how extensions are implemented see https://lucumr.pocoo.org/2022/1/6/rust-extension-map/