How to authenticate users, via Active Directory (AD Samba), or via Freeradius or via a customizable script?
How to customize authentication?
@ismael.m.desousa In the latest version of GoAdmin, you can customize authentication using the API engine.AddAuthService
. For example:
import (
...
"github.com/GoAdminGroup/go-admin/engine"
"github.com/GoAdminGroup/go-admin/plugins/admin/models"
...
)
func main() {
r := gin.Default()
eng := engine.Default()
if err := eng.AddConfig(config.Config{...}); err != nil {
panic(err)
}
// customize authentication frontend interface
template.AddLoginComp(login.GetLoginComponent())
// customize authentication backend API
eng.AddAuthService(func(ctx *context.Context) (model models.UserModel, exist bool, msg string){
// ctx.Request is a golang http.Request object, so you can use that to get the parameters from frontend.
// And then return back a authentication user model, exist means success or not.
})
go func() {
_ = r.Run(":9033")
}()
}
So the next question is how to customize login interface, here you can see the example codes.