Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

do not log traefik_api_key_auth when found #9

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,15 +130,14 @@ func bearer(key string, validKeys []string) string {
}

func (ka *KeyAuth) ok(rw http.ResponseWriter, req *http.Request, key string) {
os.Stdout.WriteString(fmt.Sprintf("INFO: traefik_api_key_auth KEY %s URL %s\n", key, req.URL))
os.Stdout.WriteString(fmt.Sprintf("INFO: traefik_api_key_auth found for URL %s\n", req.URL))
if ka.internalForwardHeaderName != "" {
req.Header.Add(ka.internalForwardHeaderName, key)
}
req.RequestURI = req.URL.RequestURI()
ka.next.ServeHTTP(rw, req)
}


func (ka *KeyAuth) permissiveOk(rw http.ResponseWriter, req *http.Request) {
// If permissiveMode is enabled, log a warning and return OK as if the correct authentication was provided.
os.Stderr.WriteString(fmt.Sprintf("WARN: traefik_api_key_auth: No valid credentials found for URL \"%s\". Allowing request in permissive mode\n", req.URL))
Expand Down Expand Up @@ -199,7 +198,7 @@ func (ka *KeyAuth) ServeHTTP(rw http.ResponseWriter, req *http.Request) {
ka.permissiveOk(rw, req)
return
}

if ka.internalErrorRoute != "" {
req.URL.Path = ka.internalErrorRoute
req.URL.RawQuery = ""
Expand Down