Wannabe oauth implementation
This commit is contained in:
19
oauth2server/server/verify.go
Normal file
19
oauth2server/server/verify.go
Normal 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))
|
||||
}
|
||||
Reference in New Issue
Block a user