aboutsummaryrefslogtreecommitdiffstats
path: root/routers/api
diff options
context:
space:
mode:
authorDenys Konovalov <kontakt@denyskon.de>2024-07-19 14:28:30 -0400
committerGitHub <noreply@github.com>2024-07-19 14:28:30 -0400
commita8d0c879c38e21a8e78db627119bf622d919ee75 (patch)
treef55cbd55c967d11e7e4a4c4c96ce7b6db8345353 /routers/api
parente9aa39bda4581a69f04dd1d46aab7980940e99ce (diff)
downloadgitea-a8d0c879c38e21a8e78db627119bf622d919ee75.tar.gz
gitea-a8d0c879c38e21a8e78db627119bf622d919ee75.zip
add skip secondary authorization option for public oauth2 clients (#31454)
Diffstat (limited to 'routers/api')
-rw-r--r--routers/api/v1/user/app.go20
1 files changed, 11 insertions, 9 deletions
diff --git a/routers/api/v1/user/app.go b/routers/api/v1/user/app.go
index 60354b1f26..5c28dd878d 100644
--- a/routers/api/v1/user/app.go
+++ b/routers/api/v1/user/app.go
@@ -223,10 +223,11 @@ func CreateOauth2Application(ctx *context.APIContext) {
data := web.GetForm(ctx).(*api.CreateOAuth2ApplicationOptions)
app, err := auth_model.CreateOAuth2Application(ctx, auth_model.CreateOAuth2ApplicationOptions{
- Name: data.Name,
- UserID: ctx.Doer.ID,
- RedirectURIs: data.RedirectURIs,
- ConfidentialClient: data.ConfidentialClient,
+ Name: data.Name,
+ UserID: ctx.Doer.ID,
+ RedirectURIs: data.RedirectURIs,
+ ConfidentialClient: data.ConfidentialClient,
+ SkipSecondaryAuthorization: data.SkipSecondaryAuthorization,
})
if err != nil {
ctx.Error(http.StatusBadRequest, "", "error creating oauth2 application")
@@ -381,11 +382,12 @@ func UpdateOauth2Application(ctx *context.APIContext) {
data := web.GetForm(ctx).(*api.CreateOAuth2ApplicationOptions)
app, err := auth_model.UpdateOAuth2Application(ctx, auth_model.UpdateOAuth2ApplicationOptions{
- Name: data.Name,
- UserID: ctx.Doer.ID,
- ID: appID,
- RedirectURIs: data.RedirectURIs,
- ConfidentialClient: data.ConfidentialClient,
+ Name: data.Name,
+ UserID: ctx.Doer.ID,
+ ID: appID,
+ RedirectURIs: data.RedirectURIs,
+ ConfidentialClient: data.ConfidentialClient,
+ SkipSecondaryAuthorization: data.SkipSecondaryAuthorization,
})
if err != nil {
if auth_model.IsErrOauthClientIDInvalid(err) || auth_model.IsErrOAuthApplicationNotFound(err) {