LDAP: Remove omitempty flag from json annotation (#91843)
* remove omitempty flag from json annotation * fix unit test
This commit is contained in:
@@ -34,44 +34,44 @@ type ServersConfig struct {
|
||||
// ServerConfig holds connection data to LDAP
|
||||
type ServerConfig struct {
|
||||
Host string `toml:"host" json:"host"`
|
||||
Port int `toml:"port" json:"port,omitempty"`
|
||||
Port int `toml:"port" json:"port"`
|
||||
|
||||
UseSSL bool `toml:"use_ssl" json:"use_ssl,omitempty"`
|
||||
StartTLS bool `toml:"start_tls" json:"start_tls,omitempty"`
|
||||
SkipVerifySSL bool `toml:"ssl_skip_verify" json:"ssl_skip_verify,omitempty"`
|
||||
MinTLSVersion string `toml:"min_tls_version" json:"min_tls_version,omitempty"`
|
||||
UseSSL bool `toml:"use_ssl" json:"use_ssl"`
|
||||
StartTLS bool `toml:"start_tls" json:"start_tls"`
|
||||
SkipVerifySSL bool `toml:"ssl_skip_verify" json:"ssl_skip_verify"`
|
||||
MinTLSVersion string `toml:"min_tls_version" json:"min_tls_version"`
|
||||
MinTLSVersionID uint16 `toml:"-" json:"-"`
|
||||
TLSCiphers []string `toml:"tls_ciphers" json:"tls_ciphers,omitempty"`
|
||||
TLSCiphers []string `toml:"tls_ciphers" json:"tls_ciphers"`
|
||||
TLSCipherIDs []uint16 `toml:"-" json:"-"`
|
||||
|
||||
RootCACert string `toml:"root_ca_cert" json:"root_ca_cert,omitempty"`
|
||||
RootCACertValue []string `json:"root_ca_cert_value,omitempty"`
|
||||
ClientCert string `toml:"client_cert" json:"client_cert,omitempty"`
|
||||
ClientCertValue string `json:"client_cert_value,omitempty"`
|
||||
ClientKey string `toml:"client_key" json:"client_key,omitempty"`
|
||||
ClientKeyValue string `json:"client_key_value,omitempty"`
|
||||
BindDN string `toml:"bind_dn" json:"bind_dn,omitempty"`
|
||||
BindPassword string `toml:"bind_password" json:"bind_password,omitempty"`
|
||||
Timeout int `toml:"timeout" json:"timeout,omitempty"`
|
||||
Attr AttributeMap `toml:"attributes" json:"attributes,omitempty"`
|
||||
RootCACert string `toml:"root_ca_cert" json:"root_ca_cert"`
|
||||
RootCACertValue []string `json:"root_ca_cert_value"`
|
||||
ClientCert string `toml:"client_cert" json:"client_cert"`
|
||||
ClientCertValue string `json:"client_cert_value"`
|
||||
ClientKey string `toml:"client_key" json:"client_key"`
|
||||
ClientKeyValue string `json:"client_key_value"`
|
||||
BindDN string `toml:"bind_dn" json:"bind_dn"`
|
||||
BindPassword string `toml:"bind_password" json:"bind_password"`
|
||||
Timeout int `toml:"timeout" json:"timeout"`
|
||||
Attr AttributeMap `toml:"attributes" json:"attributes"`
|
||||
|
||||
SearchFilter string `toml:"search_filter" json:"search_filter,omitempty"`
|
||||
SearchBaseDNs []string `toml:"search_base_dns" json:"search_base_dns,omitempty"`
|
||||
SearchFilter string `toml:"search_filter" json:"search_filter"`
|
||||
SearchBaseDNs []string `toml:"search_base_dns" json:"search_base_dns"`
|
||||
|
||||
GroupSearchFilter string `toml:"group_search_filter" json:"group_search_filter,omitempty"`
|
||||
GroupSearchFilterUserAttribute string `toml:"group_search_filter_user_attribute" json:"group_search_filter_user_attribute,omitempty"`
|
||||
GroupSearchBaseDNs []string `toml:"group_search_base_dns" json:"group_search_base_dns,omitempty"`
|
||||
GroupSearchFilter string `toml:"group_search_filter" json:"group_search_filter"`
|
||||
GroupSearchFilterUserAttribute string `toml:"group_search_filter_user_attribute" json:"group_search_filter_user_attribute"`
|
||||
GroupSearchBaseDNs []string `toml:"group_search_base_dns" json:"group_search_base_dns"`
|
||||
|
||||
Groups []*GroupToOrgRole `toml:"group_mappings" json:"group_mappings,omitempty"`
|
||||
Groups []*GroupToOrgRole `toml:"group_mappings" json:"group_mappings"`
|
||||
}
|
||||
|
||||
// AttributeMap is a struct representation for LDAP "attributes" setting
|
||||
type AttributeMap struct {
|
||||
Username string `toml:"username" json:"username,omitempty"`
|
||||
Name string `toml:"name" json:"name,omitempty"`
|
||||
Surname string `toml:"surname" json:"surname,omitempty"`
|
||||
Email string `toml:"email" json:"email,omitempty"`
|
||||
MemberOf string `toml:"member_of" json:"member_of,omitempty"`
|
||||
Username string `toml:"username" json:"username"`
|
||||
Name string `toml:"name" json:"name"`
|
||||
Surname string `toml:"surname" json:"surname"`
|
||||
Email string `toml:"email" json:"email"`
|
||||
MemberOf string `toml:"member_of" json:"member_of"`
|
||||
}
|
||||
|
||||
// GroupToOrgRole is a struct representation of LDAP
|
||||
@@ -83,7 +83,7 @@ type GroupToOrgRole struct {
|
||||
// This pointer specifies if setting was set (for backwards compatibility)
|
||||
IsGrafanaAdmin *bool `toml:"grafana_admin" json:"grafana_admin,omitempty"`
|
||||
|
||||
OrgRole org.RoleType `toml:"org_role" json:"org_role,omitempty"`
|
||||
OrgRole org.RoleType `toml:"org_role" json:"org_role"`
|
||||
}
|
||||
|
||||
// logger for all LDAP stuff
|
||||
|
||||
@@ -59,7 +59,20 @@ var (
|
||||
"DC=ldap,DC=goauthentik,DC=io",
|
||||
},
|
||||
"search_filter": "(cn=%s)", "ssl_skip_verify": true,
|
||||
"timeout": int64(10),
|
||||
"timeout": int64(10),
|
||||
"client_cert": "",
|
||||
"client_cert_value": "",
|
||||
"client_key": "",
|
||||
"client_key_value": "",
|
||||
"group_search_base_dns": nil,
|
||||
"group_search_filter": "",
|
||||
"group_search_filter_user_attribute": "",
|
||||
"min_tls_version": "",
|
||||
"root_ca_cert": "",
|
||||
"root_ca_cert_value": nil,
|
||||
"start_tls": false,
|
||||
"use_ssl": false,
|
||||
"tls_ciphers": nil,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user