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,41 @@
package server
import (
"fmt"
"net/http"
)
func (s *Server) Routes() error {
endpoints := []struct {
path string
handler http.HandlerFunc
}{
{
path: fmt.Sprintf("authorize"),
handler: s.authorize,
},
{
path: fmt.Sprintf("verify"),
handler: s.verify,
},
{
path: fmt.Sprintf("users/log"),
handler: s.usersLog,
},
{
path: fmt.Sprintf("users/register"),
handler: s.usersRegister,
},
{
path: fmt.Sprintf("users/submit"),
handler: s.usersSubmit,
},
}
for _, endpoint := range endpoints {
if err := s.Add(endpoint.path, endpoint.handler); err != nil {
return err
}
}
return nil
}