thruster-rs / Thruster

A fast, middleware based, web framework written in Rust
MIT License
1.06k stars 47 forks source link

Added basic JWT context with example. #149

Closed rakshith-ravi closed 4 years ago

rakshith-ravi commented 4 years ago

No clue if it works or not.

@trezm I'm not even sure if I understand the way this is supposed to work. Do let me know if you want me to make any other changes.

trezm commented 4 years ago

Hey there @rakshith-ravi, this doesn't compile for me right now -- missing the frank_jwt dep and a few imports.

Beyond that, I'd recommend moving the custom context you've made into its own file, and then putting the whole thing in a jwt_example folder with a main.rs. That will help logically separate the code for newcomers looking at this example as well as keep the code a little cleaner :)

rakshith-ravi commented 4 years ago

Updated my PR. The example doesn't seem to compile for some reason. Fixed all other issues. However, it keeps expecting a BasicContext when I've clearly initialized it as a JwtContext. Could you take a look at it and see if I'm missing something?

rakshith-ravi commented 4 years ago

Okay yeah. Made the changes. It compiles well now. The generation function was the issue

rakshith-ravi commented 4 years ago

Okay, yeah. All fixed and working

trezm commented 4 years ago

Awesome, thanks so much for the contribution!! All merged in!