From 4c986119f970d98cb22e67df9d172ec668e2582e Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Sat, 22 Jun 2019 01:28:02 -0600 Subject: [PATCH] WIP: progress --- cmd/again/again.go | 8 ++++++++ public/index.html | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+) diff --git a/cmd/again/again.go b/cmd/again/again.go index 7dbc440..afd9cb3 100644 --- a/cmd/again/again.go +++ b/cmd/again/again.go @@ -8,6 +8,7 @@ import ( "net/http" "os" "strconv" + "strings" "time" again "git.rootprojects.org/root/go-again" @@ -92,6 +93,13 @@ type scheduler struct { } func (s *scheduler) Handle(w http.ResponseWriter, r *http.Request) { + defer r.Body.Close() + token := strings.TrimPrefix(r.Header.Get("Authorization"), "Bearer ") + if "" == token { + http.Error(w, "Authorization Header did not contain a valid token", http.StatusForbidden) + return + } + fmt.Println("whatever", r.Method, r.URL) switch r.Method { case http.MethodGet: diff --git a/public/index.html b/public/index.html index 937f34d..600e744 100644 --- a/public/index.html +++ b/public/index.html @@ -5,5 +5,40 @@

Hello, World!

+
+ + +
+
 
+