Oh thank you! 

On Friday, September 2, 2016 at 4:40:51 PM UTC-5, fabrizi...@gmail.com 
wrote:
>
> Here is an example:
> https://play.golang.org/p/3mFS_7-mM8
>
> You have two wrapper handlers (logIt and authIt). authIt, authenticates 
> every handler you want to authenticate. For simplicity it takes a user id 
> from a url and checks roles.
> logIt is another wrapper handler, that logs every handler and it extracts 
> the authenticated user.
>
> You can test on your local machine:
> http://localhost:8001/do2?u=test will authenticate
> http://localhost:8001/do1?u=fabrizio will authenticate
> http://localhost:8001/do1?u=test will not authenticate
>
> You can check the logs (stdout) and see that the logIt handler is 
> extracting the userInfo from the context and logging it.
>
>
> On Friday, September 2, 2016 at 12:39:16 PM UTC-7, kevin.nor...@gmail.com 
> wrote:
>>
>> If I understand correctly using Context will allow "middleware" to pass 
>> data into the handler? Can someone provide a simple example please. 
>>
>>
>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to