These are chat archives for gin-gonic/gin

17th
Jul 2017
Phillipp Schmedt
@phillippschmedt
Jul 17 2017 20:24
I wonder if there is actually a good documentation on gin? Besides the examples on github
Javier Provecho Fernandez
@javierprovecho
Jul 17 2017 20:44
@schmedt you also have almost the full source code documented and pretty printed through godoc
If you mean books/guides, no, we don't have them, but pr with content/links are welcome
Phillipp Schmedt
@phillippschmedt
Jul 17 2017 21:15
@javierprovecho Alright. Gin looks pretty cool so far. Coming from Spring MVC and quite new to golang too. Is there any best practices on how to implement a login/logout with Gin?
Phillipp Schmedt
@phillippschmedt
Jul 17 2017 21:44
the drone project is really helpful
Javier Provecho Fernandez
@javierprovecho
Jul 17 2017 22:04

@schmedt not best practices but a common setup is to use the sessions middleware (gin-contrib/sessions) along some integrated basic auth helpers from gin

Remember to protect your endpoint with HTTPS, check gin-gonic/autotls for an automated lets encrypt

If you need something more advanced, I recommend rangelreale/osin and marinates/goth

They are pretty easy to integrate with gin inside a middleware handler chain

Phillipp Schmedt
@phillippschmedt
Jul 17 2017 22:14
@javierprovecho Thanks a lot
unreadable
@unreadable
Jul 17 2017 22:20
Which one do you recommand Javier? Osing or goth?
And BTW @schmedt , just read the source code of the gin, it's better than any docs
Or just post here, I'll try to help you ;)
Phillipp Schmedt
@phillippschmedt
Jul 17 2017 22:22
I found a lot of useful things from reading the drone.io sourcecode.
unreadable
@unreadable
Jul 17 2017 22:22
Nice!
Javier Provecho Fernandez
@javierprovecho
Jul 17 2017 22:33

@krypton97 osin and goth serve different purposes

Goth is for creating an authorized session through a 3rd party oauth 2.0 provider like Google

Osin is an oauth 2.0 framework for creating your own oauth provider

I used to develop a project with both, by using goth to authenticate oauth requests to osin so it could generate a token for later use

Goth expose a nice sessions interface so it is easy to write different backends for storing cookies
And osin expose an interface for token storage
So you can create easily your own storage drivers (although there are some out there, postgres, in memory, etc)
unreadable
@unreadable
Jul 17 2017 22:37
Seems legit, I should have specified that I'm mainly looking for local authentication