mirror of
https://github.com/gtsteffaniak/filebrowser.git
synced 2026-11-26 08:29:41 -05:00
Co-authored-by: Aditya Raj Singh <github@adityaraj.com> Co-authored-by: tbsagdic <86909795+tbsagdic@users.noreply.github.com> Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
28 lines
722 B
Go
28 lines
722 B
Go
package settings
|
|
|
|
const (
|
|
defaultGroupsClaim = "groups"
|
|
defaultLdapGroupsClaim = "memberOf"
|
|
)
|
|
|
|
// ResolveGroupsClaim returns the configured groups claim or the shared default when empty.
|
|
func ResolveGroupsClaim(claim string) string {
|
|
if claim == "" {
|
|
return defaultGroupsClaim
|
|
}
|
|
return claim
|
|
}
|
|
|
|
// ResolveLdapGroupsClaim returns the configured LDAP groups attribute or memberOf when empty.
|
|
func ResolveLdapGroupsClaim(claim string) string {
|
|
if claim == "" {
|
|
return defaultLdapGroupsClaim
|
|
}
|
|
return claim
|
|
}
|
|
|
|
// applyAuthCommonDefaults sets shared defaults for external auth methods that support group claims.
|
|
func applyAuthCommonDefaults(c *AuthCommon) {
|
|
c.GroupsClaim = ResolveGroupsClaim(c.GroupsClaim)
|
|
}
|