adam-hanna / jwt-auth

This package provides json web token (jwt) middleware for goLang http servers
MIT License
231 stars 43 forks source link

Echo example and odd behaviour #7

Closed krzysztofantczak closed 7 years ago

krzysztofantczak commented 7 years ago

Hi,

First of all, echo example seems kind of outdated. I need to use something like this, to make things work (with echo v3):

e.Use(echo.WrapMiddleware(restrictedRoute.Handler))

and (with echo v2):

e.Use(standard.WrapMiddleware(restrictedRoute.Handler))

Second, it seems that this thing works really weird in here. When i define routes:

/foo
/bar
--- here, i'm using restrictedRoute handler as middleware ----
/baz
/bam

Instead of "protecting" routes /baz and /bam it goes global and includes routes /foo and /bar. Why is that?

adam-hanna commented 7 years ago

Hi,

Thanks for the comments. I'm not too experienced with the echo framework but will look into it and see if there's a bug or will update the docs.

adam-hanna commented 7 years ago

Alright, it looks like the documentation wasn't correct for the echo framework. Thanks for pointing that out!

I updated the example. Let me know if that helps or if you have any more questions.

Thanks again!