fix (ldap): support only updating the bind-dn and/or bind-password (#3511)

* fix (ldap): support only updating the bind-dn and/or bind-password

* chore: changelog entry for PR #3511
This commit is contained in:
Jim authored and GitHub committed 2023-07-27 15:41:37 -04:00
1 parent da7e8f7c1c
commit f8ea8c9744
9 files changed
+211 -41

No files matched your search

@@ -494,6 +494,62 @@ func TestRepository_UpdateAuthMethod(t *testing.T) {
return am
},
},
{
name: "update-just-binddn",
ctx: testCtx,
repo: testRepo,
setup: func() *AuthMethod {
return TestAuthMethod(t,
testConn, databaseWrapper,
org.PublicId,
[]string{"ldaps://ldap1", "ldap://ldap2"},
WithBindCredential(testCtx, "orig-bind-dn", "orig-bind-password"),
)
},
updateWith: func(orig *AuthMethod) *AuthMethod {
am := AllocAuthMethod()
am.PublicId = orig.PublicId
am.BindDn = "bind-dn"
return &am
},
fieldMasks: []string{
BindDnField,
},
version: 1,
want: func(orig, updateWith *AuthMethod) *AuthMethod {
am := orig.clone()
am.BindDn = updateWith.BindDn
return am
},
},
{
name: "update-just-bind-password",
ctx: testCtx,
repo: testRepo,
setup: func() *AuthMethod {
return TestAuthMethod(t,
testConn, databaseWrapper,
org.PublicId,
[]string{"ldaps://ldap1", "ldap://ldap2"},
WithBindCredential(testCtx, "orig-bind-dn", "orig-bind-password"),
)
},
updateWith: func(orig *AuthMethod) *AuthMethod {
am := AllocAuthMethod()
am.PublicId = orig.PublicId
am.BindPassword = "bind-password"
return &am
},
fieldMasks: []string{
BindPasswordField,
},
version: 1,
want: func(orig, updateWith *AuthMethod) *AuthMethod {
am := orig.clone()
am.BindPassword = updateWith.BindPassword
return am
},
},
{
name: "missing-auth-method",
ctx: testCtx,