New option to enable local auth for everyone
This commit is contained in:
parent
ff5cefa7ac
commit
b572938283
1
auth.go
1
auth.go
@ -11,6 +11,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var LocalAuthFunc = checkAuthKrb5
|
var LocalAuthFunc = checkAuthKrb5
|
||||||
|
var allowLocalAuth bool
|
||||||
var localAuthUsers arrayFlags
|
var localAuthUsers arrayFlags
|
||||||
|
|
||||||
type loginForm struct {
|
type loginForm struct {
|
||||||
|
20
auth_krb5.go
20
auth_krb5.go
@ -42,17 +42,19 @@ func checkAuthKrb5(c *gin.Context) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
found := false
|
if !allowLocalAuth {
|
||||||
for _, u := range localAuthUsers {
|
found := false
|
||||||
if lf.Login == u {
|
for _, u := range localAuthUsers {
|
||||||
found = true
|
if lf.Login == u {
|
||||||
break
|
found = true
|
||||||
|
break
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if !userExists(lf.Login) && !found {
|
if !userExists(lf.Login) && !found {
|
||||||
c.AbortWithStatusJSON(http.StatusForbidden, gin.H{"errmsg": "You are not allowed to log you in this way. Please use OpenID Connect."})
|
c.AbortWithStatusJSON(http.StatusForbidden, gin.H{"errmsg": "You are not allowed to log you in this way. Please use OpenID Connect."})
|
||||||
return
|
return
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cnf := config.New()
|
cnf := config.New()
|
||||||
|
1
main.go
1
main.go
@ -62,6 +62,7 @@ func main() {
|
|||||||
flag.StringVar(&baseURL, "baseurl", baseURL, "URL prepended to each URL")
|
flag.StringVar(&baseURL, "baseurl", baseURL, "URL prepended to each URL")
|
||||||
flag.UintVar(¤tPromo, "current-promo", currentPromo, "Year of the current promotion")
|
flag.UintVar(¤tPromo, "current-promo", currentPromo, "Year of the current promotion")
|
||||||
flag.UintVar(&OffsetQuestionTimer, "offset-question-timer", OffsetQuestionTimer, "Duration to wait before sending pause msg in direct mode (in milliseconds)")
|
flag.UintVar(&OffsetQuestionTimer, "offset-question-timer", OffsetQuestionTimer, "Duration to wait before sending pause msg in direct mode (in milliseconds)")
|
||||||
|
flag.BoolVar(&allowLocalAuth, "allow-local-auth", false, "Allow local authentication for all users (bypass OIDC).")
|
||||||
flag.Var(&localAuthUsers, "local-auth-user", "Allow local authentication for this user (bypass OIDC).")
|
flag.Var(&localAuthUsers, "local-auth-user", "Allow local authentication for this user (bypass OIDC).")
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user