diff options
author | zeripath <art27@cantab.net> | 2021-11-03 00:33:54 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-03 08:33:54 +0800 |
commit | 9d855bd6a1da51a656bede3a855b2cecc6a22f28 (patch) | |
tree | ac34d3039edafd1c8d7814e3ede09f1e22372073 /cmd | |
parent | 95da01c5cd946d6e6ba0b0110676d3df36ce85db (diff) | |
download | gitea-9d855bd6a1da51a656bede3a855b2cecc6a22f28.tar.gz gitea-9d855bd6a1da51a656bede3a855b2cecc6a22f28.zip |
Simplify Gothic to use our session store instead of creating a different store (#17507)
* Simplify Gothic to use our session store instead of creating a different store
We have been using xormstore to provide a separate session store for our OAuth2 logins
however, this relies on using gorilla context and some doubling of our session storing.
We can however, simplify and simply use our own chi-based session store. Thus removing
a cookie and some of the weirdness with missing contexts.
Signed-off-by: Andrew Thornton <art27@cantab.net>
* as per review
Signed-off-by: Andrew Thornton <art27@cantab.net>
* as per review
Signed-off-by: Andrew Thornton <art27@cantab.net>
* Handle MaxTokenLength
Signed-off-by: Andrew Thornton <art27@cantab.net>
* oops
Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
Co-authored-by: Lauris BH <lauris@nix.lv>
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/web.go | 15 | ||||
-rw-r--r-- | cmd/web_letsencrypt.go | 3 |
2 files changed, 8 insertions, 10 deletions
diff --git a/cmd/web.go b/cmd/web.go index 8d9387e06f..80516058fb 100644 --- a/cmd/web.go +++ b/cmd/web.go @@ -19,7 +19,6 @@ import ( "code.gitea.io/gitea/routers" "code.gitea.io/gitea/routers/install" - context2 "github.com/gorilla/context" "github.com/urfave/cli" ini "gopkg.in/ini.v1" ) @@ -71,7 +70,7 @@ func runHTTPRedirector() { http.Redirect(w, r, target, http.StatusTemporaryRedirect) }) - var err = runHTTP("tcp", source, "HTTP Redirector", context2.ClearHandler(handler)) + var err = runHTTP("tcp", source, "HTTP Redirector", handler) if err != nil { log.Fatal("Failed to start port redirection: %v", err) @@ -209,10 +208,10 @@ func listen(m http.Handler, handleRedirector bool) error { if handleRedirector { NoHTTPRedirector() } - err = runHTTP("tcp", listenAddr, "Web", context2.ClearHandler(m)) + err = runHTTP("tcp", listenAddr, "Web", m) case setting.HTTPS: if setting.EnableLetsEncrypt { - err = runLetsEncrypt(listenAddr, setting.Domain, setting.LetsEncryptDirectory, setting.LetsEncryptEmail, context2.ClearHandler(m)) + err = runLetsEncrypt(listenAddr, setting.Domain, setting.LetsEncryptDirectory, setting.LetsEncryptEmail, m) break } if handleRedirector { @@ -222,22 +221,22 @@ func listen(m http.Handler, handleRedirector bool) error { NoHTTPRedirector() } } - err = runHTTPS("tcp", listenAddr, "Web", setting.CertFile, setting.KeyFile, context2.ClearHandler(m)) + err = runHTTPS("tcp", listenAddr, "Web", setting.CertFile, setting.KeyFile, m) case setting.FCGI: if handleRedirector { NoHTTPRedirector() } - err = runFCGI("tcp", listenAddr, "FCGI Web", context2.ClearHandler(m)) + err = runFCGI("tcp", listenAddr, "FCGI Web", m) case setting.UnixSocket: if handleRedirector { NoHTTPRedirector() } - err = runHTTP("unix", listenAddr, "Web", context2.ClearHandler(m)) + err = runHTTP("unix", listenAddr, "Web", m) case setting.FCGIUnix: if handleRedirector { NoHTTPRedirector() } - err = runFCGI("unix", listenAddr, "Web", context2.ClearHandler(m)) + err = runFCGI("unix", listenAddr, "Web", m) default: log.Fatal("Invalid protocol: %s", setting.Protocol) } diff --git a/cmd/web_letsencrypt.go b/cmd/web_letsencrypt.go index a683999790..096db36b24 100644 --- a/cmd/web_letsencrypt.go +++ b/cmd/web_letsencrypt.go @@ -13,7 +13,6 @@ import ( "code.gitea.io/gitea/modules/setting" "github.com/caddyserver/certmagic" - context2 "github.com/gorilla/context" ) func runLetsEncrypt(listenAddr, domain, directory, email string, m http.Handler) error { @@ -67,7 +66,7 @@ func runLetsEncrypt(listenAddr, domain, directory, email string, m http.Handler) }() } - return runHTTPSWithTLSConfig("tcp", listenAddr, "Web", tlsConfig, context2.ClearHandler(m)) + return runHTTPSWithTLSConfig("tcp", listenAddr, "Web", tlsConfig, m) } func runLetsEncryptFallbackHandler(w http.ResponseWriter, r *http.Request) { |