mirror of
https://github.com/go-gitea/gitea
synced 2025-07-22 18:28:37 +00:00
Add sso.Group, context.Auth, context.APIAuth to allow auth special routes (#16086)
* Add sso.Group, context.Auth, context.APIAuth to allow auth special routes * Remove unnecessary check * Rename sso -> auth * remove unused method of Auth interface
This commit is contained in:
@@ -31,6 +31,7 @@ import (
|
||||
"code.gitea.io/gitea/routers/web/repo"
|
||||
"code.gitea.io/gitea/routers/web/user"
|
||||
userSetting "code.gitea.io/gitea/routers/web/user/setting"
|
||||
"code.gitea.io/gitea/services/auth"
|
||||
"code.gitea.io/gitea/services/forms"
|
||||
"code.gitea.io/gitea/services/lfs"
|
||||
"code.gitea.io/gitea/services/mailer"
|
||||
@@ -149,6 +150,9 @@ func Routes() *web.Route {
|
||||
// Removed: toolbox.Toolboxer middleware will provide debug informations which seems unnecessary
|
||||
common = append(common, context.Contexter())
|
||||
|
||||
// Get user from session if logged in.
|
||||
common = append(common, context.Auth(auth.NewGroup(auth.Methods()...)))
|
||||
|
||||
// GetHead allows a HEAD request redirect to GET if HEAD method is not defined for that route
|
||||
common = append(common, middleware.GetHead)
|
||||
|
||||
|
Reference in New Issue
Block a user