Skip to content
Snippets Groups Projects
Commit 21ddfb9b authored by ale's avatar ale
Browse files

Log authentication attempts

parent a65a2c1a
No related branches found
No related tags found
No related merge requests found
Pipeline #81779 canceled
......@@ -28,9 +28,13 @@ func authenticate(username, password string) bool {
func handleAuthenticate(w http.ResponseWriter, req *http.Request) {
status := http.StatusForbidden
username, password, ok := req.BasicAuth()
if ok && authenticate(username, password) {
status = http.StatusOK
if username, password, ok := req.BasicAuth(); ok {
if authenticate(username, password) {
status = http.StatusOK
log.Printf("auth(%s) -> ok", username)
} else {
log.Printf("auth(%s) -> ERROR", username)
}
}
w.WriteHeader(status)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment