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:
@@ -83,6 +83,7 @@ import (
|
||||
"code.gitea.io/gitea/routers/api/v1/settings"
|
||||
_ "code.gitea.io/gitea/routers/api/v1/swagger" // for swagger generation
|
||||
"code.gitea.io/gitea/routers/api/v1/user"
|
||||
"code.gitea.io/gitea/services/auth"
|
||||
"code.gitea.io/gitea/services/forms"
|
||||
|
||||
"gitea.com/go-chi/binding"
|
||||
@@ -573,6 +574,9 @@ func Routes() *web.Route {
|
||||
}
|
||||
m.Use(context.APIContexter())
|
||||
|
||||
// Get user from session if logged in.
|
||||
m.Use(context.APIAuth(auth.NewGroup(auth.Methods()...)))
|
||||
|
||||
m.Use(context.ToggleAPI(&context.ToggleOptions{
|
||||
SignInRequired: setting.Service.RequireSignInView,
|
||||
}))
|
||||
|
Reference in New Issue
Block a user