Add fallback authentication through Kerberos
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
nemunaire 2021-09-22 17:02:30 +02:00
parent 4c46386fff
commit 9807eeec1a
8 changed files with 132 additions and 5 deletions

11
auth.go
View file

@ -9,8 +9,19 @@ import (
"github.com/julienschmidt/httprouter"
)
var LocalAuthFunc = checkAuthKrb5
var localAuthUsers arrayFlags
type loginForm struct {
Login string `json:"username"`
Password string `json:"password"`
}
func init() {
router.GET("/api/auth", apiAuthHandler(validateAuthToken))
router.POST("/api/auth", apiRawHandler(func(w http.ResponseWriter, ps httprouter.Params, body []byte) HTTPResponse {
return formatApiResponse(LocalAuthFunc(w, ps, body))
}))
router.POST("/api/auth/logout", apiRawHandler(logout))
}