mirror of
https://github.com/gabehf/Koito.git
synced 2026-04-22 12:01:52 -07:00
Fix validateAPIKey logging error when Authorization header is absent
This commit is contained in:
parent
0ec7b458cc
commit
77b3efe379
1 changed files with 4 additions and 0 deletions
|
|
@ -133,6 +133,10 @@ func validateAPIKey(ctx context.Context, store db.DB, r *http.Request) (*models.
|
||||||
l.Debug().Msg("ValidateApiKey: Checking if user is already authenticated")
|
l.Debug().Msg("ValidateApiKey: Checking if user is already authenticated")
|
||||||
|
|
||||||
authH := r.Header.Get("Authorization")
|
authH := r.Header.Get("Authorization")
|
||||||
|
if authH == "" {
|
||||||
|
return nil, nil // no header present, not an error
|
||||||
|
}
|
||||||
|
|
||||||
var token string
|
var token string
|
||||||
if strings.HasPrefix(strings.ToLower(authH), "token ") {
|
if strings.HasPrefix(strings.ToLower(authH), "token ") {
|
||||||
token = strings.TrimSpace(authH[6:]) // strip "Token "
|
token = strings.TrimSpace(authH[6:]) // strip "Token "
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue