Current context examples are limited, and certain standard procedures in servers related to use context (setting certain request states like user auth or moving a value from one middleware to another) are not clear on how to do in thruster.
As a user, I would like to add a new field to the context, for example
there is an endpoint to access certain DB records, that I need to be "private"
in middleware, I would like to authenticate the user and know her/his role and what permissions she/he has
I would like to save the role in the context as a Map or HashMap (to get later like context.user.get("roles"))
Then in another middleware read this context field and use it in certain logic.
Another use case would be to validate input in one middleware, parse/map it, then use this modified data in another middleware.
Request
Add an example of creating a custom Context with custom optional fields
Add an example of setting a custom field in one middleware, and reading it in other middleware (or controller)
Current context examples are limited, and certain standard procedures in servers related to use context (setting certain request states like user auth or moving a value from one middleware to another) are not clear on how to do in thruster.
As a user, I would like to add a new field to the context, for example
context.user.get("roles")
)Another use case would be to validate input in one middleware, parse/map it, then use this modified data in another middleware.
Request