aboutsummaryrefslogtreecommitdiffstats
path: root/routers/web/web.go
diff options
context:
space:
mode:
authorqwerty287 <80460567+qwerty287@users.noreply.github.com>2022-10-12 16:08:29 +0200
committerGitHub <noreply@github.com>2022-10-12 22:08:29 +0800
commita902af75f480a5629f0747cd65531107e4897e4e (patch)
tree4141c007aad7bd0a434643a7c7f465c7302c85f0 /routers/web/web.go
parentc41b30760ba223b8e1db58b1412aacb5e2571b8a (diff)
downloadgitea-a902af75f480a5629f0747cd65531107e4897e4e.tar.gz
gitea-a902af75f480a5629f0747cd65531107e4897e4e.zip
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>
Diffstat (limited to 'routers/web/web.go')
-rw-r--r--routers/web/web.go17
1 files changed, 17 insertions, 0 deletions
diff --git a/routers/web/web.go b/routers/web/web.go
index c74343c8cf..c01a2bce40 100644
--- a/routers/web/web.go
+++ b/routers/web/web.go
@@ -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 *****