Wannabe oauth implementation

This commit is contained in:
bel
2019-10-20 12:59:50 -06:00
commit 6dc2e074fb
11 changed files with 548 additions and 0 deletions

View File

@@ -0,0 +1,19 @@
package server
import (
"net/http"
)
func (s *Server) verify(w http.ResponseWriter, r *http.Request) {
if r.Method != "POST" {
http.NotFound(w, r)
return
}
access := r.FormValue("access")
token, ok := s.getToken(access)
if !ok {
http.Error(w, "unknown access", http.StatusUnauthorized)
return
}
w.Write([]byte(token))
}