feat: disable authorization for /token + provide access to repo + register jwks endpoint

This commit is contained in:
2025-05-25 14:13:05 +02:00
parent 34c1ce7652
commit 0ab82e2503

View File

@ -38,10 +38,10 @@ func (s *APIServer) Run() error {
// staticDir := http.Dir(filepath.Join(workDir, "static"))
// FileServer(router, "/static", staticDir)
oauthHandler := oauth.NewOAuthHandler()
oauthHandler := oauth.NewOAuthHandler(s.repo)
router.Route("/api/v1", func(r chi.Router) {
r.Use(imiddleware.WithSkipper(imiddleware.AuthMiddleware, "/api/v1/login", "/api/v1/register", "/api/v1/oauth"))
r.Use(imiddleware.WithSkipper(imiddleware.AuthMiddleware, "/api/v1/login", "/api/v1/register", "/api/v1/oauth/token"))
userHandler := user.NewUserHandler(s.repo, s.storage)
userHandler.RegisterRoutes(r)
@ -52,7 +52,8 @@ func (s *APIServer) Run() error {
oauthHandler.RegisterRoutes(r)
})
router.Get("/.well-known/openid-configuration", oauthHandler.Metadata)
router.Get("/.well-known/jwks.json", auth.WriteJWKS)
router.Get("/.well-known/openid-configuration", auth.OpenIdConfiguration)
router.Get("/*", func(w http.ResponseWriter, r *http.Request) {
path := "./dist" + r.URL.Path