@@ -406,6 +406,77 @@ void RGWAddClientIdToOIDCProvider::execute(optional_yield y)
406406 }
407407}
408408
409+ RGWRemoveCientIdFromOIDCProvider::RGWRemoveCientIdFromOIDCProvider ()
410+ : RGWRestOIDCProvider(rgw::IAM::iamRemoveClientIdFromOIDCProvider, RGW_CAP_WRITE)
411+ {
412+ }
413+
414+ int RGWRemoveCientIdFromOIDCProvider::init_processing (optional_yield y)
415+ {
416+ std::string_view account;
417+ if (const auto & acc = s->auth .identity ->get_account (); acc) {
418+ account = acc->id ;
419+ } else {
420+ account = s->user ->get_tenant ();
421+ }
422+ std::string provider_arn = s->info .args .get (" OpenIDConnectProviderArn" );
423+ auto ret = validate_provider_arn (provider_arn, account,
424+ resource, url, s->err .message );
425+ if (ret < 0 ) {
426+ return ret;
427+ }
428+
429+ client_id = s->info .args .get (" ClientID" );
430+
431+ if (client_id.empty ()) {
432+ s->err .message = " Missing required element ClientID" ;
433+ ldpp_dout (this , 20 ) << " ERROR: ClientID is empty" << dendl;
434+ return -EINVAL;
435+ }
436+
437+ if (client_id.size () > MAX_OIDC_CLIENT_ID_LEN) {
438+ s->err .message = " ClientID cannot exceed the maximum length of "
439+ + std::to_string (MAX_OIDC_CLIENT_ID_LEN);
440+ ldpp_dout (this , 20 ) << " ERROR: ClientID length exceeded " << MAX_OIDC_CLIENT_ID_LEN << dendl;
441+ return -EINVAL;
442+ }
443+
444+ return 0 ;
445+ }
446+
447+ void RGWRemoveCientIdFromOIDCProvider::execute (optional_yield y)
448+ {
449+ RGWOIDCProviderInfo info;
450+ op_ret = driver->load_oidc_provider (this , y, resource.account , url, info);
451+
452+ if (op_ret < 0 ) {
453+ if (op_ret != -ENOENT && op_ret != -EINVAL) {
454+ op_ret = ERR_INTERNAL_ERROR;
455+ }
456+ return ;
457+ }
458+
459+ auto position = std::find (info.client_ids .begin (), info.client_ids .end (), client_id);
460+
461+ if (position != info.client_ids .end ()) {
462+ info.client_ids .erase (position);
463+ constexpr bool exclusive = false ;
464+ op_ret = driver->store_oidc_provider (this , y, info, exclusive);
465+ }
466+
467+ if (op_ret == 0 ) {
468+ op_ret = 0 ;
469+ s->formatter ->open_object_section (" RemoveClientIDFromOpenIDConnectProviderResponse" );
470+ s->formatter ->open_object_section (" ResponseMetadata" );
471+ s->formatter ->dump_string (" RequestId" , s->trans_id );
472+ s->formatter ->close_section ();
473+ s->formatter ->open_object_section (" RemoveClientIDFromOpenIDConnectProviderResponse" );
474+ dump_oidc_provider (info, s->formatter );
475+ s->formatter ->close_section ();
476+ s->formatter ->close_section ();
477+ }
478+ }
479+
409480RGWUpdateOIDCProviderThumbprint::RGWUpdateOIDCProviderThumbprint ()
410481 : RGWRestOIDCProvider(rgw::IAM::iamUpdateOIDCProviderThumbprint, RGW_CAP_WRITE)
411482{
0 commit comments