mozilla-services / iprepd

Centralized IP reputation daemon

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Document authentication mechanisms

diox opened this issue · comments

Per

iprepd/auth.go

Lines 17 to 34 in cf2290d

func auth(rf func(http.ResponseWriter, *http.Request)) func(http.ResponseWriter, *http.Request) {
return func(w http.ResponseWriter, r *http.Request) {
if !sruntime.cfg.Auth.DisableAuth {
hdr := r.Header.Get("Authorization")
v := false
if strings.HasPrefix(hdr, "Hawk ") {
v = hawkAuth(r)
} else if strings.HasPrefix(hdr, "APIKey ") {
v = apiAuth(r)
}
if !v {
w.WriteHeader(http.StatusUnauthorized)
return
}
}
rf(w, r)
}
}
iprepd uses Authentication header with either hawk or token auth using Hawk or APIKey prefixes. This should be documented in the README.