Skip to content
Snippets Groups Projects
Verified Commit 0a111a3b authored by blallo's avatar blallo
Browse files

Add body message

parent d43a591d
No related branches found
No related tags found
No related merge requests found
File added
......@@ -15,6 +15,7 @@ var (
port = flag.Int("port", 4041, "A port to bind to on the specified addresses")
service = flag.String("service", "xmpp", "Service to use for authentication")
prefix = flag.String("prefix", "", "Name to use in logs")
okMsg = flag.String("ok-msg", "", "A string to return in case of successful auth")
)
func main() {
......@@ -62,6 +63,10 @@ func authHandlerFunc(w http.ResponseWriter, r *http.Request) {
switch resp.Status {
case auth.StatusOK:
w.WriteHeader(http.StatusOK)
if *okMsg != "" {
w.Header().Set("Content-Type", "application/text")
w.Write([]byte(*okMsg))
}
return
case auth.StatusInsufficientCredentials:
http.Error(w, "not allowed", http.StatusForbidden)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment