Skip to content
Discussion options

You must be logged in to vote

im trying to store the authorized User in the Extensions and later use them in handlers for identity purposes

Yep that's a valid use case.

I want to know if extensions are reliable for such tasks, can users somehow... change them?

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/

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@MrAliSalehi
Comment options

@davidpdrsn
Comment options

@MrAliSalehi
Comment options

@davidpdrsn
Comment options

@davidpdrsn
Comment options

Answer selected by MrAliSalehi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants