Skip to content

Commit

Permalink
feat(ldap): add option to load ldap from file
Browse files Browse the repository at this point in the history
Signed-off-by: Laurentiu Niculae <[email protected]>
  • Loading branch information
laurentiuNiculae committed Nov 3, 2023
1 parent 9074f84 commit 2243506
Show file tree
Hide file tree
Showing 6 changed files with 747 additions and 11 deletions.
3 changes: 2 additions & 1 deletion pkg/api/authn.go
Original file line number Diff line number Diff line change
Expand Up @@ -261,14 +261,15 @@ func (amw *AuthnMiddleware) tryAuthnHandlers(ctlr *Controller) mux.MiddlewareFun
if ctlr.Config.IsLdapAuthEnabled() {
ldapConfig := ctlr.Config.HTTP.Auth.LDAP
amw.ldapClient = &LDAPClient{
Unauthenticated: ldapConfig.Unauthenticated,
Host: ldapConfig.Address,
Port: ldapConfig.Port,
UseSSL: !ldapConfig.Insecure,
SkipTLS: !ldapConfig.StartTLS,
Base: ldapConfig.BaseDN,
BindDN: ldapConfig.BindDN,
UserGroupAttribute: ldapConfig.UserGroupAttribute, // from config
BindPassword: ldapConfig.BindPassword,
UserGroupAttribute: ldapConfig.UserGroupAttribute, // from config
UserFilter: fmt.Sprintf("(%s=%%s)", ldapConfig.UserAttribute),
InsecureSkipVerify: ldapConfig.SkipVerify,
ServerName: ldapConfig.Address,
Expand Down
11 changes: 9 additions & 2 deletions pkg/api/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,16 +121,23 @@ type SchedulerConfig struct {
NumWorkers int
}

type LDAPCredentials struct {
BindDN string
BindPassword string
}

type LDAPConfig struct {
CredentialsFile string
Unauthenticated bool
Port int
Insecure bool
StartTLS bool // if !Insecure, then StartTLS or LDAPs
SkipVerify bool
SubtreeSearch bool
Address string
BindDN string
BindDN string `json:"-"`
BindPassword string `json:"-"`
UserGroupAttribute string
BindPassword string
BaseDN string
UserAttribute string
CACert string
Expand Down
Loading

0 comments on commit 2243506

Please sign in to comment.