mirror of
https://github.com/go-gitea/gitea
synced 2025-07-22 18:28:37 +00:00
Support instance-wide OAuth2 applications (#21335)
Support OAuth2 applications created by admins on the admin panel, they aren't owned by anybody. Co-authored-by: wxiaoguang <wxiaoguang@gmail.com> Co-authored-by: Lauris BH <lauris@nix.lv>
This commit is contained in:
@@ -569,6 +569,23 @@ func RegisterRoutes(m *web.Route) {
|
||||
m.Post("/delete", admin.DeleteNotices)
|
||||
m.Post("/empty", admin.EmptyNotices)
|
||||
})
|
||||
|
||||
m.Group("/applications", func() {
|
||||
m.Get("", admin.Applications)
|
||||
m.Post("/oauth2", bindIgnErr(forms.EditOAuth2ApplicationForm{}), admin.ApplicationsPost)
|
||||
m.Group("/oauth2/{id}", func() {
|
||||
m.Combo("").Get(admin.EditApplication).Post(bindIgnErr(forms.EditOAuth2ApplicationForm{}), admin.EditApplicationPost)
|
||||
m.Post("/regenerate_secret", admin.ApplicationsRegenerateSecret)
|
||||
m.Post("/delete", admin.DeleteApplication)
|
||||
})
|
||||
}, func(ctx *context.Context) {
|
||||
if !setting.OAuth2.Enable {
|
||||
ctx.Error(http.StatusForbidden)
|
||||
return
|
||||
}
|
||||
})
|
||||
}, func(ctx *context.Context) {
|
||||
ctx.Data["EnableOAuth2"] = setting.OAuth2.Enable
|
||||
}, adminReq)
|
||||
// ***** END: Admin *****
|
||||
|
||||
|
Reference in New Issue
Block a user