Store auth info in a JWT token in a cookie

This commit is contained in:
Ken-Håvard Lieng 2016-01-15 02:27:30 +01:00
parent 3e0a1be6bc
commit fb54d4966c
18 changed files with 499 additions and 331 deletions

View file

@ -29,10 +29,16 @@ type File struct {
func serveFiles(w http.ResponseWriter, r *http.Request) {
if r.URL.Path == "/" {
handleAuth(w, r)
serveFile(w, r, "index.html.gz", "text/html")
return
}
if strings.HasSuffix(r.URL.Path, "favicon.ico") {
w.WriteHeader(404)
return
}
for _, file := range files {
if strings.HasSuffix(r.URL.Path, file.Path) {
serveFile(w, r, file.Path+".gz", file.ContentType)
@ -40,6 +46,7 @@ func serveFiles(w http.ResponseWriter, r *http.Request) {
}
}
handleAuth(w, r)
serveFile(w, r, "index.html.gz", "text/html")
}