From aa359a15c8688648135d7d1d65b334ae46ce25d3 Mon Sep 17 00:00:00 2001 From: Matt Provost Date: Wed, 7 Aug 2024 16:27:09 -0500 Subject: [PATCH] fix: remove empty access application attributes Signed-off-by: Matt Provost --- .changelog/2838.txt | 3 +++ access_application.go | 20 ++++++++++---------- access_application_test.go | 8 ++++---- 3 files changed, 17 insertions(+), 14 deletions(-) create mode 100644 .changelog/2838.txt diff --git a/.changelog/2838.txt b/.changelog/2838.txt new file mode 100644 index 00000000000..4a9c03ec0e6 --- /dev/null +++ b/.changelog/2838.txt @@ -0,0 +1,3 @@ +```release-notes:bug +access_application: enable removing access application custom attributes and claims +``` diff --git a/access_application.go b/access_application.go index ec1dfcc62eb..def62c0b870 100644 --- a/access_application.go +++ b/access_application.go @@ -224,15 +224,15 @@ type SaasApplication struct { AuthType string `json:"auth_type,omitempty"` // SAML saas app - ConsumerServiceUrl string `json:"consumer_service_url,omitempty"` - SPEntityID string `json:"sp_entity_id,omitempty"` - IDPEntityID string `json:"idp_entity_id,omitempty"` - NameIDFormat string `json:"name_id_format,omitempty"` - SSOEndpoint string `json:"sso_endpoint,omitempty"` - DefaultRelayState string `json:"default_relay_state,omitempty"` - CustomAttributes []SAMLAttributeConfig `json:"custom_attributes,omitempty"` - NameIDTransformJsonata string `json:"name_id_transform_jsonata,omitempty"` - SamlAttributeTransformJsonata string `json:"saml_attribute_transform_jsonata"` + ConsumerServiceUrl string `json:"consumer_service_url,omitempty"` + SPEntityID string `json:"sp_entity_id,omitempty"` + IDPEntityID string `json:"idp_entity_id,omitempty"` + NameIDFormat string `json:"name_id_format,omitempty"` + SSOEndpoint string `json:"sso_endpoint,omitempty"` + DefaultRelayState string `json:"default_relay_state,omitempty"` + CustomAttributes *[]SAMLAttributeConfig `json:"custom_attributes"` + NameIDTransformJsonata string `json:"name_id_transform_jsonata,omitempty"` + SamlAttributeTransformJsonata string `json:"saml_attribute_transform_jsonata"` // OIDC saas app ClientID string `json:"client_id,omitempty"` @@ -242,7 +242,7 @@ type SaasApplication struct { Scopes []string `json:"scopes,omitempty"` AppLauncherURL string `json:"app_launcher_url,omitempty"` GroupFilterRegex string `json:"group_filter_regex,omitempty"` - CustomClaims []OIDCClaimConfig `json:"custom_claims,omitempty"` + CustomClaims *[]OIDCClaimConfig `json:"custom_claims"` AllowPKCEWithoutClientSecret *bool `json:"allow_pkce_without_client_secret,omitempty"` RefreshTokenOptions *RefreshTokenOptions `json:"refresh_token_options,omitempty"` HybridAndImplicitOptions *AccessApplicationHybridAndImplicitOptions `json:"hybrid_and_implicit_options,omitempty"` diff --git a/access_application_test.go b/access_application_test.go index d4308560883..50f2c7e6686 100644 --- a/access_application_test.go +++ b/access_application_test.go @@ -1011,7 +1011,7 @@ func TestCreateSAMLSaasAccessApplications(t *testing.T) { SPEntityID: "dash.example.com", NameIDFormat: "id", DefaultRelayState: "https://saas.example.com", - CustomAttributes: []SAMLAttributeConfig{ + CustomAttributes: &[]SAMLAttributeConfig{ { Name: "test1", NameFormat: "urn:oasis:names:tc:SAML:2.0:attrname-format:unspecified", @@ -1166,7 +1166,7 @@ func TestCreateOIDCSaasAccessApplications(t *testing.T) { AppLauncherURL: "https://saas.example.com", GroupFilterRegex: ".*", AllowPKCEWithoutClientSecret: BoolPtr(false), - CustomClaims: []OIDCClaimConfig{ + CustomClaims: &[]OIDCClaimConfig{ { Name: "test1", Source: SourceConfig{Name: "test1"}, @@ -1197,7 +1197,7 @@ func TestCreateOIDCSaasAccessApplications(t *testing.T) { AppLauncherURL: "https://saas.example.com", GroupFilterRegex: ".*", AllowPKCEWithoutClientSecret: BoolPtr(false), - CustomClaims: []OIDCClaimConfig{ + CustomClaims: &[]OIDCClaimConfig{ { Name: "test1", Source: SourceConfig{Name: "test1"}, @@ -1229,7 +1229,7 @@ func TestCreateOIDCSaasAccessApplications(t *testing.T) { AppLauncherURL: "https://saas.example.com", GroupFilterRegex: ".*", AllowPKCEWithoutClientSecret: BoolPtr(false), - CustomClaims: []OIDCClaimConfig{ + CustomClaims: &[]OIDCClaimConfig{ { Name: "test1", Source: SourceConfig{Name: "test1"},