英文:
Authboss with Database
问题
我几周前刚开始学习Go语言,我想尝试为一个Web服务器实现一种身份验证系统。我找到了authboss,它似乎是一个完美的解决方案,但我不知道如何将其与传统数据库集成。它似乎只是将所有数据存储在自己的内存中,如果服务器崩溃或需要重新启动,那将是一场噩梦。有人有什么想法、思路或建议吗?
英文:
I just started learning Go a couple weeks ago, and I want to try and implement a kind of authentication system for a web server. Now, I found authboss which seems like a perfect solution except I don't understand how to integrate it with a traditional database. It seems like it just stores everything in its own memory which is a nightmare if the server crashes or needs to be restarted. That having been said, does anyone have any ideas, thoughts, or recommendations?
答案1
得分: 2
-
要使用带有数据库后端的authboss身份验证,您需要编写一个“存储器”实现。目前没有很多现成的数据库存储器可用(至少我没有找到)。
-
使用数据库后端的示例身份验证实现:
- http://www.josephspurrier.com/go-web-app-example/(使用MySQL或Postgres)
- https://blue-jay.github.io/ 上述实现的更新版本。看起来非常有前途。
- https://github.com/qor/auth(使用GORM)
根据GitHub上的星标数量,authboss是最受欢迎的。
当然,还有商业选项,例如https://auth0.com/blog/authentication-in-golang/
可以在这里找到可用的身份验证库和框架的长列表:https://github.com/avelino/awesome-go#authentication-and-oauth
英文:
-
To use authboss authentication with a database backend you need to write a 'storer' implementation. There aren't very many database storers readily available (at least I haven't been able to find them).
-
Example authentication implementations with a database backend:
- http://www.josephspurrier.com/go-web-app-example/ (Uses MySQL or Postgres)
- https://blue-jay.github.io/ An updated version of the above implementation. Looks very promising.
- https://github.com/qor/auth (Uses GORM)
Based on the number of stars on github, authboss is the most popular.
Of course, there are also commercial options, e.g. https://auth0.com/blog/authentication-in-golang/
A long list of available authentication libraries and frameworks can be found here: https://github.com/avelino/awesome-go#authentication-and-oauth
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论