Commit 774a911

mo khan <mo@mokhan.ca>
2022-04-29 03:55:38
refactor: use full path instead of stripping prefix
1 parent a2f4c01
Changed files (1)
pkg/web/http_context.go
@@ -23,7 +23,7 @@ func (h *HttpContext) Router() *http.ServeMux {
 	mux := http.NewServeMux()
 
 	mux.Handle("/", http.HandlerFunc(h.Default))
-	mux.Handle("/.well-known/", http.StripPrefix("/.well-known", wellKnownMux(h)))
+	mux.Handle("/.well-known/", h.wellKnownMux())
 	mux.Handle("/authorize", http.HandlerFunc(h.Authorize))
 	mux.Handle("/revoke", http.HandlerFunc(http.NotFound))
 	mux.Handle("/token", http.HandlerFunc(h.Token))
@@ -31,9 +31,9 @@ func (h *HttpContext) Router() *http.ServeMux {
 	return mux
 }
 
-func wellKnownMux(h *HttpContext) *http.ServeMux {
+func (h *HttpContext) wellKnownMux() *http.ServeMux {
 	mux := http.NewServeMux()
-	mux.Handle("/jwks.json", http.HandlerFunc(h.JsonWebKeySets))
-	mux.Handle("/openid-configuration", http.HandlerFunc(h.OpenIdConfiguration))
+	mux.Handle("/.well-known/jwks.json", http.HandlerFunc(h.JsonWebKeySets))
+	mux.Handle("/.well-known/openid-configuration", http.HandlerFunc(h.OpenIdConfiguration))
 	return mux
 }