Skip to content

Commit 4bd4705

Browse files
Merge pull request #197 from stlaz/basic_auth_spam
Bug 1879878: remove logging when authz header is present but basic auth is not attempted
2 parents 5e650c4 + 4b56a3a commit 4bd4705

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

oauthproxy.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -830,6 +830,11 @@ func (p *OAuthProxy) Authenticate(rw http.ResponseWriter, req *http.Request) int
830830
return http.StatusAccepted
831831
}
832832

833+
// CheckBasicAuth attempts to grab HTTP basic-auth credentials from the Authorization header
834+
//
835+
// returns a SessionState object if the user is a valid user from the provided HTPasswd
836+
// file otherwise it returns nil, and an error if there were issues with the Authorization
837+
// header
833838
func (p *OAuthProxy) CheckBasicAuth(req *http.Request) (*providers.SessionState, error) {
834839
if p.HtpasswdFile == nil {
835840
return nil, nil
@@ -840,7 +845,7 @@ func (p *OAuthProxy) CheckBasicAuth(req *http.Request) (*providers.SessionState,
840845
}
841846
s := strings.SplitN(auth, " ", 2)
842847
if len(s) != 2 || s[0] != "Basic" {
843-
return nil, fmt.Errorf("Authorization header does not start with 'Basic', skipping basic authentication")
848+
return nil, nil
844849
}
845850
b, err := b64.StdEncoding.DecodeString(s[1])
846851
if err != nil {

0 commit comments

Comments
 (0)