Friday, 7 September 2018

Custom Http Basic authentication using Gin framework

Recently, I have been working with gin framework in golang. So in our case, we needed to add HTTP basic authentication. gin framework provides basic auth in following way where we need to provide accounts information(pairs of username and passwords) 

But It does not work well when you want to authenticate username and password against database. 
So I wrote following middleware to handle it.


This way it avoids you to specify all username/password pairs in middleware for basicauth.

No comments:

Post a Comment