diff --git a/go.mod b/go.mod index 0ce44eb..08437b8 100644 --- a/go.mod +++ b/go.mod @@ -2,7 +2,4 @@ module github.com/chrisDeFouRire/subauth go 1.21.3 -require ( - github.com/go-chi/chi/v5 v5.0.10 - github.com/golang-jwt/jwt/v5 v5.2.0 -) +require github.com/golang-jwt/jwt/v5 v5.2.0 diff --git a/go.sum b/go.sum index 436da69..f03692b 100644 --- a/go.sum +++ b/go.sum @@ -1,4 +1,2 @@ -github.com/go-chi/chi/v5 v5.0.10 h1:rLz5avzKpjqxrYwXNfmjkrYYXOyLJd37pz53UFHC6vk= -github.com/go-chi/chi/v5 v5.0.10/go.mod h1:DslCQbL2OYiznFReuXYUmQ2hGd1aDpCnlMNITLSKoi8= github.com/golang-jwt/jwt/v5 v5.2.0 h1:d/ix8ftRUorsN+5eMIlF4T6J8CAt9rch3My2winC1Jw= github.com/golang-jwt/jwt/v5 v5.2.0/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk= diff --git a/main.go b/main.go index 8be13b7..eef35cd 100644 --- a/main.go +++ b/main.go @@ -9,7 +9,6 @@ import ( "os" "strings" - "github.com/go-chi/chi/v5" "github.com/golang-jwt/jwt/v5" ) @@ -72,9 +71,9 @@ func init() { } func main() { - r := chi.NewRouter() - r.Get("/", func(w http.ResponseWriter, r *http.Request) { + // no matter what the Method or URL is, we always check the Authorization header + http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { authorization := r.Header.Get("Authorization") token, err := parseBearerToken(authorization) if err != nil { @@ -94,9 +93,9 @@ func main() { w.WriteHeader(http.StatusNoContent) }) - err := http.ListenAndServe(":8080", r) + log.Println("Server started") + err := http.ListenAndServe(":8080", nil) if err != nil { panic(err) } - log.Println("Server started") }