feat: retrieve and store groups from ldap provider

This commit is contained in:
Stavros
2026-01-09 23:23:36 +02:00
parent 467c580ec4
commit 1b2bf3902c
12 changed files with 94 additions and 18 deletions

View File

@@ -141,6 +141,21 @@ func (controller *UserController) loginHandler(c *gin.Context) {
Provider: "username",
}
if userSearch.Type == "ldap" {
ldapUser, err := controller.auth.GetLdapUser(userSearch.Username)
if err != nil {
log.Error().Err(err).Str("username", req.Username).Msg("Failed to get LDAP user details")
c.JSON(500, gin.H{
"status": 500,
"message": "Internal Server Error",
})
return
}
sessionCookie.LdapGroups = strings.Join(ldapUser.Groups, ",")
}
log.Trace().Interface("session_cookie", sessionCookie).Msg("Creating session cookie")
err = controller.auth.CreateSessionCookie(c, &sessionCookie)