oauth2/oauth2server/server/verify.go

23 lines
427 B
Go
Executable File

package server
import (
"gitea.inhome.blapointe.com/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(scope, access)
if !ok {
http.Error(w, "unknown access", http.StatusUnauthorized)
return
}
w.Write([]byte(token))
}