gateway: move login/oauth endpoints under /api

In this way, when bundling the web interface inside the agola binaries, oauth2
redirect to the web interfaces will be served by the webbundle handler and
return the web SPA and not resolve directly the /oauth2/callback api call.
This commit is contained in:
Simone Gotti 2019-05-16 10:05:21 +02:00
parent b22c197fef
commit 30f398e361
1 changed files with 4 additions and 4 deletions

View File

@ -292,10 +292,10 @@ func (g *Gateway) Run(ctx context.Context) error {
// TODO(sgotti) add auth to these requests // TODO(sgotti) add auth to these requests
router.Handle("/repos/{rest:.*}", reposHandler).Methods("GET", "POST") router.Handle("/repos/{rest:.*}", reposHandler).Methods("GET", "POST")
router.Handle("/login", loginUserHandler).Methods("POST") router.Handle("/api/login", loginUserHandler).Methods("POST")
router.Handle("/authorize", authorizeHandler).Methods("POST") router.Handle("/api/authorize", authorizeHandler).Methods("POST")
router.Handle("/register", registerHandler).Methods("POST") router.Handle("/api/register", registerHandler).Methods("POST")
router.Handle("/oauth2/callback", oauth2callbackHandler).Methods("GET") router.Handle("/api/oauth2/callback", oauth2callbackHandler).Methods("GET")
router.Handle("/webhooks", webhooksHandler).Methods("POST") router.Handle("/webhooks", webhooksHandler).Methods("POST")
router.PathPrefix("/").HandlerFunc(handlers.NewWebBundleHandlerFunc(g.c.APIExposedURL)) router.PathPrefix("/").HandlerFunc(handlers.NewWebBundleHandlerFunc(g.c.APIExposedURL))