aboutsummaryrefslogtreecommitdiff
path: root/internal/auth
diff options
context:
space:
mode:
authordeepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com>2022-03-06 16:33:55 +0800
committerGitHub <noreply@github.com>2022-03-06 16:33:55 +0800
commit5afca6ca8eaadebc613dce291da2bae1030ccca9 (patch)
tree46f86403c6abdeabd6172ee5243caa3bfe5a79a4 /internal/auth
parentdeec3516d53e9a9679128ade0556ccc818a67be1 (diff)
autofix: function call can be replaced with helper function (#6805)
Co-authored-by: deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com>
Diffstat (limited to 'internal/auth')
-rw-r--r--internal/auth/ldap/config.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/internal/auth/ldap/config.go b/internal/auth/ldap/config.go
index db666cde..79840ee4 100644
--- a/internal/auth/ldap/config.go
+++ b/internal/auth/ldap/config.go
@@ -72,7 +72,7 @@ func (c *Config) sanitizedUserQuery(username string) (string, bool) {
return "", false
}
- return strings.Replace(c.Filter, "%s", username, -1), true
+ return strings.ReplaceAll(c.Filter, "%s", username), true
}
func (c *Config) sanitizedUserDN(username string) (string, bool) {
@@ -83,7 +83,7 @@ func (c *Config) sanitizedUserDN(username string) (string, bool) {
return "", false
}
- return strings.Replace(c.UserDN, "%s", username, -1), true
+ return strings.ReplaceAll(c.UserDN, "%s", username), true
}
func (c *Config) sanitizedGroupFilter(group string) (string, bool) {
@@ -112,7 +112,7 @@ func (c *Config) findUserDN(l *ldap.Conn, name string) (string, bool) {
log.Trace("Search for LDAP user: %s", name)
if len(c.BindDN) > 0 && len(c.BindPassword) > 0 {
// Replace placeholders with username
- bindDN := strings.Replace(c.BindDN, "%s", name, -1)
+ bindDN := strings.ReplaceAll(c.BindDN, "%s", name)
err := l.Bind(bindDN, c.BindPassword)
if err != nil {
log.Trace("LDAP: Failed to bind as BindDN '%s': %v", bindDN, err)