@@ -16,16 +16,24 @@ import (
1616// TYPES
1717
1818type Config struct {
19- Url * url.URL `env:"LDAP_URL" help:"LDAP connection URL"` // Connection URL
20- User string `env:"LDAP_USER" help:"User"` // User
21- Password string `env:"LDAP_PASSWORD" help:"Password"` // Password
22- BaseDN string `env:"LDAP_BASE_DN" help:"Base DN"` // Base DN
23- SkipVerify bool `env:"LDAP_SKIPVERIFY" help:"Skip TLS certificate verify"` // Skip verify
24- Router server.HTTPRouter `kong:"-"` // HTTP Router
19+ Url * url.URL `env:"LDAP_URL" help:"LDAP connection URL"` // Connection URL
20+ User string `env:"LDAP_USER" help:"User"` // User
21+ Password string `env:"LDAP_PASSWORD" help:"Password"` // Password
22+ BaseDN string `env:"LDAP_BASE_DN" help:"Base DN"` // Base DN
23+ SkipVerify bool `env:"LDAP_SKIPVERIFY" help:"Skip TLS certificate verify"` // Skip verify
24+
25+ Router server.HTTPRouter `kong:"-"` // HTTP Router
26+
2527 UserSchema struct {
26- RDN string `default:"cn=users,cn=account" help:"User root DN "`
28+ RDN string `default:"cn=users,cn=account" help:"User RDN "`
2729 Field string `default:"uid" help:"User field"`
28- ObjectClasses string `default:"top,inetOrgPerson,posixAccount" help:"User object classes"`
30+ ObjectClasses string `default:"top,person,inetOrgPerson,posixAccount" help:"User object classes"`
31+ }
32+
33+ GroupSchema struct {
34+ RDN string `default:"cn=groups,cn=account" help:"Group RDN"`
35+ Field string `default:"cn" help:"Group field"`
36+ ObjectClasses string `default:"top,groupOfNames,nestedGroup,posixGroup" help:"Group object classes"`
2937 }
3038}
3139
@@ -51,8 +59,10 @@ func (c Config) New(ctx context.Context) (server.Task, error) {
5159 opts = append (opts , ldap .WithSkipVerify ())
5260 }
5361 if c .UserSchema .RDN != "" {
54- classes := strings .Split (c .UserSchema .ObjectClasses , "," )
55- opts = append (opts , ldap .WithUserSchema (c .UserSchema .RDN , c .UserSchema .Field , classes ... ))
62+ opts = append (opts , ldap .WithUserSchema (c .UserSchema .RDN , c .UserSchema .Field , strings .Split (c .UserSchema .ObjectClasses , "," )... ))
63+ }
64+ if c .GroupSchema .RDN != "" {
65+ opts = append (opts , ldap .WithGroupSchema (c .GroupSchema .RDN , c .GroupSchema .Field , strings .Split (c .GroupSchema .ObjectClasses , "," )... ))
5666 }
5767
5868 // Create a new LDAP manager
0 commit comments