descope 1.1.0 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ci.yaml +4 -4
  3. data/.github/workflows/publish-gem.yaml +2 -2
  4. data/.github/workflows/release-please.yaml +1 -1
  5. data/.release-please-manifest.json +1 -1
  6. data/.rubocop.yml +1 -1
  7. data/.rubocop_todo.yml +1 -1
  8. data/.ruby-version +1 -1
  9. data/CHANGELOG.md +17 -0
  10. data/Gemfile +5 -5
  11. data/Gemfile.lock +33 -35
  12. data/README.md +233 -1
  13. data/lib/descope/api/v1/auth/enchantedlink.rb +76 -9
  14. data/lib/descope/api/v1/auth.rb +68 -11
  15. data/lib/descope/api/v1/management/access_key.rb +8 -7
  16. data/lib/descope/api/v1/management/analytics.rb +62 -0
  17. data/lib/descope/api/v1/management/audit.rb +2 -2
  18. data/lib/descope/api/v1/management/authz.rb +15 -15
  19. data/lib/descope/api/v1/management/common.rb +76 -0
  20. data/lib/descope/api/v1/management/descoper.rb +45 -0
  21. data/lib/descope/api/v1/management/engine.rb +44 -0
  22. data/lib/descope/api/v1/management/fga.rb +64 -0
  23. data/lib/descope/api/v1/management/flow.rb +5 -5
  24. data/lib/descope/api/v1/management/group.rb +42 -0
  25. data/lib/descope/api/v1/management/jwt_template.rb +49 -0
  26. data/lib/descope/api/v1/management/lists.rb +96 -0
  27. data/lib/descope/api/v1/management/management_key.rb +54 -0
  28. data/lib/descope/api/v1/management/outbound_app.rb +112 -0
  29. data/lib/descope/api/v1/management/password.rb +2 -2
  30. data/lib/descope/api/v1/management/permission.rb +4 -4
  31. data/lib/descope/api/v1/management/project.rb +5 -5
  32. data/lib/descope/api/v1/management/role.rb +5 -5
  33. data/lib/descope/api/v1/management/scim.rb +14 -14
  34. data/lib/descope/api/v1/management/scope_claim_mapping.rb +34 -0
  35. data/lib/descope/api/v1/management/sso_application.rb +7 -7
  36. data/lib/descope/api/v1/management/sso_settings.rb +5 -5
  37. data/lib/descope/api/v1/management/tenant.rb +8 -6
  38. data/lib/descope/api/v1/management/third_party_application.rb +190 -0
  39. data/lib/descope/api/v1/management/user.rb +36 -36
  40. data/lib/descope/api/v1/management.rb +22 -0
  41. data/lib/descope/http_client.rb +30 -0
  42. data/lib/descope/mixins/common.rb +1 -0
  43. data/lib/descope/mixins/http.rb +23 -16
  44. data/lib/descope/mixins/initializer.rb +19 -9
  45. data/lib/descope/mixins/requests.rb +24 -0
  46. data/lib/descope/mixins.rb +2 -1
  47. data/lib/descope/version.rb +1 -1
  48. data/spec/integration/lib.descope/api/v1/management/user_spec.rb +1 -1
  49. data/spec/lib.descope/api/v1/auth/enchantedlink_spec.rb +163 -1
  50. data/spec/lib.descope/api/v1/auth_spec.rb +227 -1
  51. data/spec/lib.descope/api/v1/management/access_key_spec.rb +7 -7
  52. data/spec/lib.descope/api/v1/management/analytics_spec.rb +82 -0
  53. data/spec/lib.descope/api/v1/management/audit_spec.rb +2 -2
  54. data/spec/lib.descope/api/v1/management/authz_spec.rb +16 -16
  55. data/spec/lib.descope/api/v1/management/descoper_spec.rb +101 -0
  56. data/spec/lib.descope/api/v1/management/engine_spec.rb +115 -0
  57. data/spec/lib.descope/api/v1/management/fga_spec.rb +169 -0
  58. data/spec/lib.descope/api/v1/management/flow_spec.rb +5 -5
  59. data/spec/lib.descope/api/v1/management/group_spec.rb +72 -0
  60. data/spec/lib.descope/api/v1/management/jwt_template_spec.rb +103 -0
  61. data/spec/lib.descope/api/v1/management/lists_spec.rb +285 -0
  62. data/spec/lib.descope/api/v1/management/management_key_spec.rb +109 -0
  63. data/spec/lib.descope/api/v1/management/outbound_app_spec.rb +236 -0
  64. data/spec/lib.descope/api/v1/management/password_spec.rb +2 -2
  65. data/spec/lib.descope/api/v1/management/permission_spec.rb +4 -4
  66. data/spec/lib.descope/api/v1/management/project_spec.rb +4 -4
  67. data/spec/lib.descope/api/v1/management/role_spec.rb +5 -5
  68. data/spec/lib.descope/api/v1/management/scim_spec.rb +14 -14
  69. data/spec/lib.descope/api/v1/management/scope_claim_mapping_spec.rb +59 -0
  70. data/spec/lib.descope/api/v1/management/sso_application_spec.rb +6 -6
  71. data/spec/lib.descope/api/v1/management/sso_settings_spec.rb +5 -5
  72. data/spec/lib.descope/api/v1/management/tenant_spec.rb +6 -6
  73. data/spec/lib.descope/api/v1/management/third_party_application_spec.rb +171 -0
  74. data/spec/lib.descope/api/v1/management/user_spec.rb +36 -36
  75. data/spec/lib.descope/auth_management_key_spec.rb +151 -0
  76. data/spec/support/client_config.rb +1 -0
  77. data/spec/support/dummy_class.rb +12 -9
  78. metadata +28 -3
@@ -11,21 +11,21 @@ module Descope
11
11
  def scim_search_groups(filter: nil, start_index: nil, count: nil, excluded_attributes: nil)
12
12
  # Search SCIM Groups
13
13
  url = compose_scim_search_groups_url(filter, start_index, count, excluded_attributes)
14
- get(url)
14
+ mgmt_get(url)
15
15
  end
16
16
 
17
17
  def scim_create_group(group_id: nil, display_name: nil, members: nil, external_id: nil,
18
18
  excluded_attributes: nil)
19
19
  # Create SCIM Group
20
20
  body = compose_scim_create_group_body(group_id, display_name, members, external_id, excluded_attributes)
21
- post(SCIM_GROUPS_PATH, body)
21
+ mgmt_post(SCIM_GROUPS_PATH, body)
22
22
  end
23
23
 
24
24
  def scim_load_group(group_id: nil, display_name: nil, external_id: nil, excluded_attributes: nil)
25
25
  # Load SCIM Group, using a valid access key.
26
26
  validate_scim_group_id(group_id)
27
27
  url = compose_scim_create_group_url(group_id, display_name, external_id, excluded_attributes)
28
- get(url)
28
+ mgmt_get(url)
29
29
  end
30
30
 
31
31
  def scim_update_group(group_id: nil, display_name: nil, members: nil, external_id: nil,
@@ -33,38 +33,38 @@ module Descope
33
33
  # Update SCIM Group, using a valid access key.
34
34
  validate_scim_group_id(group_id)
35
35
  body = compose_scim_update_group_body(group_id, display_name, members, external_id, excluded_attributes)
36
- patch("#{SCIM_GROUPS_PATH}/#{group_id}", body)
36
+ mgmt_patch("#{SCIM_GROUPS_PATH}/#{group_id}", body)
37
37
  end
38
38
 
39
39
  def scim_delete_group(group_id)
40
40
  # Delete SCIM Group, using a valid access key.
41
41
  validate_scim_group_id(group_id)
42
42
  url = "#{SCIM_GROUPS_PATH}/#{group_id}"
43
- delete(url)
43
+ mgmt_delete(url)
44
44
  end
45
45
 
46
46
  def scim_patch_group(group_id: nil, user_id: nil, operations: nil)
47
47
  # Patch SCIM Group, using a valid access key.
48
48
  validate_scim_group_id(group_id)
49
49
  url = compose_scim_patch_group_url(group_id, user_id, operations)
50
- patch(url)
50
+ mgmt_patch(url)
51
51
  end
52
52
 
53
53
  # SCIM Users
54
54
  def scim_load_resource_types
55
55
  # Load SCIM Resource Types, using a valid access key.
56
- get(SCIM_RESOURCE_TYPES_PATH)
56
+ mgmt_get(SCIM_RESOURCE_TYPES_PATH)
57
57
  end
58
58
 
59
59
  def scim_load_service_provider_config
60
60
  # Load SCIM Service Provider Config, using a valid access key.
61
- get(SCIM_SERVICE_PROVIDER_CONFIG_PATH)
61
+ mgmt_get(SCIM_SERVICE_PROVIDER_CONFIG_PATH)
62
62
  end
63
63
 
64
64
  def scim_search_users(filter: nil, start_index: nil, count: nil)
65
65
  # Search SCIM Users, using a valid access key.
66
66
  url = compose_scim_search_users_url(filter, start_index, count)
67
- get(url)
67
+ mgmt_get(url)
68
68
  end
69
69
 
70
70
  def scim_create_user(user_id: nil, display_name: nil, emails: nil,
@@ -72,28 +72,28 @@ module Descope
72
72
  # Create SCIM User, using a valid access key.
73
73
  validate_user_id(user_id)
74
74
  body = compose_scim_create_user_body(user_id, display_name, emails, phone_numbers, active, name, user_name)
75
- post(SCIM_USERS_PATH, body)
75
+ mgmt_post(SCIM_USERS_PATH, body)
76
76
  end
77
77
 
78
78
  def scim_load_user(user_id)
79
79
  # Load SCIM User, using a valid access key.
80
80
  validate_user_id(user_id)
81
81
  url = "#{SCIM_USERS_PATH}/#{user_id}"
82
- get(url)
82
+ mgmt_get(url)
83
83
  end
84
84
 
85
85
  def scim_update_user(user_id)
86
86
  # Update SCIM User, using a valid access key.
87
87
  validate_user_id(user_id)
88
88
  url = "#{SCIM_USERS_PATH}/#{user_id}"
89
- patch(url)
89
+ mgmt_patch(url)
90
90
  end
91
91
 
92
92
  def scim_delete_user(user_id)
93
93
  # Delete SCIM User, using a valid access key.
94
94
  validate_user_id(user_id)
95
95
  url = "#{SCIM_USERS_PATH}/#{user_id}"
96
- delete(url)
96
+ mgmt_delete(url)
97
97
  end
98
98
 
99
99
  def scim_patch_user(user_id: nil, group_id: nil, operations: nil)
@@ -101,7 +101,7 @@ module Descope
101
101
  validate_user_id(user_id)
102
102
  validate_scim_group_id(group_id)
103
103
  body = compose_scim_patch_user_body(user_id, group_id, operations)
104
- patch(SCIM_USERS_PATH, body)
104
+ mgmt_patch(SCIM_USERS_PATH, body)
105
105
  end
106
106
 
107
107
  private
@@ -0,0 +1,34 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Descope
4
+ module Api
5
+ module V1
6
+ module Management
7
+ # Manage project-wide OIDC scope-to-claim mapping
8
+ module ScopeClaimMapping
9
+ include Descope::Api::V1::Management::Common
10
+
11
+ def get_scope_claim_mapping # rubocop:disable Naming/AccessorMethodName
12
+ # Get the project-wide OIDC scope-to-claim mappings.
13
+ mgmt_post(SCOPE_CLAIM_MAPPING_GET_PATH)
14
+ end
15
+
16
+ def set_scope_claim_mapping(mappings: nil)
17
+ # Set the project-wide OIDC scope-to-claim mappings.
18
+ # mappings (Array[]): the scope-to-claim mappings to set. Each in the following format:
19
+ # {
20
+ # "scope": "name of the OIDC scope",
21
+ # "claims": ["list of claims mapped to the scope"]
22
+ # }
23
+ mgmt_post(SCOPE_CLAIM_MAPPING_SET_PATH, { mappings: })
24
+ end
25
+
26
+ def delete_scope_claim_mapping
27
+ # Delete the project-wide OIDC scope-to-claim mappings.
28
+ mgmt_post(SCOPE_CLAIM_MAPPING_DELETE_PATH)
29
+ end
30
+ end
31
+ end
32
+ end
33
+ end
34
+ end
@@ -18,7 +18,7 @@ module Descope
18
18
  body[:enabled] = enabled if enabled
19
19
  body[:logo] = logo if logo
20
20
  body[:loginPageUrl] = login_page_url if login_page_url
21
- post(SSO_APPLICATION_OIDC_CREATE_PATH, body)
21
+ mgmt_post(SSO_APPLICATION_OIDC_CREATE_PATH, body)
22
22
  end
23
23
 
24
24
  # rubocop:disable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
@@ -78,14 +78,14 @@ module Descope
78
78
  force_authentication:,
79
79
  logout_redirect_url:
80
80
  )
81
- post(SSO_APPLICATION_SAML_CREATE_PATH, body)
81
+ mgmt_post(SSO_APPLICATION_SAML_CREATE_PATH, body)
82
82
  end
83
83
 
84
84
  def update_sso_oidc_app(id: nil, name: nil, description: nil, enabled: nil, logo: nil, login_page_url: nil, force_authentication: nil)
85
85
  # Update an existing OIDC sso application with the given parameters. IMPORTANT: All parameters are used as overrides
86
86
  # to the existing sso application. Empty fields will override populated fields. Use carefully.
87
87
  body = compose_create_update_oidc_body(name, login_page_url, id, description, enabled, logo, force_authentication)
88
- post(SSO_APPLICATION_OIDC_UPDATE_PATH, body)
88
+ mgmt_post(SSO_APPLICATION_OIDC_UPDATE_PATH, body)
89
89
  end
90
90
 
91
91
  def update_saml_application(
@@ -143,17 +143,17 @@ module Descope
143
143
  force_authentication:,
144
144
  logout_redirect_url:
145
145
  )
146
- post(SSO_APPLICATION_SAML_UPDATE_PATH, body)
146
+ mgmt_post(SSO_APPLICATION_SAML_UPDATE_PATH, body)
147
147
  end
148
148
 
149
149
  def delete_sso_app(id)
150
150
  # Delete an existing sso application. IMPORTANT: This operation is irreversible. Use carefully.
151
- delete(SSO_APPLICATION_DELETE_PATH, { id: })
151
+ mgmt_delete(SSO_APPLICATION_DELETE_PATH, { id: })
152
152
  end
153
153
 
154
154
  def load_sso_app(id)
155
155
  # Load an existing sso application.
156
- get(SSO_APPLICATION_LOAD_PATH, { id: })
156
+ mgmt_get(SSO_APPLICATION_LOAD_PATH, { id: })
157
157
  end
158
158
 
159
159
  def load_all_sso_apps
@@ -167,7 +167,7 @@ module Descope
167
167
  # ]
168
168
  # }
169
169
  # Containing the loaded sso applications information.
170
- get(SSO_APPLICATION_LOAD_ALL_PATH, {})
170
+ mgmt_get(SSO_APPLICATION_LOAD_ALL_PATH, {})
171
171
  end
172
172
 
173
173
  private
@@ -10,12 +10,12 @@ module Descope
10
10
 
11
11
  def get_sso_settings(tenant_id)
12
12
  # Get SSO settings for the provided tenant id.
13
- get(SSO_SETTINGS_PATH, { tenantId: tenant_id })
13
+ mgmt_get(SSO_SETTINGS_PATH, { tenantId: tenant_id })
14
14
  end
15
15
 
16
16
  def delete_sso_settings(tenant_id)
17
17
  # Delete SSO settings for the provided tenant id.
18
- delete(SSO_SETTINGS_PATH, { tenantId: tenant_id })
18
+ mgmt_delete(SSO_SETTINGS_PATH, { tenantId: tenant_id })
19
19
  end
20
20
 
21
21
  def configure_sso_oidc(tenant_id: nil, settings: nil, redirect_url: nil, domain: nil)
@@ -28,7 +28,7 @@ module Descope
28
28
  redirectUrl: redirect_url,
29
29
  domain:
30
30
  }
31
- post(SSO_OIDC_PATH, request_params)
31
+ mgmt_post(SSO_OIDC_PATH, request_params)
32
32
  end
33
33
 
34
34
  def configure_sso_saml(tenant_id: nil, settings: nil, redirect_url: nil, domain: nil)
@@ -41,12 +41,12 @@ module Descope
41
41
  redirectUrl: redirect_url,
42
42
  domain:
43
43
  }
44
- post(SSO_SETTINGS_PATH, request_params)
44
+ mgmt_post(SSO_SETTINGS_PATH, request_params)
45
45
  end
46
46
 
47
47
  def configure_sso_saml_metadata(tenant_id: nil, settings: nil, redirect_url: nil, domain: nil)
48
48
  # Configure tenant SSO SAML Metadata, using a valid management key.
49
- post(SSO_METADATA_PATH, compose_metadata_body(tenant_id, settings, redirect_url, domain))
49
+ mgmt_post(SSO_METADATA_PATH, compose_metadata_body(tenant_id, settings, redirect_url, domain))
50
50
  end
51
51
 
52
52
  private
@@ -17,7 +17,8 @@ module Descope
17
17
 
18
18
  self_provisioning_domains ||= []
19
19
  custom_attributes ||= {}
20
- post(TENANT_CREATE_PATH, compose_tenant_create_update_body(name, id, self_provisioning_domains, custom_attributes))
20
+ mgmt_post(TENANT_CREATE_PATH,
21
+ compose_tenant_create_update_body(name, id, self_provisioning_domains, custom_attributes))
21
22
  end
22
23
 
23
24
  def update_tenant(name: nil, id: nil, self_provisioning_domains: nil, custom_attributes: nil)
@@ -26,22 +27,23 @@ module Descope
26
27
  # @see https://docs.descope.com/api/openapi/tenantmanagement/operation/UpdateTenant/
27
28
  self_provisioning_domains ||= []
28
29
  custom_attributes ||= {}
29
- post(TENANT_UPDATE_PATH, compose_tenant_create_update_body(name, id, self_provisioning_domains, custom_attributes))
30
+ mgmt_post(TENANT_UPDATE_PATH,
31
+ compose_tenant_create_update_body(name, id, self_provisioning_domains, custom_attributes))
30
32
  end
31
33
 
32
34
  def delete_tenant(id = nil)
33
35
  # Delete an existing tenant. IMPORTANT: This action is irreversible. Use carefully.
34
- post(TENANT_DELETE_PATH, { id: })
36
+ mgmt_post(TENANT_DELETE_PATH, { id: })
35
37
  end
36
38
 
37
39
  def load_tenant(id = nil)
38
40
  # Load tenant by id.
39
- get(TENANT_LOAD_PATH, { id: })
41
+ mgmt_get(TENANT_LOAD_PATH, { id: })
40
42
  end
41
43
 
42
44
  def load_all_tenants
43
45
  # Load all tenants.
44
- get(TENANT_LOAD_ALL_PATH)
46
+ mgmt_get(TENANT_LOAD_ALL_PATH)
45
47
  end
46
48
 
47
49
  def search_all_tenants(ids: nil, names: nil, self_provisioning_domains: nil, custom_attributes: nil)
@@ -52,7 +54,7 @@ module Descope
52
54
  selfProvisioningDomains: self_provisioning_domains,
53
55
  customAttributes: custom_attributes
54
56
  }
55
- post(TENANT_SEARCH_ALL_PATH, request_params)
57
+ mgmt_post(TENANT_SEARCH_ALL_PATH, request_params)
56
58
  end
57
59
 
58
60
  private
@@ -0,0 +1,190 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Descope
4
+ module Api
5
+ module V1
6
+ module Management
7
+ # Management API calls for third party applications
8
+ module ThirdPartyApplication
9
+ include Descope::Api::V1::Management::Common
10
+
11
+ def create_application(
12
+ name: nil,
13
+ id: nil,
14
+ description: nil,
15
+ logo: nil,
16
+ login_page_url: nil,
17
+ approved_callback_urls: nil,
18
+ permissions_scopes: nil,
19
+ attributes_scopes: nil,
20
+ jwt_bearer_settings: nil,
21
+ custom_attributes: nil,
22
+ force_pkce: nil,
23
+ default_audience: nil
24
+ )
25
+ # Create a new third party application with the given name. Application IDs are provisioned automatically,
26
+ # but can be provided explicitly if needed. Both the name and ID must be unique per project.
27
+ body = compose_create_update_body(
28
+ name:,
29
+ id:,
30
+ description:,
31
+ logo:,
32
+ login_page_url:,
33
+ approved_callback_urls:,
34
+ permissions_scopes:,
35
+ attributes_scopes:,
36
+ jwt_bearer_settings:,
37
+ custom_attributes:,
38
+ force_pkce:,
39
+ default_audience:
40
+ )
41
+ mgmt_post(THIRD_PARTY_APP_CREATE_PATH, body)
42
+ end
43
+
44
+ def update_application(
45
+ id: nil,
46
+ name: nil,
47
+ description: nil,
48
+ logo: nil,
49
+ login_page_url: nil,
50
+ approved_callback_urls: nil,
51
+ permissions_scopes: nil,
52
+ attributes_scopes: nil,
53
+ jwt_bearer_settings: nil,
54
+ custom_attributes: nil,
55
+ force_pkce: nil,
56
+ default_audience: nil
57
+ )
58
+ # Update an existing third party application with the given parameters. IMPORTANT: All parameters are used as
59
+ # overrides to the existing application. Empty fields will override populated fields. Use carefully.
60
+ body = compose_create_update_body(
61
+ name:,
62
+ id:,
63
+ description:,
64
+ logo:,
65
+ login_page_url:,
66
+ approved_callback_urls:,
67
+ permissions_scopes:,
68
+ attributes_scopes:,
69
+ jwt_bearer_settings:,
70
+ custom_attributes:,
71
+ force_pkce:,
72
+ default_audience:
73
+ )
74
+ mgmt_post(THIRD_PARTY_APP_UPDATE_PATH, body)
75
+ end
76
+
77
+ def patch_application(
78
+ id: nil,
79
+ name: nil,
80
+ description: nil,
81
+ logo: nil,
82
+ login_page_url: nil,
83
+ approved_callback_urls: nil,
84
+ permissions_scopes: nil,
85
+ attributes_scopes: nil,
86
+ jwt_bearer_settings: nil,
87
+ custom_attributes: nil,
88
+ force_pkce: nil,
89
+ default_audience: nil
90
+ )
91
+ # Patch an existing third party application. Only the provided fields will be updated.
92
+ body = compose_create_update_body(
93
+ name:,
94
+ id:,
95
+ description:,
96
+ logo:,
97
+ login_page_url:,
98
+ approved_callback_urls:,
99
+ permissions_scopes:,
100
+ attributes_scopes:,
101
+ jwt_bearer_settings:,
102
+ custom_attributes:,
103
+ force_pkce:,
104
+ default_audience:
105
+ )
106
+ mgmt_post(THIRD_PARTY_APP_PATCH_PATH, body)
107
+ end
108
+
109
+ def delete_application(id)
110
+ # Delete an existing third party application. IMPORTANT: This operation is irreversible. Use carefully.
111
+ mgmt_post(THIRD_PARTY_APP_DELETE_PATH, { id: })
112
+ end
113
+
114
+ def load_application(id)
115
+ # Load an existing third party application.
116
+ mgmt_get(THIRD_PARTY_APP_LOAD_PATH, { id: })
117
+ end
118
+
119
+ def load_all_applications
120
+ # Load all third party applications.
121
+ mgmt_get(THIRD_PARTY_APP_LOAD_ALL_PATH, {})
122
+ end
123
+
124
+ def get_application_secret(id)
125
+ # Get the cleartext secret of an existing third party application.
126
+ mgmt_get(THIRD_PARTY_APP_SECRET_PATH, { id: })
127
+ end
128
+
129
+ def rotate_application_secret(id)
130
+ # Rotate the secret of an existing third party application, returning the new cleartext secret.
131
+ mgmt_post(THIRD_PARTY_APP_ROTATE_PATH, { id: })
132
+ end
133
+
134
+ def delete_consents(app_id: nil, consent_ids: nil, user_ids: nil, tenant_id: nil)
135
+ # Delete consents of a third party application.
136
+ body = {}
137
+ body[:consentIds] = consent_ids if consent_ids
138
+ body[:appId] = app_id if app_id
139
+ body[:userIds] = user_ids if user_ids
140
+ body[:tenantId] = tenant_id if tenant_id
141
+ mgmt_post(THIRD_PARTY_APP_DELETE_CONSENTS_PATH, body)
142
+ end
143
+
144
+ def delete_tenant_consents(app_id: nil, consent_ids: nil, tenant_id: nil)
145
+ # Delete consents of a third party application for a specific tenant.
146
+ body = {}
147
+ body[:consentIds] = consent_ids if consent_ids
148
+ body[:appId] = app_id if app_id
149
+ body[:tenantId] = tenant_id if tenant_id
150
+ mgmt_post(THIRD_PARTY_APP_DELETE_TENANT_CONSENTS_PATH, body)
151
+ end
152
+
153
+ private
154
+
155
+ # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
156
+ def compose_create_update_body(
157
+ name: nil,
158
+ id: nil,
159
+ description: nil,
160
+ logo: nil,
161
+ login_page_url: nil,
162
+ approved_callback_urls: nil,
163
+ permissions_scopes: nil,
164
+ attributes_scopes: nil,
165
+ jwt_bearer_settings: nil,
166
+ custom_attributes: nil,
167
+ force_pkce: nil,
168
+ default_audience: nil
169
+ )
170
+ body = {}
171
+ body[:id] = id if id
172
+ body[:name] = name if name
173
+ body[:description] = description if description
174
+ body[:logo] = logo if logo
175
+ body[:loginPageUrl] = login_page_url if login_page_url
176
+ body[:approvedCallbackUrls] = approved_callback_urls if approved_callback_urls
177
+ body[:permissionsScopes] = permissions_scopes if permissions_scopes
178
+ body[:attributesScopes] = attributes_scopes if attributes_scopes
179
+ body[:jwtBearerSettings] = jwt_bearer_settings if jwt_bearer_settings
180
+ body[:customAttributes] = custom_attributes if custom_attributes
181
+ body[:forcePkce] = force_pkce unless force_pkce.nil?
182
+ body[:defaultAudience] = default_audience if default_audience
183
+ body
184
+ end
185
+ # rubocop:enable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
186
+ end
187
+ end
188
+ end
189
+ end
190
+ end