Skip to content

Commit

Permalink
check if plugin type is 'PluginTypeAWSIdentityCenter' and 'PluginAWSI…
Browse files Browse the repository at this point in the history
…CSettings' before saml app and oidc integration deletion
  • Loading branch information
flyinghermit committed Dec 17, 2024
1 parent 17ffecc commit f457d2b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
8 changes: 5 additions & 3 deletions lib/services/local/integrations.go
Original file line number Diff line number Diff line change
Expand Up @@ -212,9 +212,11 @@ func integrationReferencedByAWSICPlugin(ctx context.Context, bk backend.Backend,
if !ok {
continue
}

if pluginV1.GetType() == types.PluginType(types.PluginTypeAWSIdentityCenter) {
switch pluginV1.Spec.GetAwsIc().IntegrationName {
if pluginV1.GetType() != types.PluginType(types.PluginTypeAWSIdentityCenter) {
continue
}
if awsIC := pluginV1.Spec.GetAwsIc(); awsIC != nil {
switch awsIC.IntegrationName {
case name:
return nil, trace.BadParameter("cannot delete AWS OIDC integration currently referenced by AWS Identity Center integration %q", pluginV1.GetName())
default:
Expand Down
10 changes: 7 additions & 3 deletions lib/services/local/saml_idp_service_provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -419,9 +419,13 @@ func spReferencedByAWSICPlugin(ctx context.Context, bk backend.Backend, serviceP
if !ok {
continue
}

if pluginV1.Spec.GetAwsIc().SamlIdpServiceProviderName == serviceProviderName {
return trace.BadParameter("cannot delete SAML service provider currently referenced by AWS Identity Center integration %q", pluginV1.GetName())
if pluginV1.GetType() != types.PluginType(types.PluginTypeAWSIdentityCenter) {
continue
}
if awsIC := pluginV1.Spec.GetAwsIc(); awsIC != nil {
if awsIC.SamlIdpServiceProviderName == serviceProviderName {
return trace.BadParameter("cannot delete SAML service provider currently referenced by AWS Identity Center integration %q", pluginV1.GetName())
}
}
}

Expand Down

0 comments on commit f457d2b

Please sign in to comment.