From 62dc4c2da36877803a56c7be0b6dd755a3629c03 Mon Sep 17 00:00:00 2001 From: Tim Riedl Date: Sat, 19 Apr 2025 01:47:57 +0200 Subject: [PATCH] Add PUT endpoint for creating new OAuth2 authentication and clean up routing --- routers/api/v1/admin/auth_oauth.go | 1 + routers/api/v1/api.go | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/routers/api/v1/admin/auth_oauth.go b/routers/api/v1/admin/auth_oauth.go index 73ffb90af3..3d9327fe5c 100644 --- a/routers/api/v1/admin/auth_oauth.go +++ b/routers/api/v1/admin/auth_oauth.go @@ -26,6 +26,7 @@ import ( func CreateOauthAuth(ctx *context.APIContext) { form := web.GetForm(ctx).(*api.CreateAuthOauth2Option) + // ??? todo: what should I do here? var scopes []string // for _, s := range strings.Split(form.Oauth2Scopes, ",") { // s = strings.TrimSpace(s) diff --git a/routers/api/v1/api.go b/routers/api/v1/api.go index 06c49a3d6d..984095d070 100644 --- a/routers/api/v1/api.go +++ b/routers/api/v1/api.go @@ -1650,10 +1650,10 @@ func Routes() *web.Router { m.Group("/admin", func() { m.Group("/identity-auth", func() { - m.Group("oauth", func() { + m.Group("/oauth", func() { m.Get("", admin.SearchOauthAuth) + m.Put("/new", bind(api.CreateAuthOauth2Option{}), admin.CreateOauthAuth) m.Delete("/{id}", admin.DeleteOauthAuth) - m.Post("/new", admin.CreateOauthAuth) }) })