diff --git a/go.mod b/go.mod index 6e850d3..88949bf 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ require ( github.com/gofiber/fiber/v2 v2.49.2 github.com/gofiber/template/html/v2 v2.0.5 github.com/joho/godotenv v1.5.1 - github.com/netresearch/simple-ldap-go v0.0.0-20231002103847-cb56d7d4e6c7 + github.com/netresearch/simple-ldap-go v0.0.0-20231006124956-e3f59e3a24f0 ) require ( diff --git a/go.sum b/go.sum index 8c486f2..d006840 100644 --- a/go.sum +++ b/go.sum @@ -50,6 +50,8 @@ github.com/netresearch/simple-ldap-go v0.0.0-20230915232254-3b11228f3129 h1:t0EB github.com/netresearch/simple-ldap-go v0.0.0-20230915232254-3b11228f3129/go.mod h1:T/Nbe0raXbCgzMWzsOfMX2sZC1FMGk2g3XpPG4OT6NY= github.com/netresearch/simple-ldap-go v0.0.0-20231002103847-cb56d7d4e6c7 h1:hN2eW111sh8hpPT4GwIXafbSqHtJfAnLGc+hZAQehnk= github.com/netresearch/simple-ldap-go v0.0.0-20231002103847-cb56d7d4e6c7/go.mod h1:v00qbwupQnx2Mk3oJoJylMWD54yJk6vHsbFj5RIOK5o= +github.com/netresearch/simple-ldap-go v0.0.0-20231006124956-e3f59e3a24f0 h1:yEglKp2covgW6SOFYV4ii7SS+Z7Ud8tSr6dHy5k/8/c= +github.com/netresearch/simple-ldap-go v0.0.0-20231006124956-e3f59e3a24f0/go.mod h1:v00qbwupQnx2Mk3oJoJylMWD54yJk6vHsbFj5RIOK5o= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= diff --git a/internal/options/app.go b/internal/options/app.go index a5469a7..5128c09 100644 --- a/internal/options/app.go +++ b/internal/options/app.go @@ -8,14 +8,13 @@ import ( "strconv" "github.com/joho/godotenv" + ldap "github.com/netresearch/simple-ldap-go" ) type Opts struct { - LdapServer string - IsActiveDirectory bool - BaseDN string - ReadonlyUser string - ReadonlyPassword string + LDAP ldap.Config + ReadonlyUser string + ReadonlyPassword string MinLength uint MinNumbers uint @@ -91,11 +90,13 @@ func Parse() *Opts { panicWhenEmpty("readonly-password", fReadonlyPassword) return &Opts{ - LdapServer: *fLdapServer, - IsActiveDirectory: *fIsActiveDirectory, - BaseDN: *fBaseDN, - ReadonlyUser: *fReadonlyUser, - ReadonlyPassword: *fReadonlyPassword, + LDAP: ldap.Config{ + Server: *fLdapServer, + BaseDN: *fBaseDN, + IsActiveDirectory: *fIsActiveDirectory, + }, + ReadonlyUser: *fReadonlyUser, + ReadonlyPassword: *fReadonlyPassword, MinLength: *fMinLength, MinNumbers: *fMinNumbers, diff --git a/internal/rpc/handler.go b/internal/rpc/handler.go index 4cc180b..501049b 100644 --- a/internal/rpc/handler.go +++ b/internal/rpc/handler.go @@ -16,7 +16,7 @@ type Handler struct { } func New(opts *options.Opts) (*Handler, error) { - ldap, err := ldap.New(opts.LdapServer, opts.BaseDN, opts.ReadonlyUser, opts.ReadonlyPassword, opts.IsActiveDirectory) + ldap, err := ldap.New(opts.LDAP, opts.ReadonlyUser, opts.ReadonlyPassword) if err != nil { return nil, err }