diff options
Diffstat (limited to 'modules/auth')
-rw-r--r-- | modules/auth/sso/interface.go | 4 | ||||
-rw-r--r-- | modules/auth/sso/oauth2.go | 4 | ||||
-rw-r--r-- | modules/auth/sso/sso.go | 8 | ||||
-rw-r--r-- | modules/auth/sso/sspi_windows.go | 8 |
4 files changed, 12 insertions, 12 deletions
diff --git a/modules/auth/sso/interface.go b/modules/auth/sso/interface.go index 7efe79a69c..9b1472f2b3 100644 --- a/modules/auth/sso/interface.go +++ b/modules/auth/sso/interface.go @@ -8,12 +8,12 @@ import ( "net/http" "code.gitea.io/gitea/models" - "code.gitea.io/gitea/modules/middlewares" "code.gitea.io/gitea/modules/session" + "code.gitea.io/gitea/modules/web/middleware" ) // DataStore represents a data store -type DataStore middlewares.DataStore +type DataStore middleware.DataStore // SessionStore represents a session store type SessionStore session.Store diff --git a/modules/auth/sso/oauth2.go b/modules/auth/sso/oauth2.go index b6f59dc924..fcd6845b38 100644 --- a/modules/auth/sso/oauth2.go +++ b/modules/auth/sso/oauth2.go @@ -12,8 +12,8 @@ import ( "code.gitea.io/gitea/models" "code.gitea.io/gitea/modules/log" - "code.gitea.io/gitea/modules/middlewares" "code.gitea.io/gitea/modules/timeutil" + "code.gitea.io/gitea/modules/web/middleware" ) // Ensure the struct implements the interface. @@ -122,7 +122,7 @@ func (o *OAuth2) VerifyAuthData(req *http.Request, w http.ResponseWriter, store return nil } - if middlewares.IsInternalPath(req) || !middlewares.IsAPIPath(req) && !isAttachmentDownload(req) { + if middleware.IsInternalPath(req) || !middleware.IsAPIPath(req) && !isAttachmentDownload(req) { return nil } diff --git a/modules/auth/sso/sso.go b/modules/auth/sso/sso.go index f3788e4c9d..437bf3af7a 100644 --- a/modules/auth/sso/sso.go +++ b/modules/auth/sso/sso.go @@ -13,8 +13,8 @@ import ( "code.gitea.io/gitea/models" "code.gitea.io/gitea/modules/log" - "code.gitea.io/gitea/modules/middlewares" "code.gitea.io/gitea/modules/setting" + "code.gitea.io/gitea/modules/web/middleware" ) // ssoMethods contains the list of SSO authentication plugins in the order they are expected to be @@ -121,7 +121,7 @@ func handleSignIn(resp http.ResponseWriter, req *http.Request, sess SessionStore // Language setting of the user overwrites the one previously set // If the user does not have a locale set, we save the current one. if len(user.Language) == 0 { - lc := middlewares.Locale(resp, req) + lc := middleware.Locale(resp, req) user.Language = lc.Language() if err := models.UpdateUserCols(user, "language"); err != nil { log.Error(fmt.Sprintf("Error updating user language [user: %d, locale: %s]", user.ID, user.Language)) @@ -129,8 +129,8 @@ func handleSignIn(resp http.ResponseWriter, req *http.Request, sess SessionStore } } - middlewares.SetCookie(resp, "lang", user.Language, nil, setting.AppSubURL, setting.SessionConfig.Domain, setting.SessionConfig.Secure, true) + middleware.SetCookie(resp, "lang", user.Language, nil, setting.AppSubURL, setting.SessionConfig.Domain, setting.SessionConfig.Secure, true) // Clear whatever CSRF has right now, force to generate a new one - middlewares.SetCookie(resp, setting.CSRFCookieName, "", -1, setting.AppSubURL, setting.SessionConfig.Domain, setting.SessionConfig.Secure, true) + middleware.SetCookie(resp, setting.CSRFCookieName, "", -1, setting.AppSubURL, setting.SessionConfig.Domain, setting.SessionConfig.Secure, true) } diff --git a/modules/auth/sso/sspi_windows.go b/modules/auth/sso/sspi_windows.go index 10571d67c5..46f7ad9d97 100644 --- a/modules/auth/sso/sspi_windows.go +++ b/modules/auth/sso/sspi_windows.go @@ -12,9 +12,9 @@ import ( "code.gitea.io/gitea/models" "code.gitea.io/gitea/modules/base" "code.gitea.io/gitea/modules/log" - "code.gitea.io/gitea/modules/middlewares" "code.gitea.io/gitea/modules/setting" "code.gitea.io/gitea/modules/templates" + "code.gitea.io/gitea/modules/web/middleware" gouuid "github.com/google/uuid" "github.com/quasoft/websspi" @@ -136,7 +136,7 @@ func (s *SSPI) VerifyAuthData(req *http.Request, w http.ResponseWriter, store Da } // Make sure requests to API paths and PWA resources do not create a new session - if !middlewares.IsAPIPath(req) && !isAttachmentDownload(req) { + if !middleware.IsAPIPath(req) && !isAttachmentDownload(req) { handleSignIn(w, req, sess, user) } @@ -167,9 +167,9 @@ func (s *SSPI) shouldAuthenticate(req *http.Request) (shouldAuth bool) { } else if req.FormValue("auth_with_sspi") == "1" { shouldAuth = true } - } else if middlewares.IsInternalPath(req) { + } else if middleware.IsInternalPath(req) { shouldAuth = false - } else if middlewares.IsAPIPath(req) || isAttachmentDownload(req) { + } else if middleware.IsAPIPath(req) || isAttachmentDownload(req) { shouldAuth = true } return |