Scoped oauth

This commit is contained in:
Bel LaPointe
2019-11-02 08:03:54 -06:00
parent ba44094eb9
commit 08add4b521
7 changed files with 48 additions and 31 deletions

View File

@@ -1,16 +1,19 @@
package server
import (
"local/router"
"net/http"
)
func (s *Server) verify(w http.ResponseWriter, r *http.Request) {
scope := ""
router.Params(r, &scope)
if r.Method != "POST" {
http.NotFound(w, r)
return
}
access := r.FormValue("access")
token, ok := s.getToken(access)
token, ok := s.getToken(scope, access)
if !ok {
http.Error(w, "unknown access", http.StatusUnauthorized)
return