From 769e738afcd9c6e752947543a4c914b2c3e228c1 Mon Sep 17 00:00:00 2001 From: KunalOfficial <35455566+developerkunal@users.noreply.github.com> Date: Fri, 3 May 2024 11:20:16 +0530 Subject: [PATCH] [GH-398] Refactor scopes schema and add Godoc documentation (#400) --- management/connection.go | 38 +++++++++++++++++++++++++++++--------- 1 file changed, 29 insertions(+), 9 deletions(-) diff --git a/management/connection.go b/management/connection.go index 1a1daedd..c1494b26 100644 --- a/management/connection.go +++ b/management/connection.go @@ -898,19 +898,39 @@ func (c *ConnectionOptionsOIDC) SetScopes(enable bool, scopes ...string) { // ConnectionOptionsOAuth2 is used to configure an OAuth2 Connection. type ConnectionOptionsOAuth2 struct { - ClientID *string `json:"client_id,omitempty"` - ClientSecret *string `json:"client_secret,omitempty"` - AuthorizationURL *string `json:"authorizationURL"` - TokenURL *string `json:"tokenURL"` - Scope *string `json:"scope,omitempty"` - SetUserAttributes *string `json:"set_user_root_attributes,omitempty"` + // ClientID is the OAuth2 client ID. + ClientID *string `json:"client_id,omitempty"` + + // ClientSecret is the OAuth2 client secret. + ClientSecret *string `json:"client_secret,omitempty"` + + // AuthorizationURL is the URL used for obtaining authorization from the user. + AuthorizationURL *string `json:"authorizationURL"` + + // TokenURL is the URL used for obtaining the access token. + TokenURL *string `json:"tokenURL"` + + // Scope indicates the OAuth2 scopes for the connection. + // Use SetScopes and Scopes to manage scopes. + Scope *string `json:"-"` + + // SetUserAttributes specifies user root attributes. + SetUserAttributes *string `json:"set_user_root_attributes,omitempty"` + + // NonPersistentAttrs specifies non-persistent attributes. NonPersistentAttrs *[]string `json:"non_persistent_attrs,omitempty"` - LogoURL *string `json:"icon_url,omitempty"` - PKCEEnabled *bool `json:"pkce_enabled,omitempty"` - // Scripts for the connection + + // LogoURL is the URL for the connection's icon. + LogoURL *string `json:"icon_url,omitempty"` + + // PKCEEnabled specifies whether PKCE (Proof Key for Code Exchange) is enabled. + PKCEEnabled *bool `json:"pkce_enabled,omitempty"` + + // Scripts contains scripts for the connection. // Allowed keys are: "fetchUserProfile" Scripts *map[string]string `json:"scripts,omitempty"` + // UpstreamParams specifies upstream parameters. UpstreamParams map[string]interface{} `json:"upstream_params,omitempty"` }