23 lines
400 B
Go
Executable File
23 lines
400 B
Go
Executable File
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(scope, access)
|
|
if !ok {
|
|
http.Error(w, "unknown access", http.StatusUnauthorized)
|
|
return
|
|
}
|
|
w.Write([]byte(token))
|
|
}
|