Cleanup some error strings

This commit is contained in:
Christoph Kluge 2023-08-18 11:17:31 +02:00
parent 14c487c9e4
commit 57bda63506
4 changed files with 7 additions and 7 deletions

View File

@ -65,7 +65,7 @@ the user database table:
``` ```
if e := bcrypt.CompareHashAndPassword([]byte(user.Password), []byte(r.FormValue("password"))); e != nil { if e := bcrypt.CompareHashAndPassword([]byte(user.Password), []byte(r.FormValue("password"))); e != nil {
log.Errorf("AUTH/LOCAL > Authentication for user %s failed!", user.Username) log.Errorf("AUTH/LOCAL > Authentication for user %s failed!", user.Username)
return nil, fmt.Errorf("AUTH/LOCAL > Authentication failed") return nil, fmt.Errorf("Authentication failed")
} }
``` ```
@ -79,8 +79,8 @@ return user != nil && user.AuthSource == AuthViaLDAP
Gets the LDAP connection and tries a bind with the provided credentials: Gets the LDAP connection and tries a bind with the provided credentials:
``` ```
if err := l.Bind(userDn, r.FormValue("password")); err != nil { if err := l.Bind(userDn, r.FormValue("password")); err != nil {
log.Errorf("AUTH/LOCAL > Authentication for user %s failed: %v", user.Username, err) log.Errorf("AUTH/LDAP > Authentication for user %s failed: %v", user.Username, err)
return nil, fmt.Errorf("AUTH/LDAP > Authentication failed") return nil, fmt.Errorf("Authentication failed")
} }
``` ```

View File

@ -66,7 +66,7 @@ func (ja *JWTSessionAuthenticator) Login(
if t.Method == jwt.SigningMethodHS256 || t.Method == jwt.SigningMethodHS512 { if t.Method == jwt.SigningMethodHS256 || t.Method == jwt.SigningMethodHS512 {
return ja.loginTokenKey, nil return ja.loginTokenKey, nil
} }
return nil, fmt.Errorf("AUTH/JWT > unkown signing method for login token: %s (known: HS256, HS512, EdDSA)", t.Method.Alg()) return nil, fmt.Errorf("unkown signing method for login token: %s (known: HS256, HS512, EdDSA)", t.Method.Alg())
}) })
if err != nil { if err != nil {
log.Warn("Error while parsing jwt token") log.Warn("Error while parsing jwt token")

View File

@ -140,9 +140,9 @@ func (la *LdapAuthenticator) Login(
userDn := strings.Replace(la.config.UserBind, "{username}", user.Username, -1) userDn := strings.Replace(la.config.UserBind, "{username}", user.Username, -1)
if err := l.Bind(userDn, r.FormValue("password")); err != nil { if err := l.Bind(userDn, r.FormValue("password")); err != nil {
log.Errorf("AUTH/LOCAL > Authentication for user %s failed: %v", log.Errorf("AUTH/LDAP > Authentication for user %s failed: %v",
user.Username, err) user.Username, err)
return nil, fmt.Errorf("AUTH/LDAP > Authentication failed") return nil, fmt.Errorf("Authentication failed")
} }
return user, nil return user, nil

View File

@ -42,7 +42,7 @@ func (la *LocalAuthenticator) Login(
if e := bcrypt.CompareHashAndPassword([]byte(user.Password), if e := bcrypt.CompareHashAndPassword([]byte(user.Password),
[]byte(r.FormValue("password"))); e != nil { []byte(r.FormValue("password"))); e != nil {
log.Errorf("AUTH/LOCAL > Authentication for user %s failed!", user.Username) log.Errorf("AUTH/LOCAL > Authentication for user %s failed!", user.Username)
return nil, fmt.Errorf("AUTH/LOCAL > Authentication failed") return nil, fmt.Errorf("Authentication failed")
} }
return user, nil return user, nil