aboutsummaryrefslogtreecommitdiff
path: root/internal/auth
diff options
context:
space:
mode:
authorJoe Chen <jc@unknwon.io>2023-02-02 21:25:25 +0800
committerGitHub <noreply@github.com>2023-02-02 21:25:25 +0800
commitc53a1998c589a544b25d53f6e6fdf0f24a4df25b (patch)
tree1c3c9d693ba551eecfbc535be942e40b5acf9cf7 /internal/auth
parent614382fec0ba05149785539ab93560d4d42c194d (diff)
all: replace `interface{}` with `any` (#7330)
Co-authored-by: deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com>
Diffstat (limited to 'internal/auth')
-rw-r--r--internal/auth/auth.go2
-rw-r--r--internal/auth/github/provider.go4
-rw-r--r--internal/auth/ldap/provider.go4
-rw-r--r--internal/auth/pam/provider.go4
-rw-r--r--internal/auth/smtp/provider.go8
5 files changed, 11 insertions, 11 deletions
diff --git a/internal/auth/auth.go b/internal/auth/auth.go
index c1fef5fc..085da275 100644
--- a/internal/auth/auth.go
+++ b/internal/auth/auth.go
@@ -84,7 +84,7 @@ type Provider interface {
Authenticate(login, password string) (*ExternalAccount, error)
// Config returns the underlying configuration of the authenticate provider.
- Config() interface{}
+ Config() any
// HasTLS returns true if the authenticate provider supports TLS.
HasTLS() bool
// UseTLS returns true if the authenticate provider is configured to use TLS.
diff --git a/internal/auth/github/provider.go b/internal/auth/github/provider.go
index eab9aa58..4d15c6a4 100644
--- a/internal/auth/github/provider.go
+++ b/internal/auth/github/provider.go
@@ -26,7 +26,7 @@ func (p *Provider) Authenticate(login, password string) (*auth.ExternalAccount,
fullname, email, website, location, err := p.config.doAuth(login, password)
if err != nil {
if strings.Contains(err.Error(), "401") {
- return nil, auth.ErrBadCredentials{Args: map[string]interface{}{"login": login}}
+ return nil, auth.ErrBadCredentials{Args: map[string]any{"login": login}}
}
return nil, err
}
@@ -40,7 +40,7 @@ func (p *Provider) Authenticate(login, password string) (*auth.ExternalAccount,
}, nil
}
-func (p *Provider) Config() interface{} {
+func (p *Provider) Config() any {
return p.config
}
diff --git a/internal/auth/ldap/provider.go b/internal/auth/ldap/provider.go
index 9cceed47..c7077d8e 100644
--- a/internal/auth/ldap/provider.go
+++ b/internal/auth/ldap/provider.go
@@ -29,7 +29,7 @@ func NewProvider(directBind bool, cfg *Config) auth.Provider {
func (p *Provider) Authenticate(login, password string) (*auth.ExternalAccount, error) {
username, fn, sn, email, isAdmin, succeed := p.config.searchEntry(login, password, p.directBind)
if !succeed {
- return nil, auth.ErrBadCredentials{Args: map[string]interface{}{"login": login}}
+ return nil, auth.ErrBadCredentials{Args: map[string]any{"login": login}}
}
if username == "" {
@@ -61,7 +61,7 @@ func (p *Provider) Authenticate(login, password string) (*auth.ExternalAccount,
}, nil
}
-func (p *Provider) Config() interface{} {
+func (p *Provider) Config() any {
return p.config
}
diff --git a/internal/auth/pam/provider.go b/internal/auth/pam/provider.go
index 4cf0d69b..fc1ff6bb 100644
--- a/internal/auth/pam/provider.go
+++ b/internal/auth/pam/provider.go
@@ -26,7 +26,7 @@ func (p *Provider) Authenticate(login, password string) (*auth.ExternalAccount,
err := p.config.doAuth(login, password)
if err != nil {
if strings.Contains(err.Error(), "Authentication failure") {
- return nil, auth.ErrBadCredentials{Args: map[string]interface{}{"login": login}}
+ return nil, auth.ErrBadCredentials{Args: map[string]any{"login": login}}
}
return nil, err
}
@@ -37,7 +37,7 @@ func (p *Provider) Authenticate(login, password string) (*auth.ExternalAccount,
}, nil
}
-func (p *Provider) Config() interface{} {
+func (p *Provider) Config() any {
return p.config
}
diff --git a/internal/auth/smtp/provider.go b/internal/auth/smtp/provider.go
index 719d1067..cbb91cf5 100644
--- a/internal/auth/smtp/provider.go
+++ b/internal/auth/smtp/provider.go
@@ -34,7 +34,7 @@ func (p *Provider) Authenticate(login, password string) (*auth.ExternalAccount,
if p.config.AllowedDomains != "" {
fields := strings.SplitN(login, "@", 3)
if len(fields) != 2 {
- return nil, auth.ErrBadCredentials{Args: map[string]interface{}{"login": login}}
+ return nil, auth.ErrBadCredentials{Args: map[string]any{"login": login}}
}
domain := fields[1]
@@ -47,7 +47,7 @@ func (p *Provider) Authenticate(login, password string) (*auth.ExternalAccount,
}
if !isAllowed {
- return nil, auth.ErrBadCredentials{Args: map[string]interface{}{"login": login}}
+ return nil, auth.ErrBadCredentials{Args: map[string]any{"login": login}}
}
}
@@ -68,7 +68,7 @@ func (p *Provider) Authenticate(login, password string) (*auth.ExternalAccount,
tperr, ok := err.(*textproto.Error)
if (ok && tperr.Code == 535) ||
strings.Contains(err.Error(), "Username and Password not accepted") {
- return nil, auth.ErrBadCredentials{Args: map[string]interface{}{"login": login}}
+ return nil, auth.ErrBadCredentials{Args: map[string]any{"login": login}}
}
return nil, err
}
@@ -88,7 +88,7 @@ func (p *Provider) Authenticate(login, password string) (*auth.ExternalAccount,
}, nil
}
-func (p *Provider) Config() interface{} {
+func (p *Provider) Config() any {
return p.config
}