MM-16861: Support Guest Authentication via AD/LDAP (#12690)
* Add config settings for LDAPSettings GuestFilter * make error unique * Update model/config.go Co-Authored-By: Martin Kraft <martin@upspin.org> * add LdapSetting isempty_guest_attribute to diagnostics.go
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
c5dcd85bc8
Коммит
06866952b6
@@ -1687,6 +1687,7 @@ type LdapSettings struct {
|
||||
// Filtering
|
||||
UserFilter *string
|
||||
GroupFilter *string
|
||||
GuestFilter *string
|
||||
|
||||
// Group Mapping
|
||||
GroupDisplayNameAttribute *string
|
||||
@@ -1758,6 +1759,10 @@ func (s *LdapSettings) SetDefaults() {
|
||||
s.UserFilter = NewString("")
|
||||
}
|
||||
|
||||
if s.GuestFilter == nil {
|
||||
s.GuestFilter = NewString("")
|
||||
}
|
||||
|
||||
if s.GroupFilter == nil {
|
||||
s.GroupFilter = NewString("")
|
||||
}
|
||||
@@ -2784,6 +2789,12 @@ func (ls *LdapSettings) isValid() *AppError {
|
||||
return NewAppError("ValidateFilter", "ent.ldap.validate_filter.app_error", nil, err.Error(), http.StatusBadRequest)
|
||||
}
|
||||
}
|
||||
|
||||
if *ls.GuestFilter != "" {
|
||||
if _, err := ldap.CompileFilter(*ls.GuestFilter); err != nil {
|
||||
return NewAppError("LdapSettings.isValid", "ent.ldap.validate_guest_filter.app_error", nil, err.Error(), http.StatusBadRequest)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
Ссылка в новой задаче
Block a user