summaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
Diffstat (limited to 'main.go')
-rw-r--r--main.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/main.go b/main.go
index f79a111..56445a9 100644
--- a/main.go
+++ b/main.go
@@ -57,6 +57,12 @@ func (handler BoxHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusForbidden)
return
}
+ token := r.Header.Get("X-Token")
+ if token != handler.token {
+ log.Println("unauthorized")
+ w.WriteHeader(http.StatusUnauthorized)
+ return
+ }
resourceId := path.Base(r.URL.Path)
filename := filepath.Join(handler.filesPath, resourceId)
err := os.Remove(filename)