From 707443c6d272b89cc8772dbfdd7f023deda80b82 Mon Sep 17 00:00:00 2001 From: Alessandro De Blasis Date: Tue, 11 Jul 2023 21:18:08 +0000 Subject: [PATCH] feat(gitea_oauth_app): support --- gitea/resource_gitea_oauth_app.go | 15 +++++++++++---- vendor/code.gitea.io/sdk/gitea/oauth2.go | 18 ++++++++++-------- 2 files changed, 21 insertions(+), 12 deletions(-) diff --git a/gitea/resource_gitea_oauth_app.go b/gitea/resource_gitea_oauth_app.go index e628882..1dd8177 100644 --- a/gitea/resource_gitea_oauth_app.go +++ b/gitea/resource_gitea_oauth_app.go @@ -8,10 +8,11 @@ import ( ) const ( - oauth2KeyName string = "name" - oauth2KeyRedirectURIs string = "redirect_uris" - oauth2KeyClientId string = "client_id" - oauth2KeyClientSecret string = "client_secret" + oauth2KeyName string = "name" + oauth2KeyConfidentialClient string = "confidential_client" + oauth2KeyRedirectURIs string = "redirect_uris" + oauth2KeyClientId string = "client_id" + oauth2KeyClientSecret string = "client_secret" ) func resourceGiteaOauthApp() *schema.Resource { @@ -37,6 +38,12 @@ func resourceGiteaOauthApp() *schema.Resource { }, Description: "Accepted redirect URIs", }, + oauth2KeyConfidentialClient: { + Type: schema.TypeBool, + Optional: true, + Default: false, + Description: "If set to false, it will be a public client (PKCE will be required)", + }, oauth2KeyClientId: { Type: schema.TypeString, Computed: true, diff --git a/vendor/code.gitea.io/sdk/gitea/oauth2.go b/vendor/code.gitea.io/sdk/gitea/oauth2.go index bbdfdaf..86e2568 100644 --- a/vendor/code.gitea.io/sdk/gitea/oauth2.go +++ b/vendor/code.gitea.io/sdk/gitea/oauth2.go @@ -13,12 +13,13 @@ import ( // Oauth2 represents an Oauth2 Application type Oauth2 struct { - ID int64 `json:"id"` - Name string `json:"name"` - ClientID string `json:"client_id"` - ClientSecret string `json:"client_secret"` - RedirectURIs []string `json:"redirect_uris"` - Created time.Time `json:"created"` + ID int64 `json:"id"` + Name string `json:"name"` + ClientID string `json:"client_id"` + ClientSecret string `json:"client_secret"` + RedirectURIs []string `json:"redirect_uris"` + ConfidentialClient bool `json:"confidential_client"` + Created time.Time `json:"created"` } // ListOauth2Option for listing Oauth2 Applications @@ -28,8 +29,9 @@ type ListOauth2Option struct { // CreateOauth2Option required options for creating an Application type CreateOauth2Option struct { - Name string `json:"name"` - RedirectURIs []string `json:"redirect_uris"` + Name string `json:"name"` + ConfidentialClient bool `json:"confidential_client"` + RedirectURIs []string `json:"redirect_uris"` } // CreateOauth2 create an Oauth2 Application and returns a completed Oauth2 object.