CheckmarxPythonSDK 1.8.1__py3-none-any.whl → 1.8.2__py3-none-any.whl
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.
- CheckmarxPythonSDK/CxAccessControl/AccessControl.py +925 -2051
- CheckmarxPythonSDK/CxAccessControl/accesscontrol/dto/AuthenticationProvider.py +19 -24
- CheckmarxPythonSDK/CxAccessControl/accesscontrol/dto/Configuration.py +15 -9
- CheckmarxPythonSDK/CxAccessControl/accesscontrol/dto/LDAPGroup.py +12 -14
- CheckmarxPythonSDK/CxAccessControl/accesscontrol/dto/LDAPGroupAndRoleMappingDetail.py +11 -19
- CheckmarxPythonSDK/CxAccessControl/accesscontrol/dto/LDAPRoleMapping.py +17 -21
- CheckmarxPythonSDK/CxAccessControl/accesscontrol/dto/LDAPServer.py +69 -94
- CheckmarxPythonSDK/CxAccessControl/accesscontrol/dto/LDAPTeamMapping.py +17 -23
- CheckmarxPythonSDK/CxAccessControl/accesscontrol/dto/MyProfile.py +33 -42
- CheckmarxPythonSDK/CxAccessControl/accesscontrol/dto/OIDCClient.py +67 -94
- CheckmarxPythonSDK/CxAccessControl/accesscontrol/dto/Permission.py +15 -19
- CheckmarxPythonSDK/CxAccessControl/accesscontrol/dto/Role.py +17 -21
- CheckmarxPythonSDK/CxAccessControl/accesscontrol/dto/SAMLIdentityProvider.py +35 -45
- CheckmarxPythonSDK/CxAccessControl/accesscontrol/dto/SAMLRoleMapping.py +18 -22
- CheckmarxPythonSDK/CxAccessControl/accesscontrol/dto/SAMLServiceProvider.py +15 -20
- CheckmarxPythonSDK/CxAccessControl/accesscontrol/dto/SAMLTeamMapping.py +18 -19
- CheckmarxPythonSDK/CxAccessControl/accesscontrol/dto/SMTPSetting.py +22 -27
- CheckmarxPythonSDK/CxAccessControl/accesscontrol/dto/ServiceProvider.py +12 -14
- CheckmarxPythonSDK/CxAccessControl/accesscontrol/dto/SystemLocale.py +15 -19
- CheckmarxPythonSDK/CxAccessControl/accesscontrol/dto/Team.py +15 -20
- CheckmarxPythonSDK/CxAccessControl/accesscontrol/dto/User.py +47 -58
- CheckmarxPythonSDK/CxAccessControl/accesscontrol/dto/WindowsDomain.py +13 -17
- CheckmarxPythonSDK/CxAccessControl/accesscontrol/dto/requests.py +146 -0
- CheckmarxPythonSDK/CxODataApiSDK/ProjectsODataAPI.py +123 -108
- CheckmarxPythonSDK/CxODataApiSDK/ResultsODataAPI.py +97 -81
- CheckmarxPythonSDK/CxODataApiSDK/ScansODataAPI.py +61 -48
- CheckmarxPythonSDK/CxODataApiSDK/Utilities.py +118 -50
- CheckmarxPythonSDK/CxODataApiSDK/config.py +21 -19
- CheckmarxPythonSDK/CxOne/CodeRepositoryProjectImportAPI.py +36 -52
- CheckmarxPythonSDK/CxOne/KeycloakAPI/AttackDetectionApi.py +19 -38
- CheckmarxPythonSDK/CxOne/KeycloakAPI/AuthenticationManagementApi.py +272 -441
- CheckmarxPythonSDK/CxOne/KeycloakAPI/ClientAttributeCertificateApi.py +44 -85
- CheckmarxPythonSDK/CxOne/KeycloakAPI/ClientInitialAccessApi.py +28 -38
- CheckmarxPythonSDK/CxOne/KeycloakAPI/ClientRegistrationPolicyApi.py +8 -15
- CheckmarxPythonSDK/CxOne/KeycloakAPI/ClientRoleMappingsApi.py +114 -161
- CheckmarxPythonSDK/CxOne/KeycloakAPI/ClientRolesApi.py +265 -423
- CheckmarxPythonSDK/CxOne/KeycloakAPI/ClientScopesApi.py +79 -123
- CheckmarxPythonSDK/CxOne/KeycloakAPI/ClientsApi.py +287 -503
- CheckmarxPythonSDK/CxOne/KeycloakAPI/ComponentApi.py +51 -85
- CheckmarxPythonSDK/CxOne/KeycloakAPI/GroupsApi.py +120 -185
- CheckmarxPythonSDK/CxOne/KeycloakAPI/IdentityProvidersApi.py +151 -209
- CheckmarxPythonSDK/CxOne/KeycloakAPI/KeyApi.py +7 -11
- CheckmarxPythonSDK/CxOne/KeycloakAPI/ProtocolMappersApi.py +211 -276
- CheckmarxPythonSDK/CxOne/KeycloakAPI/RealmsAdminApi.py +91 -138
- CheckmarxPythonSDK/CxOne/KeycloakAPI/RoleMapperApi.py +66 -136
- CheckmarxPythonSDK/CxOne/KeycloakAPI/RolesApi.py +173 -344
- CheckmarxPythonSDK/CxOne/KeycloakAPI/RolesByIdApi.py +59 -119
- CheckmarxPythonSDK/CxOne/KeycloakAPI/ScopeMappingsApi.py +165 -438
- CheckmarxPythonSDK/CxOne/KeycloakAPI/UsersApi.py +224 -356
- CheckmarxPythonSDK/CxOne/KeycloakAPI/dto/Access.py +4 -5
- CheckmarxPythonSDK/CxOne/KeycloakAPI/dto/AccessToken.py +57 -56
- CheckmarxPythonSDK/CxOne/KeycloakAPI/dto/AddressClaimSet.py +8 -9
- CheckmarxPythonSDK/CxOne/KeycloakAPI/dto/AdminEventRepresentation.py +14 -13
- CheckmarxPythonSDK/CxOne/KeycloakAPI/dto/ApplicationRepresentation.py +67 -56
- CheckmarxPythonSDK/CxOne/KeycloakAPI/dto/ApplicationRepresentationClaims.py +12 -13
- CheckmarxPythonSDK/CxOne/KeycloakAPI/dto/AuthDetailsRepresentation.py +6 -7
- CheckmarxPythonSDK/CxOne/KeycloakAPI/dto/AuthenticationExecutionExportRepresentation.py +10 -11
- CheckmarxPythonSDK/CxOne/KeycloakAPI/dto/AuthenticationExecutionInfoRepresentation.py +15 -16
- CheckmarxPythonSDK/CxOne/KeycloakAPI/dto/AuthenticationExecutionRepresentation.py +11 -12
- CheckmarxPythonSDK/CxOne/KeycloakAPI/dto/AuthenticationFlowRepresentation.py +22 -16
- CheckmarxPythonSDK/CxOne/KeycloakAPI/dto/AuthenticatorConfigInfoRepresentation.py +10 -10
- CheckmarxPythonSDK/CxOne/KeycloakAPI/dto/AuthenticatorConfigRepresentation.py +5 -6
- CheckmarxPythonSDK/CxOne/KeycloakAPI/dto/Authorization.py +6 -7
- CheckmarxPythonSDK/CxOne/KeycloakAPI/dto/CertificateRepresentation.py +6 -7
- CheckmarxPythonSDK/CxOne/KeycloakAPI/dto/ClaimRepresentation.py +12 -13
- CheckmarxPythonSDK/CxOne/KeycloakAPI/dto/ClientInitialAccessCreatePresentation.py +4 -5
- CheckmarxPythonSDK/CxOne/KeycloakAPI/dto/ClientInitialAccessPresentation.py +8 -9
- CheckmarxPythonSDK/CxOne/KeycloakAPI/dto/ClientMappingsRepresentation.py +8 -9
- CheckmarxPythonSDK/CxOne/KeycloakAPI/dto/ClientPoliciesRepresentation.py +7 -7
- CheckmarxPythonSDK/CxOne/KeycloakAPI/dto/ClientPolicyConditionRepresentation.py +4 -5
- CheckmarxPythonSDK/CxOne/KeycloakAPI/dto/ClientPolicyExecutorRepresentation.py +4 -5
- CheckmarxPythonSDK/CxOne/KeycloakAPI/dto/ClientPolicyRepresentation.py +11 -11
- CheckmarxPythonSDK/CxOne/KeycloakAPI/dto/ClientProfileRepresentation.py +9 -9
- CheckmarxPythonSDK/CxOne/KeycloakAPI/dto/ClientProfilesRepresentation.py +15 -11
- CheckmarxPythonSDK/CxOne/KeycloakAPI/dto/ClientRepresentation.py +62 -53
- CheckmarxPythonSDK/CxOne/KeycloakAPI/dto/ClientScopeRepresentation.py +15 -12
- CheckmarxPythonSDK/CxOne/KeycloakAPI/dto/ClientTemplateRepresentation.py +24 -21
- CheckmarxPythonSDK/CxOne/KeycloakAPI/dto/ComponentExportRepresentation.py +8 -9
- CheckmarxPythonSDK/CxOne/KeycloakAPI/dto/ComponentRepresentation.py +9 -10
- CheckmarxPythonSDK/CxOne/KeycloakAPI/dto/ComponentTypeRepresentation.py +10 -10
- CheckmarxPythonSDK/CxOne/KeycloakAPI/dto/Composites.py +5 -6
- CheckmarxPythonSDK/CxOne/KeycloakAPI/dto/ConfigPropertyRepresentation.py +11 -12
- CheckmarxPythonSDK/CxOne/KeycloakAPI/dto/Confirmation.py +4 -5
- CheckmarxPythonSDK/CxOne/KeycloakAPI/dto/CredentialRepresentation.py +20 -21
- CheckmarxPythonSDK/CxOne/KeycloakAPI/dto/DecisionStrategy.py +2 -3
- CheckmarxPythonSDK/CxOne/KeycloakAPI/dto/EnforcementMode.py +2 -3
- CheckmarxPythonSDK/CxOne/KeycloakAPI/dto/EventRepresentation.py +12 -13
- CheckmarxPythonSDK/CxOne/KeycloakAPI/dto/FederatedIdentityRepresentation.py +5 -6
- CheckmarxPythonSDK/CxOne/KeycloakAPI/dto/GlobalRequestResult.py +4 -5
- CheckmarxPythonSDK/CxOne/KeycloakAPI/dto/GroupRepresentation.py +13 -14
- CheckmarxPythonSDK/CxOne/KeycloakAPI/dto/IDToken.py +42 -43
- CheckmarxPythonSDK/CxOne/KeycloakAPI/dto/IdentityProviderMapperRepresentation.py +7 -8
- CheckmarxPythonSDK/CxOne/KeycloakAPI/dto/IdentityProviderMapperTypeRepresentation.py +11 -11
- CheckmarxPythonSDK/CxOne/KeycloakAPI/dto/IdentityProviderRepresentation.py +18 -19
- CheckmarxPythonSDK/CxOne/KeycloakAPI/dto/InstallationAdapterConfig.py +21 -17
- CheckmarxPythonSDK/CxOne/KeycloakAPI/dto/KeyMetadataRepresentation.py +14 -15
- CheckmarxPythonSDK/CxOne/KeycloakAPI/dto/KeyStoreConfig.py +8 -9
- CheckmarxPythonSDK/CxOne/KeycloakAPI/dto/KeyUse.py +2 -3
- CheckmarxPythonSDK/CxOne/KeycloakAPI/dto/KeysMetadataRepresentation.py +7 -8
- CheckmarxPythonSDK/CxOne/KeycloakAPI/dto/Logic.py +2 -3
- CheckmarxPythonSDK/CxOne/KeycloakAPI/dto/ManagementPermissionReference.py +5 -6
- CheckmarxPythonSDK/CxOne/KeycloakAPI/dto/MappingsRepresentation.py +8 -8
- CheckmarxPythonSDK/CxOne/KeycloakAPI/dto/MethodConfig.py +12 -9
- CheckmarxPythonSDK/CxOne/KeycloakAPI/dto/OAuthClientRepresentation.py +67 -56
- CheckmarxPythonSDK/CxOne/KeycloakAPI/dto/PathCacheConfig.py +4 -5
- CheckmarxPythonSDK/CxOne/KeycloakAPI/dto/PathConfig.py +23 -19
- CheckmarxPythonSDK/CxOne/KeycloakAPI/dto/PathSegment.py +4 -5
- CheckmarxPythonSDK/CxOne/KeycloakAPI/dto/Permission.py +6 -7
- CheckmarxPythonSDK/CxOne/KeycloakAPI/dto/PolicyEnforcementMode.py +2 -3
- CheckmarxPythonSDK/CxOne/KeycloakAPI/dto/PolicyEnforcerConfig.py +28 -22
- CheckmarxPythonSDK/CxOne/KeycloakAPI/dto/PolicyRepresentation.py +32 -26
- CheckmarxPythonSDK/CxOne/KeycloakAPI/dto/ProtocolMapperEvaluationRepresentation.py +8 -9
- CheckmarxPythonSDK/CxOne/KeycloakAPI/dto/ProtocolMapperRepresentation.py +9 -10
- CheckmarxPythonSDK/CxOne/KeycloakAPI/dto/PublishedRealmRepresentation.py +7 -8
- CheckmarxPythonSDK/CxOne/KeycloakAPI/dto/RealmEventsConfigRepresentation.py +8 -9
- CheckmarxPythonSDK/CxOne/KeycloakAPI/dto/RealmRepresentation.py +280 -211
- CheckmarxPythonSDK/CxOne/KeycloakAPI/dto/RequiredActionProviderRepresentation.py +9 -10
- CheckmarxPythonSDK/CxOne/KeycloakAPI/dto/ResourceOwnerRepresentation.py +4 -5
- CheckmarxPythonSDK/CxOne/KeycloakAPI/dto/ResourceRepresentation.py +24 -23
- CheckmarxPythonSDK/CxOne/KeycloakAPI/dto/ResourceRepresentationOwner.py +4 -5
- CheckmarxPythonSDK/CxOne/KeycloakAPI/dto/ResourceServerRepresentation.py +35 -26
- CheckmarxPythonSDK/CxOne/KeycloakAPI/dto/RoleRepresentation.py +13 -14
- CheckmarxPythonSDK/CxOne/KeycloakAPI/dto/RolesRepresentation.py +8 -9
- CheckmarxPythonSDK/CxOne/KeycloakAPI/dto/ScopeEnforcementMode.py +2 -3
- CheckmarxPythonSDK/CxOne/KeycloakAPI/dto/ScopeMappingRepresentation.py +7 -8
- CheckmarxPythonSDK/CxOne/KeycloakAPI/dto/ScopeRepresentation.py +6 -8
- CheckmarxPythonSDK/CxOne/KeycloakAPI/dto/SocialLinkRepresentation.py +5 -6
- CheckmarxPythonSDK/CxOne/KeycloakAPI/dto/UPAttribute.py +22 -17
- CheckmarxPythonSDK/CxOne/KeycloakAPI/dto/UPAttributePermissions.py +4 -5
- CheckmarxPythonSDK/CxOne/KeycloakAPI/dto/UPAttributeRequired.py +4 -5
- CheckmarxPythonSDK/CxOne/KeycloakAPI/dto/UPAttributeSelector.py +3 -4
- CheckmarxPythonSDK/CxOne/KeycloakAPI/dto/UPConfig.py +10 -11
- CheckmarxPythonSDK/CxOne/KeycloakAPI/dto/UPGroup.py +6 -7
- CheckmarxPythonSDK/CxOne/KeycloakAPI/dto/UserConsentRepresentation.py +7 -8
- CheckmarxPythonSDK/CxOne/KeycloakAPI/dto/UserFederationMapperRepresentation.py +7 -8
- CheckmarxPythonSDK/CxOne/KeycloakAPI/dto/UserFederationProviderRepresentation.py +10 -11
- CheckmarxPythonSDK/CxOne/KeycloakAPI/dto/UserProfileAttributeGroupMetadata.py +6 -7
- CheckmarxPythonSDK/CxOne/KeycloakAPI/dto/UserProfileAttributeMetadata.py +10 -11
- CheckmarxPythonSDK/CxOne/KeycloakAPI/dto/UserProfileMetadata.py +12 -11
- CheckmarxPythonSDK/CxOne/KeycloakAPI/dto/UserRepresentation.py +58 -44
- CheckmarxPythonSDK/CxOne/KeycloakAPI/dto/UserSessionRepresentation.py +10 -11
- CheckmarxPythonSDK/CxOne/KeycloakAPI/dto/__init__.py +12 -4
- CheckmarxPythonSDK/CxOne/__init__.py +8 -7
- CheckmarxPythonSDK/CxOne/accessControlAPI.py +65 -110
- CheckmarxPythonSDK/CxOne/accessManagementAPI.py +670 -1104
- CheckmarxPythonSDK/CxOne/apisecAPI.py +309 -143
- CheckmarxPythonSDK/CxOne/applicationsAPI.py +132 -122
- CheckmarxPythonSDK/CxOne/auditTrailAPI.py +28 -26
- CheckmarxPythonSDK/CxOne/byorResultsHandlerAPI.py +23 -22
- CheckmarxPythonSDK/CxOne/byorResultsHandlerV2API.py +25 -22
- CheckmarxPythonSDK/CxOne/cloudInsightsServiceAPI.py +217 -124
- CheckmarxPythonSDK/CxOne/config.py +27 -24
- CheckmarxPythonSDK/CxOne/contributorsAPI.py +49 -31
- CheckmarxPythonSDK/CxOne/customStateAPI.py +33 -33
- CheckmarxPythonSDK/CxOne/dto/AccessToken.py +95 -192
- CheckmarxPythonSDK/CxOne/dto/AccessTokenAccess.py +12 -21
- CheckmarxPythonSDK/CxOne/dto/AccessTokenAuthorization.py +9 -16
- CheckmarxPythonSDK/CxOne/dto/AccessTokenCertConf.py +9 -17
- CheckmarxPythonSDK/CxOne/dto/AddAssignmentRoles.py +3 -18
- CheckmarxPythonSDK/CxOne/dto/AddressClaimSet.py +19 -36
- CheckmarxPythonSDK/CxOne/dto/ApiSecCounters.py +15 -15
- CheckmarxPythonSDK/CxOne/dto/Application.py +14 -16
- CheckmarxPythonSDK/CxOne/dto/ApplicationInput.py +0 -20
- CheckmarxPythonSDK/CxOne/dto/ApplicationsCollection.py +10 -10
- CheckmarxPythonSDK/CxOne/dto/Assignment.py +16 -17
- CheckmarxPythonSDK/CxOne/dto/AssignmentInput.py +10 -18
- CheckmarxPythonSDK/CxOne/dto/AssignmentsForResource.py +10 -9
- CheckmarxPythonSDK/CxOne/dto/AssignmentsWithBaseRoles.py +22 -23
- CheckmarxPythonSDK/CxOne/dto/AstIdWithName.py +14 -14
- CheckmarxPythonSDK/CxOne/dto/AstUser.py +18 -18
- CheckmarxPythonSDK/CxOne/dto/AsyncRequestResponse.py +3 -10
- CheckmarxPythonSDK/CxOne/dto/AuditEvent.py +11 -11
- CheckmarxPythonSDK/CxOne/dto/AuditEventLink.py +7 -7
- CheckmarxPythonSDK/CxOne/dto/AuditEvents.py +12 -12
- CheckmarxPythonSDK/CxOne/dto/AuditQuery.py +0 -6
- CheckmarxPythonSDK/CxOne/dto/AuthenticationExecutionExportRepresentation.py +21 -41
- CheckmarxPythonSDK/CxOne/dto/AuthenticationExecutionInfoRepresentation.py +33 -66
- CheckmarxPythonSDK/CxOne/dto/AuthenticationExecutionRepresentation.py +23 -45
- CheckmarxPythonSDK/CxOne/dto/AuthenticationFlowRepresentation.py +21 -41
- CheckmarxPythonSDK/CxOne/dto/AuthenticatorConfigInfoRepresentation.py +15 -28
- CheckmarxPythonSDK/CxOne/dto/AuthenticatorConfigRepresentation.py +13 -24
- CheckmarxPythonSDK/CxOne/dto/BaseRolesRequest.py +1 -6
- CheckmarxPythonSDK/CxOne/dto/BaseRolesResponse.py +7 -7
- CheckmarxPythonSDK/CxOne/dto/BflTree.py +10 -20
- CheckmarxPythonSDK/CxOne/dto/ByorJob.py +9 -9
- CheckmarxPythonSDK/CxOne/dto/ByorJobPatchRequest.py +0 -11
- CheckmarxPythonSDK/CxOne/dto/Category.py +7 -15
- CheckmarxPythonSDK/CxOne/dto/CategoryType.py +10 -21
- CheckmarxPythonSDK/CxOne/dto/CertificateRepresentation.py +15 -28
- CheckmarxPythonSDK/CxOne/dto/ChangeDetails.py +5 -16
- CheckmarxPythonSDK/CxOne/dto/Client.py +35 -32
- CheckmarxPythonSDK/CxOne/dto/ClientInitialAccessCreatePresentation.py +12 -21
- CheckmarxPythonSDK/CxOne/dto/ClientInitialAccessPresentation.py +19 -36
- CheckmarxPythonSDK/CxOne/dto/ClientMappingsRepresentation.py +13 -24
- CheckmarxPythonSDK/CxOne/dto/ClientPoliciesRepresentation.py +9 -16
- CheckmarxPythonSDK/CxOne/dto/ClientPolicyConditionRepresentation.py +12 -21
- CheckmarxPythonSDK/CxOne/dto/ClientPolicyExecutorRepresentation.py +12 -21
- CheckmarxPythonSDK/CxOne/dto/ClientPolicyRepresentation.py +17 -32
- CheckmarxPythonSDK/CxOne/dto/ClientProfileRepresentation.py +13 -24
- CheckmarxPythonSDK/CxOne/dto/ClientProfilesRepresentation.py +12 -21
- CheckmarxPythonSDK/CxOne/dto/ClientRepresentation.py +87 -171
- CheckmarxPythonSDK/CxOne/dto/ClientScopeEvaluateResourceProtocolMapperEvaluationRepresentation.py +21 -36
- CheckmarxPythonSDK/CxOne/dto/ClientScopeRepresentation.py +19 -36
- CheckmarxPythonSDK/CxOne/dto/ClientWithResource.py +19 -18
- CheckmarxPythonSDK/CxOne/dto/ClientsWithResourcesResponse.py +10 -10
- CheckmarxPythonSDK/CxOne/dto/CloudInsightAccount.py +8 -8
- CheckmarxPythonSDK/CxOne/dto/CloudInsightAccountLog.py +13 -13
- CheckmarxPythonSDK/CxOne/dto/CloudInsightContainer.py +11 -11
- CheckmarxPythonSDK/CxOne/dto/CloudInsightCreateEnrichAccount.py +1 -7
- CheckmarxPythonSDK/CxOne/dto/CloudInsightEnrichAccount.py +5 -5
- CheckmarxPythonSDK/CxOne/dto/CommentJSON.py +0 -10
- CheckmarxPythonSDK/CxOne/dto/CompilationResponse.py +0 -6
- CheckmarxPythonSDK/CxOne/dto/ComplianceSummary.py +1 -7
- CheckmarxPythonSDK/CxOne/dto/ComponentExportRepresentation.py +19 -36
- CheckmarxPythonSDK/CxOne/dto/ComponentRepresentation.py +21 -40
- CheckmarxPythonSDK/CxOne/dto/Composites.py +0 -8
- CheckmarxPythonSDK/CxOne/dto/ConfigPropertyRepresentation.py +21 -40
- CheckmarxPythonSDK/CxOne/dto/ContributorInsights.py +12 -12
- CheckmarxPythonSDK/CxOne/dto/ContributorScmInsights.py +6 -6
- CheckmarxPythonSDK/CxOne/dto/ContributorUnfamiliarProjects.py +4 -6
- CheckmarxPythonSDK/CxOne/dto/Contributors.py +6 -7
- CheckmarxPythonSDK/CxOne/dto/CreateRoleRequest.py +0 -7
- CheckmarxPythonSDK/CxOne/dto/CreatedApplication.py +13 -16
- CheckmarxPythonSDK/CxOne/dto/CredentialRepresentation.py +0 -45
- CheckmarxPythonSDK/CxOne/dto/Credentials.py +1 -7
- CheckmarxPythonSDK/CxOne/dto/CustomState.py +8 -8
- CheckmarxPythonSDK/CxOne/dto/DebugMessage.py +0 -8
- CheckmarxPythonSDK/CxOne/dto/DebugMessageResponse.py +6 -6
- CheckmarxPythonSDK/CxOne/dto/DefaultConfig.py +3 -17
- CheckmarxPythonSDK/CxOne/dto/DefaultConfigOut.py +16 -36
- CheckmarxPythonSDK/CxOne/dto/EffectivePermissionsForResourceResponse.py +9 -9
- CheckmarxPythonSDK/CxOne/dto/EngineData.py +15 -14
- CheckmarxPythonSDK/CxOne/dto/EngineMetrics.py +26 -38
- CheckmarxPythonSDK/CxOne/dto/EntitiesForExtendedResponse.py +11 -10
- CheckmarxPythonSDK/CxOne/dto/EntityRolesRequest.py +2 -6
- CheckmarxPythonSDK/CxOne/dto/Error.py +0 -8
- CheckmarxPythonSDK/CxOne/dto/ExecutionResponse.py +0 -8
- CheckmarxPythonSDK/CxOne/dto/FederatedIdentityRepresentation.py +0 -15
- CheckmarxPythonSDK/CxOne/dto/FileInfo.py +12 -12
- CheckmarxPythonSDK/CxOne/dto/Flag.py +12 -12
- CheckmarxPythonSDK/CxOne/dto/GPTMessage.py +3 -6
- CheckmarxPythonSDK/CxOne/dto/Git.py +3 -16
- CheckmarxPythonSDK/CxOne/dto/GlobalRequestResult.py +12 -21
- CheckmarxPythonSDK/CxOne/dto/Group.py +8 -8
- CheckmarxPythonSDK/CxOne/dto/GroupRepresentation.py +7 -7
- CheckmarxPythonSDK/CxOne/dto/GroupWithResource.py +27 -27
- CheckmarxPythonSDK/CxOne/dto/GroupsResponse.py +9 -9
- CheckmarxPythonSDK/CxOne/dto/GroupsWithResourcesResponse.py +8 -10
- CheckmarxPythonSDK/CxOne/dto/IDToken.py +83 -167
- CheckmarxPythonSDK/CxOne/dto/IdentityProviderMapperRepresentation.py +17 -33
- CheckmarxPythonSDK/CxOne/dto/IdentityProviderRepresentation.py +31 -62
- CheckmarxPythonSDK/CxOne/dto/ImportItem.py +10 -17
- CheckmarxPythonSDK/CxOne/dto/ImportItemWithLogs.py +13 -23
- CheckmarxPythonSDK/CxOne/dto/ImportRequest.py +4 -16
- CheckmarxPythonSDK/CxOne/dto/ImportResults.py +5 -12
- CheckmarxPythonSDK/CxOne/dto/InternalClient.py +7 -7
- CheckmarxPythonSDK/CxOne/dto/InternalGroup.py +6 -6
- CheckmarxPythonSDK/CxOne/dto/InternalUser.py +8 -8
- CheckmarxPythonSDK/CxOne/dto/JsonNode.py +51 -102
- CheckmarxPythonSDK/CxOne/dto/KeyStoreConfig.py +19 -37
- CheckmarxPythonSDK/CxOne/dto/KeysMetadataRepresentation.py +12 -21
- CheckmarxPythonSDK/CxOne/dto/KeysMetadataRepresentationKeyMetadataRepresentation.py +29 -49
- CheckmarxPythonSDK/CxOne/dto/KicsCounters.py +24 -41
- CheckmarxPythonSDK/CxOne/dto/KicsResult.py +40 -42
- CheckmarxPythonSDK/CxOne/dto/KicsResultCollection.py +7 -9
- CheckmarxPythonSDK/CxOne/dto/LanguageSummary.py +1 -7
- CheckmarxPythonSDK/CxOne/dto/LogItem.py +16 -26
- CheckmarxPythonSDK/CxOne/dto/ManagementPermissionReference.py +13 -33
- CheckmarxPythonSDK/CxOne/dto/MappingsRepresentation.py +12 -21
- CheckmarxPythonSDK/CxOne/dto/MemoryInfoRepresentation.py +21 -40
- CheckmarxPythonSDK/CxOne/dto/Metadata.py +12 -12
- CheckmarxPythonSDK/CxOne/dto/MethodInfo.py +22 -33
- CheckmarxPythonSDK/CxOne/dto/MethodParameter.py +8 -7
- CheckmarxPythonSDK/CxOne/dto/MultipleAssignmentInput.py +6 -15
- CheckmarxPythonSDK/CxOne/dto/MultivaluedHashMap.py +13 -24
- CheckmarxPythonSDK/CxOne/dto/PaginatedAccountLogsListResponse.py +12 -11
- CheckmarxPythonSDK/CxOne/dto/PaginatedAccountsListResponse.py +9 -11
- CheckmarxPythonSDK/CxOne/dto/PaginatedContainersListResponse.py +9 -11
- CheckmarxPythonSDK/CxOne/dto/PaginatedResourcesList.py +9 -11
- CheckmarxPythonSDK/CxOne/dto/PartialImportRepresentation.py +21 -40
- CheckmarxPythonSDK/CxOne/dto/PasswordPolicyTypeRepresentation.py +17 -33
- CheckmarxPythonSDK/CxOne/dto/Permission.py +9 -9
- CheckmarxPythonSDK/CxOne/dto/PlatformSummary.py +1 -7
- CheckmarxPythonSDK/CxOne/dto/PolicyRepresentation.py +33 -65
- CheckmarxPythonSDK/CxOne/dto/Predicate.py +0 -15
- CheckmarxPythonSDK/CxOne/dto/PredicateHistory.py +1 -12
- CheckmarxPythonSDK/CxOne/dto/PredicateWithCommentJSON.py +1 -17
- CheckmarxPythonSDK/CxOne/dto/PredicateWithCommentsJSON.py +2 -20
- CheckmarxPythonSDK/CxOne/dto/Preset.py +9 -18
- CheckmarxPythonSDK/CxOne/dto/PresetPaged.py +10 -18
- CheckmarxPythonSDK/CxOne/dto/PresetSummary.py +12 -23
- CheckmarxPythonSDK/CxOne/dto/ProfileInfoRepresentation.py +15 -28
- CheckmarxPythonSDK/CxOne/dto/Project.py +27 -32
- CheckmarxPythonSDK/CxOne/dto/ProjectCounter.py +7 -10
- CheckmarxPythonSDK/CxOne/dto/ProjectInput.py +5 -22
- CheckmarxPythonSDK/CxOne/dto/ProjectResponseCollection.py +10 -10
- CheckmarxPythonSDK/CxOne/dto/ProjectResponseModel.py +30 -30
- CheckmarxPythonSDK/CxOne/dto/ProjectSettings.py +6 -20
- CheckmarxPythonSDK/CxOne/dto/ProjectsCollection.py +5 -7
- CheckmarxPythonSDK/CxOne/dto/Property.py +3 -12
- CheckmarxPythonSDK/CxOne/dto/ProtocolMapperRepresentation.py +17 -32
- CheckmarxPythonSDK/CxOne/dto/ProtocolMappersRepresentation.py +10 -10
- CheckmarxPythonSDK/CxOne/dto/ProviderRepresentation.py +12 -21
- CheckmarxPythonSDK/CxOne/dto/Queries.py +13 -11
- CheckmarxPythonSDK/CxOne/dto/QueriesResponse.py +7 -14
- CheckmarxPythonSDK/CxOne/dto/QueriesTree.py +8 -10
- CheckmarxPythonSDK/CxOne/dto/Query.py +16 -15
- CheckmarxPythonSDK/CxOne/dto/QueryBuilderMessage.py +3 -6
- CheckmarxPythonSDK/CxOne/dto/QueryBuilderPrompt.py +0 -5
- CheckmarxPythonSDK/CxOne/dto/QueryDescription.py +22 -32
- CheckmarxPythonSDK/CxOne/dto/QueryDescriptionSampleCode.py +10 -17
- CheckmarxPythonSDK/CxOne/dto/QueryDetails.py +20 -32
- CheckmarxPythonSDK/CxOne/dto/QueryRequest.py +1 -10
- CheckmarxPythonSDK/CxOne/dto/QueryResponse.py +11 -11
- CheckmarxPythonSDK/CxOne/dto/QueryResult.py +6 -6
- CheckmarxPythonSDK/CxOne/dto/QuerySearch.py +8 -10
- CheckmarxPythonSDK/CxOne/dto/QuerySummary.py +1 -9
- CheckmarxPythonSDK/CxOne/dto/RealmEventsConfigRepresentation.py +19 -37
- CheckmarxPythonSDK/CxOne/dto/RealmRepresentation.py +303 -545
- CheckmarxPythonSDK/CxOne/dto/RequestStatus.py +7 -7
- CheckmarxPythonSDK/CxOne/dto/RequestStatusDetectLanguages.py +0 -7
- CheckmarxPythonSDK/CxOne/dto/RequestStatusNotReady.py +0 -7
- CheckmarxPythonSDK/CxOne/dto/RequiredActionProviderRepresentation.py +21 -40
- CheckmarxPythonSDK/CxOne/dto/Resource.py +15 -15
- CheckmarxPythonSDK/CxOne/dto/ResourceRepresentation.py +25 -49
- CheckmarxPythonSDK/CxOne/dto/ResourceServerRepresentation.py +25 -49
- CheckmarxPythonSDK/CxOne/dto/ResourcesResponse.py +12 -11
- CheckmarxPythonSDK/CxOne/dto/Result.py +36 -58
- CheckmarxPythonSDK/CxOne/dto/ResultNode.py +23 -36
- CheckmarxPythonSDK/CxOne/dto/ResultResponse.py +17 -34
- CheckmarxPythonSDK/CxOne/dto/ResultsResponse.py +7 -9
- CheckmarxPythonSDK/CxOne/dto/ResultsSummary.py +28 -35
- CheckmarxPythonSDK/CxOne/dto/ResultsSummaryTree.py +9 -11
- CheckmarxPythonSDK/CxOne/dto/Role.py +14 -14
- CheckmarxPythonSDK/CxOne/dto/RoleRepresentation.py +0 -30
- CheckmarxPythonSDK/CxOne/dto/RoleRepresentationComposites.py +0 -13
- CheckmarxPythonSDK/CxOne/dto/RoleWithDetails.py +17 -19
- CheckmarxPythonSDK/CxOne/dto/RolesRepresentation.py +12 -21
- CheckmarxPythonSDK/CxOne/dto/Rule.py +10 -13
- CheckmarxPythonSDK/CxOne/dto/RuleInput.py +1 -6
- CheckmarxPythonSDK/CxOne/dto/SCMImportInput.py +4 -15
- CheckmarxPythonSDK/CxOne/dto/SastCounters.py +18 -38
- CheckmarxPythonSDK/CxOne/dto/SastResult.py +27 -60
- CheckmarxPythonSDK/CxOne/dto/SastScan.py +20 -33
- CheckmarxPythonSDK/CxOne/dto/SastStatus.py +3 -6
- CheckmarxPythonSDK/CxOne/dto/ScaContainersCounters.py +20 -30
- CheckmarxPythonSDK/CxOne/dto/ScaCounters.py +20 -36
- CheckmarxPythonSDK/CxOne/dto/ScaPackageCounters.py +28 -45
- CheckmarxPythonSDK/CxOne/dto/Scan.py +43 -65
- CheckmarxPythonSDK/CxOne/dto/ScanConfig.py +1 -10
- CheckmarxPythonSDK/CxOne/dto/ScanEngineVersion.py +12 -20
- CheckmarxPythonSDK/CxOne/dto/ScanInfo.py +30 -48
- CheckmarxPythonSDK/CxOne/dto/ScanInfoCollection.py +12 -21
- CheckmarxPythonSDK/CxOne/dto/ScanInput.py +1 -11
- CheckmarxPythonSDK/CxOne/dto/ScanParameter.py +20 -49
- CheckmarxPythonSDK/CxOne/dto/Scanner.py +4 -12
- CheckmarxPythonSDK/CxOne/dto/ScansCollection.py +12 -21
- CheckmarxPythonSDK/CxOne/dto/Scm.py +6 -20
- CheckmarxPythonSDK/CxOne/dto/ScmOrganization.py +4 -10
- CheckmarxPythonSDK/CxOne/dto/ScmProject.py +10 -22
- CheckmarxPythonSDK/CxOne/dto/ScopeMappingRepresentation.py +15 -28
- CheckmarxPythonSDK/CxOne/dto/ScopePermissions.py +17 -33
- CheckmarxPythonSDK/CxOne/dto/ScopeRepresentation.py +19 -36
- CheckmarxPythonSDK/CxOne/dto/ServerInfoRepresentation.py +35 -70
- CheckmarxPythonSDK/CxOne/dto/Session.py +17 -13
- CheckmarxPythonSDK/CxOne/dto/SessionRequest.py +3 -15
- CheckmarxPythonSDK/CxOne/dto/SessionResponse.py +7 -7
- CheckmarxPythonSDK/CxOne/dto/Sessions.py +9 -11
- CheckmarxPythonSDK/CxOne/dto/SeverityCounter.py +9 -9
- CheckmarxPythonSDK/CxOne/dto/SeveritySummary.py +1 -7
- CheckmarxPythonSDK/CxOne/dto/SinkFileSummary.py +1 -7
- CheckmarxPythonSDK/CxOne/dto/SinkNodeSummary.py +1 -7
- CheckmarxPythonSDK/CxOne/dto/SocialLinkRepresentation.py +0 -15
- CheckmarxPythonSDK/CxOne/dto/SourceFileSummary.py +1 -7
- CheckmarxPythonSDK/CxOne/dto/SourceNodeSummary.py +1 -7
- CheckmarxPythonSDK/CxOne/dto/SourcesTree.py +0 -11
- CheckmarxPythonSDK/CxOne/dto/SpiInfoRepresentation.py +12 -21
- CheckmarxPythonSDK/CxOne/dto/StartEnrich.py +2 -6
- CheckmarxPythonSDK/CxOne/dto/StatusDetails.py +28 -22
- CheckmarxPythonSDK/CxOne/dto/StatusSummary.py +1 -7
- CheckmarxPythonSDK/CxOne/dto/StrEnum.py +1 -1
- CheckmarxPythonSDK/CxOne/dto/SubCheck.py +8 -8
- CheckmarxPythonSDK/CxOne/dto/SubsetScan.py +15 -14
- CheckmarxPythonSDK/CxOne/dto/SynchronizationResult.py +19 -36
- CheckmarxPythonSDK/CxOne/dto/SystemInfoRepresentation.py +43 -86
- CheckmarxPythonSDK/CxOne/dto/TaskInfo.py +10 -17
- CheckmarxPythonSDK/CxOne/dto/TestLdapConnectionRepresentation.py +25 -49
- CheckmarxPythonSDK/CxOne/dto/TotalCounters.py +9 -8
- CheckmarxPythonSDK/CxOne/dto/Tree.py +13 -23
- CheckmarxPythonSDK/CxOne/dto/TriageRequest.py +2 -19
- CheckmarxPythonSDK/CxOne/dto/TriageResponse.py +8 -16
- CheckmarxPythonSDK/CxOne/dto/Upload.py +5 -12
- CheckmarxPythonSDK/CxOne/dto/User.py +15 -15
- CheckmarxPythonSDK/CxOne/dto/UserConsentRepresentation.py +0 -19
- CheckmarxPythonSDK/CxOne/dto/UserFederationMapperRepresentation.py +0 -19
- CheckmarxPythonSDK/CxOne/dto/UserFederationProviderRepresentation.py +0 -25
- CheckmarxPythonSDK/CxOne/dto/UserProfileAttributeGroupMetadata.py +0 -17
- CheckmarxPythonSDK/CxOne/dto/UserProfileAttributeMetadata.py +0 -23
- CheckmarxPythonSDK/CxOne/dto/UserProfileMetadata.py +2 -16
- CheckmarxPythonSDK/CxOne/dto/UserRepresentation.py +5 -71
- CheckmarxPythonSDK/CxOne/dto/UserWithResource.py +24 -25
- CheckmarxPythonSDK/CxOne/dto/UsersWithResourcesResponse.py +8 -10
- CheckmarxPythonSDK/CxOne/dto/VersionsOut.py +10 -9
- CheckmarxPythonSDK/CxOne/dto/WebError.py +0 -8
- CheckmarxPythonSDK/CxOne/dto/WebHook.py +13 -14
- CheckmarxPythonSDK/CxOne/dto/WebHookConfig.py +13 -20
- CheckmarxPythonSDK/CxOne/dto/WebHookInput.py +4 -11
- CheckmarxPythonSDK/CxOne/dto/WebHooksCollection.py +9 -11
- CheckmarxPythonSDK/CxOne/dto/WorkspaceQuery.py +1 -7
- CheckmarxPythonSDK/CxOne/dto/__init__.py +182 -172
- CheckmarxPythonSDK/CxOne/flagsAPI.py +15 -30
- CheckmarxPythonSDK/CxOne/healthCheckServiceAPI.py +29 -37
- CheckmarxPythonSDK/CxOne/kicsResultsAPI.py +58 -60
- CheckmarxPythonSDK/CxOne/logsAPI.py +44 -0
- CheckmarxPythonSDK/CxOne/projectsAPI.py +305 -551
- CheckmarxPythonSDK/CxOne/projectsOverviewAPI.py +145 -110
- CheckmarxPythonSDK/CxOne/queryEditorAPI.py +323 -179
- CheckmarxPythonSDK/CxOne/repoManagerAPI.py +89 -75
- CheckmarxPythonSDK/CxOne/repoStoreServiceAPI.py +86 -67
- CheckmarxPythonSDK/CxOne/reportAPI.py +111 -93
- CheckmarxPythonSDK/CxOne/resultsSummaryAPI.py +49 -50
- CheckmarxPythonSDK/CxOne/sastBestFixLocationAPI.py +57 -50
- CheckmarxPythonSDK/CxOne/sastMigrationAPI.py +48 -46
- CheckmarxPythonSDK/CxOne/sastQueriesAPI.py +55 -62
- CheckmarxPythonSDK/CxOne/sastQueriesAuditAPI.py +192 -135
- CheckmarxPythonSDK/CxOne/sastQueriesAuditPresetsAPI.py +143 -145
- CheckmarxPythonSDK/CxOne/sastResourceManagementServiceAPI.py +41 -52
- CheckmarxPythonSDK/CxOne/sastResultsAPI.py +215 -171
- CheckmarxPythonSDK/CxOne/sastResultsPredicatesAPI.py +127 -32
- CheckmarxPythonSDK/CxOne/sastResultsSummaryAPI.py +156 -101
- CheckmarxPythonSDK/CxOne/sastScanMetadataServiceAPI.py +53 -49
- CheckmarxPythonSDK/CxOne/scanConfigurationAPI.py +175 -146
- CheckmarxPythonSDK/CxOne/scannersResultsAPI.py +52 -45
- CheckmarxPythonSDK/CxOne/scansAPI.py +317 -256
- CheckmarxPythonSDK/CxOne/uploadsAPI.py +23 -16
- CheckmarxPythonSDK/CxOne/versionsAPI.py +13 -10
- CheckmarxPythonSDK/CxOne/webhookAPI.py +73 -43
- CheckmarxPythonSDK/CxPortalSoapApiSDK/CxAuditWebService.py +94 -69
- CheckmarxPythonSDK/CxPortalSoapApiSDK/CxPortalWebService.py +578 -360
- CheckmarxPythonSDK/CxPortalSoapApiSDK/config.py +21 -19
- CheckmarxPythonSDK/CxPortalSoapApiSDK/sudsClient.py +116 -0
- CheckmarxPythonSDK/CxReporting/api.py +17 -10
- CheckmarxPythonSDK/CxReporting/config.py +4 -5
- CheckmarxPythonSDK/CxReporting/dto/CreateReportDTO.py +25 -16
- CheckmarxPythonSDK/CxReporting/dto/CreateReportResponseDTO.py +1 -3
- CheckmarxPythonSDK/CxReporting/dto/FilterDTO.py +3 -1
- CheckmarxPythonSDK/CxReporting/dto/ReportStatusDTO.py +1 -1
- CheckmarxPythonSDK/CxRestAPISDK/AccessControlAPI.py +1 -2
- CheckmarxPythonSDK/CxRestAPISDK/ConfigurationAPI.py +25 -20
- CheckmarxPythonSDK/CxRestAPISDK/CustomFieldsAPI.py +6 -9
- CheckmarxPythonSDK/CxRestAPISDK/CustomTasksAPI.py +23 -47
- CheckmarxPythonSDK/CxRestAPISDK/CxSastXML/dto/CxXMLResults.py +48 -102
- CheckmarxPythonSDK/CxRestAPISDK/CxSastXML/dto/Line.py +6 -18
- CheckmarxPythonSDK/CxRestAPISDK/CxSastXML/dto/Path.py +14 -30
- CheckmarxPythonSDK/CxRestAPISDK/CxSastXML/dto/PathNode.py +12 -51
- CheckmarxPythonSDK/CxRestAPISDK/CxSastXML/dto/Query.py +34 -69
- CheckmarxPythonSDK/CxRestAPISDK/CxSastXML/dto/Result.py +38 -78
- CheckmarxPythonSDK/CxRestAPISDK/CxSastXML/dto/Snippet.py +5 -13
- CheckmarxPythonSDK/CxRestAPISDK/CxSastXML/dto/__init__.py +7 -7
- CheckmarxPythonSDK/CxRestAPISDK/CxSastXML/xml_results.py +17 -63
- CheckmarxPythonSDK/CxRestAPISDK/DataRetentionAPI.py +42 -54
- CheckmarxPythonSDK/CxRestAPISDK/EnginesAPI.py +118 -115
- CheckmarxPythonSDK/CxRestAPISDK/GeneralAPI.py +115 -78
- CheckmarxPythonSDK/CxRestAPISDK/OsaAPI.py +119 -184
- CheckmarxPythonSDK/CxRestAPISDK/ProjectsAPI.py +419 -410
- CheckmarxPythonSDK/CxRestAPISDK/QueriesAPI.py +53 -14
- CheckmarxPythonSDK/CxRestAPISDK/ScansAPI.py +423 -575
- CheckmarxPythonSDK/CxRestAPISDK/TeamAPI.py +13 -17
- CheckmarxPythonSDK/CxRestAPISDK/__init__.py +4 -4
- CheckmarxPythonSDK/CxRestAPISDK/config.py +21 -19
- CheckmarxPythonSDK/CxRestAPISDK/osa/dto/CxOsaLibrary.py +60 -66
- CheckmarxPythonSDK/CxRestAPISDK/osa/dto/CxOsaLicense.py +29 -34
- CheckmarxPythonSDK/CxRestAPISDK/osa/dto/CxOsaLocation.py +12 -12
- CheckmarxPythonSDK/CxRestAPISDK/osa/dto/CxOsaMatchType.py +13 -14
- CheckmarxPythonSDK/CxRestAPISDK/osa/dto/CxOsaScanDetail.py +26 -27
- CheckmarxPythonSDK/CxRestAPISDK/osa/dto/CxOsaSeverity.py +11 -13
- CheckmarxPythonSDK/CxRestAPISDK/osa/dto/CxOsaState.py +13 -14
- CheckmarxPythonSDK/CxRestAPISDK/osa/dto/CxOsaSummaryReport.py +29 -42
- CheckmarxPythonSDK/CxRestAPISDK/osa/dto/CxOsaVulnerability.py +37 -43
- CheckmarxPythonSDK/CxRestAPISDK/osa/dto/CxOsaVulnerabilityComment.py +13 -15
- CheckmarxPythonSDK/CxRestAPISDK/osa/dto/CxOsaVulnerabilityState.py +13 -14
- CheckmarxPythonSDK/CxRestAPISDK/sast/configuration/dto/CxSASTConfig.py +9 -11
- CheckmarxPythonSDK/CxRestAPISDK/sast/configuration/dto/__init__.py +1 -1
- CheckmarxPythonSDK/CxRestAPISDK/sast/dataRetention/dto/CxDataRetentionRequestStatus.py +14 -15
- CheckmarxPythonSDK/CxRestAPISDK/sast/dataRetention/dto/CxDataRetentionRequestStatusStage.py +11 -12
- CheckmarxPythonSDK/CxRestAPISDK/sast/dataRetention/dto/CxDefineDataRetentionDateRangeRequest.py +2 -2
- CheckmarxPythonSDK/CxRestAPISDK/sast/dataRetention/dto/CxDefineDataRetentionNumberOfScansRequest.py +7 -4
- CheckmarxPythonSDK/CxRestAPISDK/sast/dataRetention/dto/CxDefineDataRetentionResponse.py +11 -12
- CheckmarxPythonSDK/CxRestAPISDK/sast/dataRetention/dto/__init__.py +3 -1
- CheckmarxPythonSDK/CxRestAPISDK/sast/engines/dto/CxEngineConfiguration.py +13 -14
- CheckmarxPythonSDK/CxRestAPISDK/sast/engines/dto/CxEngineDedication.py +21 -18
- CheckmarxPythonSDK/CxRestAPISDK/sast/engines/dto/CxEngineServer.py +40 -54
- CheckmarxPythonSDK/CxRestAPISDK/sast/engines/dto/CxEngineServerStatus.py +12 -12
- CheckmarxPythonSDK/CxRestAPISDK/sast/engines/dto/CxRegisterEngineRequestBody.py +1 -1
- CheckmarxPythonSDK/CxRestAPISDK/sast/general/dto/CxServerLicenseData.py +52 -46
- CheckmarxPythonSDK/CxRestAPISDK/sast/general/dto/CxSupportedLanguage.py +13 -7
- CheckmarxPythonSDK/CxRestAPISDK/sast/general/dto/CxTranslationInput.py +3 -5
- CheckmarxPythonSDK/CxRestAPISDK/sast/general/dto/CxUserPersistence.py +1 -3
- CheckmarxPythonSDK/CxRestAPISDK/sast/projects/__init__.py +0 -1
- CheckmarxPythonSDK/CxRestAPISDK/sast/projects/dto/CxCreateProjectRequest.py +4 -4
- CheckmarxPythonSDK/CxRestAPISDK/sast/projects/dto/CxCreateProjectResponse.py +14 -11
- CheckmarxPythonSDK/CxRestAPISDK/sast/projects/dto/CxCredential.py +4 -1
- CheckmarxPythonSDK/CxRestAPISDK/sast/projects/dto/CxCustomRemoteSourceSettings.py +16 -16
- CheckmarxPythonSDK/CxRestAPISDK/sast/projects/dto/CxGitSettings.py +13 -8
- CheckmarxPythonSDK/CxRestAPISDK/sast/projects/dto/CxIssueTrackingSystem.py +15 -16
- CheckmarxPythonSDK/CxRestAPISDK/sast/projects/dto/CxIssueTrackingSystemDetail.py +18 -16
- CheckmarxPythonSDK/CxRestAPISDK/sast/projects/dto/CxIssueTrackingSystemField.py +27 -21
- CheckmarxPythonSDK/CxRestAPISDK/sast/projects/dto/CxIssueTrackingSystemFieldAllowedValue.py +11 -13
- CheckmarxPythonSDK/CxRestAPISDK/sast/projects/dto/CxIssueTrackingSystemJira.py +10 -8
- CheckmarxPythonSDK/CxRestAPISDK/sast/projects/dto/CxIssueTrackingSystemJiraField.py +1 -0
- CheckmarxPythonSDK/CxRestAPISDK/sast/projects/dto/CxIssueTrackingSystemType.py +19 -16
- CheckmarxPythonSDK/CxRestAPISDK/sast/projects/dto/CxLink.py +11 -13
- CheckmarxPythonSDK/CxRestAPISDK/sast/projects/dto/CxPerforceSettings.py +19 -20
- CheckmarxPythonSDK/CxRestAPISDK/sast/projects/dto/CxProject.py +48 -37
- CheckmarxPythonSDK/CxRestAPISDK/sast/projects/dto/CxProjectExcludeSettings.py +16 -17
- CheckmarxPythonSDK/CxRestAPISDK/sast/projects/dto/CxProjectQueueSetting.py +16 -18
- CheckmarxPythonSDK/CxRestAPISDK/sast/projects/dto/CxSVNSettings.py +23 -20
- CheckmarxPythonSDK/CxRestAPISDK/sast/projects/dto/CxSharedRemoteSourceSettingsRequest.py +7 -6
- CheckmarxPythonSDK/CxRestAPISDK/sast/projects/dto/CxSharedRemoteSourceSettingsResponse.py +13 -12
- CheckmarxPythonSDK/CxRestAPISDK/sast/projects/dto/CxSourceSettingsLink.py +13 -15
- CheckmarxPythonSDK/CxRestAPISDK/sast/projects/dto/CxTFSSettings.py +18 -19
- CheckmarxPythonSDK/CxRestAPISDK/sast/projects/dto/CxURI.py +8 -9
- CheckmarxPythonSDK/CxRestAPISDK/sast/projects/dto/CxUpdateProjectNameTeamIdRequest.py +5 -6
- CheckmarxPythonSDK/CxRestAPISDK/sast/projects/dto/CxUpdateProjectRequest.py +11 -7
- CheckmarxPythonSDK/CxRestAPISDK/sast/projects/dto/__init__.py +3 -51
- CheckmarxPythonSDK/CxRestAPISDK/sast/projects/dto/customFields/CxCustomField.py +18 -21
- CheckmarxPythonSDK/CxRestAPISDK/sast/projects/dto/customFields/__init__.py +0 -1
- CheckmarxPythonSDK/CxRestAPISDK/sast/projects/dto/customTasks/CxCustomTask.py +18 -18
- CheckmarxPythonSDK/CxRestAPISDK/sast/projects/dto/customTasks/__init__.py +0 -1
- CheckmarxPythonSDK/CxRestAPISDK/sast/projects/dto/presets/CxPreset.py +18 -18
- CheckmarxPythonSDK/CxRestAPISDK/sast/scans/dto/CxCreateNewScanResponse.py +11 -13
- CheckmarxPythonSDK/CxRestAPISDK/sast/scans/dto/CxDateAndTime.py +15 -16
- CheckmarxPythonSDK/CxRestAPISDK/sast/scans/dto/CxFinishedScanStatus.py +11 -12
- CheckmarxPythonSDK/CxRestAPISDK/sast/scans/dto/CxLanguageState.py +15 -17
- CheckmarxPythonSDK/CxRestAPISDK/sast/scans/dto/CxLanguageStatistic.py +33 -31
- CheckmarxPythonSDK/CxRestAPISDK/sast/scans/dto/CxPolicyFindingResponse.py +11 -12
- CheckmarxPythonSDK/CxRestAPISDK/sast/scans/dto/CxPolicyFindingsStatus.py +15 -16
- CheckmarxPythonSDK/CxRestAPISDK/sast/scans/dto/CxRegisterScanReportResponse.py +12 -14
- CheckmarxPythonSDK/CxRestAPISDK/sast/scans/dto/CxResultsStatistics.py +9 -11
- CheckmarxPythonSDK/CxRestAPISDK/sast/scans/dto/CxScanDetail.py +70 -66
- CheckmarxPythonSDK/CxRestAPISDK/sast/scans/dto/CxScanFailedGeneralQueries.py +13 -13
- CheckmarxPythonSDK/CxRestAPISDK/sast/scans/dto/CxScanFailedQueries.py +12 -12
- CheckmarxPythonSDK/CxRestAPISDK/sast/scans/dto/CxScanFileCountOfLanguage.py +10 -13
- CheckmarxPythonSDK/CxRestAPISDK/sast/scans/dto/CxScanParsedFiles.py +22 -12
- CheckmarxPythonSDK/CxRestAPISDK/sast/scans/dto/CxScanParsedFilesMetric.py +17 -17
- CheckmarxPythonSDK/CxRestAPISDK/sast/scans/dto/CxScanQueueDetail.py +49 -57
- CheckmarxPythonSDK/CxRestAPISDK/sast/scans/dto/CxScanReportStatus.py +19 -16
- CheckmarxPythonSDK/CxRestAPISDK/sast/scans/dto/CxScanReportXmlContent.py +15 -7
- CheckmarxPythonSDK/CxRestAPISDK/sast/scans/dto/CxScanResult.py +136 -97
- CheckmarxPythonSDK/CxRestAPISDK/sast/scans/dto/CxScanResultAttackVector.py +15 -14
- CheckmarxPythonSDK/CxRestAPISDK/sast/scans/dto/CxScanResultAttackVectorByBFL.py +25 -17
- CheckmarxPythonSDK/CxRestAPISDK/sast/scans/dto/CxScanResultLabelsFields.py +17 -9
- CheckmarxPythonSDK/CxRestAPISDK/sast/scans/dto/CxScanResultNode.py +30 -33
- CheckmarxPythonSDK/CxRestAPISDK/sast/scans/dto/CxScanResultsPage.py +13 -12
- CheckmarxPythonSDK/CxRestAPISDK/sast/scans/dto/CxScanStage.py +11 -13
- CheckmarxPythonSDK/CxRestAPISDK/sast/scans/dto/CxScanState.py +25 -26
- CheckmarxPythonSDK/CxRestAPISDK/sast/scans/dto/CxScanStatistics.py +57 -72
- CheckmarxPythonSDK/CxRestAPISDK/sast/scans/dto/CxScanSucceededGeneralQueries.py +11 -12
- CheckmarxPythonSDK/CxRestAPISDK/sast/scans/dto/CxScanType.py +11 -13
- CheckmarxPythonSDK/CxRestAPISDK/sast/scans/dto/CxSchedulingSettings.py +5 -4
- CheckmarxPythonSDK/CxRestAPISDK/sast/scans/dto/CxStatisticsResult.py +28 -4
- CheckmarxPythonSDK/CxRestAPISDK/sast/scans/dto/CxStatus.py +14 -15
- CheckmarxPythonSDK/CxRestAPISDK/sast/scans/dto/CxStatusDetail.py +11 -13
- CheckmarxPythonSDK/CxRestAPISDK/sast/scans/dto/__init__.py +3 -43
- CheckmarxPythonSDK/CxRestAPISDK/sast/scans/dto/scanSettings/CxCreateScanSettingsRequestBody.py +19 -5
- CheckmarxPythonSDK/CxRestAPISDK/sast/scans/dto/scanSettings/CxCreateScanSettingsResponse.py +11 -13
- CheckmarxPythonSDK/CxRestAPISDK/sast/scans/dto/scanSettings/CxEmailNotification.py +13 -14
- CheckmarxPythonSDK/CxRestAPISDK/sast/scans/dto/scanSettings/CxLanguage.py +11 -12
- CheckmarxPythonSDK/CxRestAPISDK/sast/scans/dto/scanSettings/CxPostScanActionConditions.py +14 -13
- CheckmarxPythonSDK/CxRestAPISDK/sast/scans/dto/scanSettings/CxScanSettings.py +25 -40
- CheckmarxPythonSDK/CxRestAPISDK/team/dto/CxTeam.py +16 -25
- CheckmarxPythonSDK/CxScaApiSDK/AccessControlAPI.py +3 -3
- CheckmarxPythonSDK/CxScaApiSDK/api.py +1036 -673
- CheckmarxPythonSDK/CxScaApiSDK/config.py +12 -15
- CheckmarxPythonSDK/__init__.py +2 -3
- CheckmarxPythonSDK/__version__.py +1 -1
- CheckmarxPythonSDK/api_client.py +103 -154
- CheckmarxPythonSDK/configuration.py +2 -2
- CheckmarxPythonSDK/external/sarif/dto/CxCategory.py +26 -14
- CheckmarxPythonSDK/external/sarif/dto/CxSarifCategory.py +6 -4
- CheckmarxPythonSDK/external/sarif/dto/SarifArtifactLocation.py +1 -3
- CheckmarxPythonSDK/external/sarif/dto/SarifDescription.py +1 -3
- CheckmarxPythonSDK/external/sarif/dto/SarifDriver.py +9 -7
- CheckmarxPythonSDK/external/sarif/dto/SarifDriverRule.py +21 -10
- CheckmarxPythonSDK/external/sarif/dto/SarifLocation.py +1 -3
- CheckmarxPythonSDK/external/sarif/dto/SarifMessage.py +1 -3
- CheckmarxPythonSDK/external/sarif/dto/SarifPhysicalLocation.py +7 -5
- CheckmarxPythonSDK/external/sarif/dto/SarifPhysicalLocationPropertyBag.py +6 -4
- CheckmarxPythonSDK/external/sarif/dto/SarifRegion.py +7 -5
- CheckmarxPythonSDK/external/sarif/dto/SarifResultPropertyBag.py +9 -7
- CheckmarxPythonSDK/external/sarif/dto/SarifResultsCollection.py +7 -5
- CheckmarxPythonSDK/external/sarif/dto/SarifRun.py +7 -5
- CheckmarxPythonSDK/external/sarif/dto/SarifScanResult.py +11 -9
- CheckmarxPythonSDK/external/sarif/dto/SarifTaxa.py +9 -7
- CheckmarxPythonSDK/external/sarif/dto/SarifTaxaPropertyBag.py +25 -13
- CheckmarxPythonSDK/external/sarif/dto/SarifTaxaRelationship.py +1 -3
- CheckmarxPythonSDK/external/sarif/dto/SarifTaxaRelationshipTarget.py +7 -5
- CheckmarxPythonSDK/external/sarif/dto/SarifTaxonomy.py +9 -7
- CheckmarxPythonSDK/external/sarif/dto/SarifTool.py +1 -3
- CheckmarxPythonSDK/external/sarif/dto/SarifToolComponent.py +7 -5
- CheckmarxPythonSDK/external/sarif/sast_xml_to_sarif.py +124 -65
- CheckmarxPythonSDK/external/sarif/stig_mapping.py +2 -2
- CheckmarxPythonSDK/logger_setup.py +10 -9
- CheckmarxPythonSDK/rate_limiter.py +33 -39
- CheckmarxPythonSDK/utilities/CxError.py +13 -6
- CheckmarxPythonSDK/utilities/compat.py +1 -0
- CheckmarxPythonSDK/utilities/configUtility.py +36 -12
- {checkmarxpythonsdk-1.8.1.dist-info → checkmarxpythonsdk-1.8.2.dist-info}/METADATA +29 -26
- checkmarxpythonsdk-1.8.2.dist-info/RECORD +648 -0
- {checkmarxpythonsdk-1.8.1.dist-info → checkmarxpythonsdk-1.8.2.dist-info}/WHEEL +1 -1
- CheckmarxPythonSDK/CxOne/dto/RichProject.py +0 -75
- CheckmarxPythonSDK/CxOne/utilities.py +0 -58
- CheckmarxPythonSDK/CxPortalSoapApiSDK/zeepClient.py +0 -60
- checkmarxpythonsdk-1.8.1.dist-info/RECORD +0 -648
- {checkmarxpythonsdk-1.8.1.dist-info/licenses → checkmarxpythonsdk-1.8.2.dist-info}/LICENSE +0 -0
- {checkmarxpythonsdk-1.8.1.dist-info → checkmarxpythonsdk-1.8.2.dist-info}/top_level.txt +0 -0
|
@@ -1,1091 +1,621 @@
|
|
|
1
|
-
from
|
|
2
|
-
import os
|
|
1
|
+
from dataclasses import asdict
|
|
3
2
|
import json
|
|
3
|
+
import os
|
|
4
4
|
from typing import List, Union
|
|
5
|
-
from requests_toolbelt import MultipartEncoder
|
|
6
5
|
|
|
6
|
+
from CheckmarxPythonSDK.api_client import ApiClient
|
|
7
7
|
from CheckmarxPythonSDK.utilities.compat import OK, NO_CONTENT, CREATED
|
|
8
8
|
from .accesscontrol.dto import (
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
AuthenticationProvider,
|
|
10
|
+
LDAPGroup,
|
|
11
|
+
LDAPRoleMapping,
|
|
12
|
+
LDAPServer,
|
|
13
|
+
LDAPTeamMapping,
|
|
14
|
+
MyProfile,
|
|
15
|
+
OIDCClient,
|
|
16
|
+
Permission,
|
|
17
|
+
Role,
|
|
18
|
+
SAMLIdentityProvider,
|
|
19
|
+
SAMLRoleMapping,
|
|
20
|
+
SAMLServiceProvider,
|
|
21
|
+
SAMLTeamMapping,
|
|
22
|
+
ServiceProvider,
|
|
23
|
+
SMTPSetting,
|
|
24
|
+
SystemLocale,
|
|
25
|
+
Team,
|
|
26
|
+
User,
|
|
27
|
+
WindowsDomain,
|
|
28
|
+
)
|
|
29
|
+
from .accesscontrol.dto.requests import (
|
|
30
|
+
FirstAdminUserRequest,
|
|
31
|
+
LDAPRoleMappingRequest,
|
|
32
|
+
LDAPServerRequest,
|
|
33
|
+
LDAPTeamMappingRequest,
|
|
34
|
+
MyProfileUpdateRequest,
|
|
35
|
+
OIDCClientRequest,
|
|
36
|
+
RoleRequest,
|
|
37
|
+
SMTPSettingRequest,
|
|
38
|
+
UserRequest,
|
|
12
39
|
)
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
def construct_user(item):
|
|
16
|
-
return User(
|
|
17
|
-
user_id=item.get("id"),
|
|
18
|
-
username=item.get("userName"),
|
|
19
|
-
last_login_date=item.get("lastLoginDate"),
|
|
20
|
-
role_ids=item.get("roleIds"),
|
|
21
|
-
team_ids=item.get("teamIds"),
|
|
22
|
-
authentication_provider_id=item.get("authenticationProviderId"),
|
|
23
|
-
creation_date=item.get("creationDate"),
|
|
24
|
-
first_name=item.get("firstName"),
|
|
25
|
-
last_name=item.get("lastName"),
|
|
26
|
-
email=item.get("email"),
|
|
27
|
-
phone_number=item.get("phoneNumber"),
|
|
28
|
-
cell_phone_number=item.get("cellPhoneNumber"),
|
|
29
|
-
job_title=item.get("jobTitle"),
|
|
30
|
-
other=item.get("other"),
|
|
31
|
-
country=item.get("country"),
|
|
32
|
-
active=item.get("active"),
|
|
33
|
-
expiration_date=item.get("expirationDate"),
|
|
34
|
-
allowed_ip_list=item.get("allowedIpList"),
|
|
35
|
-
locale_id=item.get("localeId")
|
|
36
|
-
)
|
|
37
40
|
|
|
38
41
|
|
|
39
42
|
class AccessControl:
|
|
40
43
|
|
|
41
|
-
def __init__(self, api_client: ApiClient = None,
|
|
42
|
-
"""
|
|
43
|
-
|
|
44
|
-
Args:
|
|
45
|
-
api_client (ApiClient):
|
|
46
|
-
is_iam (bool)
|
|
47
|
-
"""
|
|
44
|
+
def __init__(self, api_client: ApiClient = None, ac_url: str = None):
|
|
48
45
|
self.api_client = api_client
|
|
49
|
-
|
|
50
|
-
|
|
46
|
+
if ac_url is None:
|
|
47
|
+
self.ac_url = f"{api_client.configuration.server_base_url.rstrip('/')}/cxrestapi/auth"
|
|
48
|
+
else:
|
|
49
|
+
self.ac_url = ac_url
|
|
51
50
|
|
|
52
51
|
def get_all_assignable_users(self) -> List[User]:
|
|
53
|
-
""
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
list[User]
|
|
57
|
-
"""
|
|
58
|
-
relative_url = self.sast_ac + "/AssignableUsers"
|
|
59
|
-
response = self.api_client.get_request(relative_url=relative_url, is_iam=self.is_iam)
|
|
60
|
-
return [construct_user(item) for item in response.json() or []]
|
|
52
|
+
url = self.ac_url + "/AssignableUsers"
|
|
53
|
+
response = self.api_client.call_api("GET", url)
|
|
54
|
+
return [User.from_dict(item) for item in response.json() or []]
|
|
61
55
|
|
|
62
56
|
def get_all_authentication_providers(self) -> List[AuthenticationProvider]:
|
|
63
|
-
""
|
|
64
|
-
|
|
65
|
-
Returns:
|
|
66
|
-
List[AuthenticationProvider]
|
|
67
|
-
"""
|
|
68
|
-
result = []
|
|
69
|
-
relative_url = self.sast_ac + "/AuthenticationProviders"
|
|
70
|
-
response = self.api_client.get_request(relative_url=relative_url, is_iam=self.is_iam)
|
|
57
|
+
url = self.ac_url + "/AuthenticationProviders"
|
|
58
|
+
response = self.api_client.call_api("GET", url)
|
|
71
59
|
if response.status_code == OK:
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
authentication_provider_id=item.get("id"),
|
|
75
|
-
name=item.get("name"),
|
|
76
|
-
provider_id=item.get("providerId"),
|
|
77
|
-
provider_type=item.get("providerType"),
|
|
78
|
-
is_external=item.get("isExternal"),
|
|
79
|
-
active=item.get("active")
|
|
80
|
-
) for item in response.json()
|
|
81
|
-
]
|
|
82
|
-
return result
|
|
60
|
+
return [AuthenticationProvider.from_dict(item) for item in response.json()]
|
|
61
|
+
return []
|
|
83
62
|
|
|
84
63
|
def submit_first_admin_user(
|
|
85
|
-
|
|
64
|
+
self, username: str, password: str, first_name: str, last_name: str, email: str
|
|
86
65
|
) -> bool:
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
post_data = json.dumps({
|
|
101
|
-
"username": username,
|
|
102
|
-
"password": password,
|
|
103
|
-
"firstName": first_name,
|
|
104
|
-
"lastName": last_name,
|
|
105
|
-
"email": email
|
|
106
|
-
})
|
|
107
|
-
relative_url = self.sast_ac + "/Users/FirstAdmin"
|
|
108
|
-
response = self.api_client.post_request(relative_url=relative_url, data=post_data, is_iam=self.is_iam)
|
|
109
|
-
if response.status_code == CREATED:
|
|
110
|
-
result = True
|
|
111
|
-
return result
|
|
66
|
+
req = FirstAdminUserRequest(
|
|
67
|
+
username=username,
|
|
68
|
+
password=password,
|
|
69
|
+
firstName=first_name,
|
|
70
|
+
lastName=last_name,
|
|
71
|
+
email=email,
|
|
72
|
+
)
|
|
73
|
+
url = self.ac_url + "/Users/FirstAdmin"
|
|
74
|
+
response = self.api_client.call_api(
|
|
75
|
+
"POST", url, data=json.dumps(asdict(req)),
|
|
76
|
+
headers={"Content-Type": "application/json"},
|
|
77
|
+
)
|
|
78
|
+
return response.status_code == CREATED
|
|
112
79
|
|
|
113
80
|
def get_admin_user_exists_confirmation(self) -> bool:
|
|
114
|
-
""
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
bool
|
|
118
|
-
"""
|
|
119
|
-
result = False
|
|
120
|
-
relative_url = self.sast_ac + "/Users/FirstAdminExistence"
|
|
121
|
-
response = self.api_client.get_request(relative_url=relative_url, is_iam=self.is_iam)
|
|
122
|
-
if response.status_code == OK and response.json().get("firstAdminExists"):
|
|
123
|
-
result = True
|
|
124
|
-
return result
|
|
81
|
+
url = self.ac_url + "/Users/FirstAdminExistence"
|
|
82
|
+
response = self.api_client.call_api("GET", url)
|
|
83
|
+
return response.status_code == OK and bool(response.json().get("firstAdminExists"))
|
|
125
84
|
|
|
126
85
|
def get_all_ldap_role_mapping(self, ldap_server_id: int = None) -> List[LDAPRoleMapping]:
|
|
127
|
-
""
|
|
128
|
-
|
|
129
|
-
Args:
|
|
130
|
-
ldap_server_id (int):
|
|
131
|
-
|
|
132
|
-
Returns:
|
|
133
|
-
List[LDAPRoleMapping]
|
|
134
|
-
"""
|
|
135
|
-
result = []
|
|
136
|
-
relative_url = self.sast_ac + "/LDAPRoleMappings"
|
|
86
|
+
url = self.ac_url + "/LDAPRoleMappings"
|
|
137
87
|
if ldap_server_id:
|
|
138
|
-
|
|
139
|
-
response = self.api_client.
|
|
88
|
+
url += "?ldapServerId={id}".format(id=ldap_server_id)
|
|
89
|
+
response = self.api_client.call_api("GET", url)
|
|
140
90
|
if response.status_code == OK:
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
ldap_role_mapping_id=item.get("id"),
|
|
144
|
-
ldap_server_id=item.get("ldapServerId"),
|
|
145
|
-
role_id=item.get("roleId"),
|
|
146
|
-
ldap_group_dn=item.get("ldapGroupDn"),
|
|
147
|
-
ldap_group_display_name=item.get("ldapGroupDisplayName")
|
|
148
|
-
) for item in response.json()
|
|
149
|
-
]
|
|
150
|
-
return result
|
|
91
|
+
return [LDAPRoleMapping.from_dict(item) for item in response.json()]
|
|
92
|
+
return []
|
|
151
93
|
|
|
152
94
|
def update_ldap_role_mapping(
|
|
153
|
-
|
|
95
|
+
self,
|
|
96
|
+
ldap_server_id: int,
|
|
97
|
+
role_id: int,
|
|
98
|
+
ldap_group_dn: str,
|
|
99
|
+
ldap_group_display_name: str,
|
|
154
100
|
) -> bool:
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
bool
|
|
165
|
-
"""
|
|
166
|
-
result = False
|
|
167
|
-
relative_url = self.sast_ac + "/LDAPServers/{id}/RoleMappings".format(id=ldap_server_id)
|
|
168
|
-
put_data = json.dumps(
|
|
169
|
-
{
|
|
170
|
-
"roleId": role_id,
|
|
171
|
-
"ldapGroupDn": ldap_group_dn,
|
|
172
|
-
"ldapGroupDisplayName": ldap_group_display_name
|
|
173
|
-
}
|
|
101
|
+
req = LDAPRoleMappingRequest(
|
|
102
|
+
roleId=role_id,
|
|
103
|
+
ldapGroupDn=ldap_group_dn,
|
|
104
|
+
ldapGroupDisplayName=ldap_group_display_name,
|
|
105
|
+
)
|
|
106
|
+
url = self.ac_url + "/LDAPServers/{id}/RoleMappings".format(id=ldap_server_id)
|
|
107
|
+
response = self.api_client.call_api(
|
|
108
|
+
"PUT", url, data=json.dumps(asdict(req)),
|
|
109
|
+
headers={"Content-Type": "application/json"},
|
|
174
110
|
)
|
|
175
|
-
response = self.api_client.put_request(relative_url=relative_url, data=put_data, is_iam=self.is_iam)
|
|
176
111
|
return response.status_code == NO_CONTENT
|
|
177
112
|
|
|
178
113
|
def delete_ldap_role_mapping(self, ldap_role_mapping_id: int) -> bool:
|
|
179
|
-
""
|
|
180
|
-
|
|
181
|
-
Args:
|
|
182
|
-
ldap_role_mapping_id (int):
|
|
183
|
-
|
|
184
|
-
Returns:
|
|
185
|
-
bool
|
|
186
|
-
"""
|
|
187
|
-
result = False
|
|
188
|
-
relative_url = self.sast_ac + "/LDAPRoleMappings/{id}".format(id=ldap_role_mapping_id)
|
|
189
|
-
response = self.api_client.delete_request(relative_url=relative_url, is_iam=self.is_iam)
|
|
114
|
+
url = self.ac_url + "/LDAPRoleMappings/{id}".format(id=ldap_role_mapping_id)
|
|
115
|
+
response = self.api_client.call_api("DELETE", url)
|
|
190
116
|
return response.status_code == NO_CONTENT
|
|
191
117
|
|
|
192
118
|
def test_ldap_server_connection(
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
119
|
+
self,
|
|
120
|
+
host: str,
|
|
121
|
+
port: int,
|
|
122
|
+
username: str,
|
|
123
|
+
password: str,
|
|
124
|
+
use_ssl: bool,
|
|
125
|
+
verify_ssl_certificate: bool,
|
|
126
|
+
base_dn: str,
|
|
127
|
+
user_object_filter: str,
|
|
128
|
+
user_object_class: str,
|
|
129
|
+
username_attribute: str,
|
|
130
|
+
first_name_attribute: str,
|
|
131
|
+
last_name_attribute: str,
|
|
132
|
+
email_attribute: str,
|
|
133
|
+
synchronization_enabled: bool,
|
|
134
|
+
advanced_team_and_role_mapping_enabled: bool,
|
|
135
|
+
additional_group_dn: str,
|
|
136
|
+
group_object_class: str,
|
|
137
|
+
group_object_filter: str,
|
|
138
|
+
group_name_attribute: str,
|
|
139
|
+
group_members_attribute: str,
|
|
140
|
+
user_membership_attribute: str,
|
|
199
141
|
) -> bool:
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
"""
|
|
228
|
-
post_data = json.dumps(
|
|
229
|
-
{
|
|
230
|
-
"host": host,
|
|
231
|
-
"port": port,
|
|
232
|
-
"username": username,
|
|
233
|
-
"password": password,
|
|
234
|
-
"useSsl": use_ssl,
|
|
235
|
-
"verifySslCertificate": verify_ssl_certificate,
|
|
236
|
-
"baseDn": base_dn,
|
|
237
|
-
"userObjectFilter": user_object_filter,
|
|
238
|
-
"userObjectClass": user_object_class,
|
|
239
|
-
"usernameAttribute": username_attribute,
|
|
240
|
-
"firstNameAttribute": first_name_attribute,
|
|
241
|
-
"lastNameAttribute": last_name_attribute,
|
|
242
|
-
"emailAttribute": email_attribute,
|
|
243
|
-
"synchronizationEnabled": synchronization_enabled,
|
|
244
|
-
"advancedTeamAndRoleMappingEnabled": advanced_team_and_role_mapping_enabled,
|
|
245
|
-
"additionalGroupDn": additional_group_dn,
|
|
246
|
-
"groupObjectClass": group_object_class,
|
|
247
|
-
"groupObjectFilter": group_object_filter,
|
|
248
|
-
"groupNameAttribute": group_name_attribute,
|
|
249
|
-
"groupMembersAttribute": group_members_attribute,
|
|
250
|
-
"userMembershipAttribute": user_membership_attribute
|
|
251
|
-
}
|
|
142
|
+
req = LDAPServerRequest(
|
|
143
|
+
host=host,
|
|
144
|
+
port=port,
|
|
145
|
+
username=username,
|
|
146
|
+
password=password,
|
|
147
|
+
useSsl=use_ssl,
|
|
148
|
+
verifySslCertificate=verify_ssl_certificate,
|
|
149
|
+
baseDn=base_dn,
|
|
150
|
+
userObjectFilter=user_object_filter,
|
|
151
|
+
userObjectClass=user_object_class,
|
|
152
|
+
usernameAttribute=username_attribute,
|
|
153
|
+
firstNameAttribute=first_name_attribute,
|
|
154
|
+
lastNameAttribute=last_name_attribute,
|
|
155
|
+
emailAttribute=email_attribute,
|
|
156
|
+
synchronizationEnabled=synchronization_enabled,
|
|
157
|
+
advancedTeamAndRoleMappingEnabled=advanced_team_and_role_mapping_enabled,
|
|
158
|
+
additionalGroupDn=additional_group_dn,
|
|
159
|
+
groupObjectClass=group_object_class,
|
|
160
|
+
groupObjectFilter=group_object_filter,
|
|
161
|
+
groupNameAttribute=group_name_attribute,
|
|
162
|
+
groupMembersAttribute=group_members_attribute,
|
|
163
|
+
userMembershipAttribute=user_membership_attribute,
|
|
164
|
+
)
|
|
165
|
+
url = self.ac_url + "/LDAPServers/TestConnection"
|
|
166
|
+
response = self.api_client.call_api(
|
|
167
|
+
"POST", url, data=json.dumps(asdict(req)),
|
|
168
|
+
headers={"Content-Type": "application/json"},
|
|
252
169
|
)
|
|
253
|
-
relative_url = self.sast_ac + "/LDAPServers/TestConnection"
|
|
254
|
-
response = self.api_client.post_request(relative_url=relative_url, data=post_data, is_iam=self.is_iam)
|
|
255
170
|
return response.status_code == OK
|
|
256
171
|
|
|
257
172
|
def get_user_entries_by_search_criteria(
|
|
258
|
-
|
|
173
|
+
self, ldap_server_id: int, username_contains_pattern: str = None
|
|
259
174
|
) -> List[User]:
|
|
260
|
-
""
|
|
261
|
-
|
|
262
|
-
Args:
|
|
263
|
-
ldap_server_id (int):
|
|
264
|
-
username_contains_pattern (str):
|
|
265
|
-
|
|
266
|
-
Returns:
|
|
267
|
-
List[User]
|
|
268
|
-
"""
|
|
269
|
-
result = []
|
|
270
|
-
relative_url = self.sast_ac + "/LDAPServers/{id}/UserEntries".format(id=ldap_server_id)
|
|
175
|
+
url = self.ac_url + "/LDAPServers/{id}/UserEntries".format(id=ldap_server_id)
|
|
271
176
|
if username_contains_pattern:
|
|
272
|
-
|
|
273
|
-
response = self.api_client.
|
|
177
|
+
url += "?userNameContainsPattern={}".format(username_contains_pattern)
|
|
178
|
+
response = self.api_client.call_api("GET", url)
|
|
274
179
|
if response.status_code == OK:
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
# property names are slightly different (e.g.,
|
|
278
|
-
# "firstname" instead of "firstName".
|
|
279
|
-
User(email=item["email"],
|
|
280
|
-
first_name=item["firstname"],
|
|
281
|
-
last_name=item["lastname"],
|
|
282
|
-
username=item["username"]
|
|
283
|
-
) for item in response.json()
|
|
284
|
-
]
|
|
285
|
-
return result
|
|
286
|
-
|
|
287
|
-
def get_group_entries_by_search_criteria(self, ldap_server_id: int, name_contains_pattern: str) -> List[LDAPGroup]:
|
|
288
|
-
"""
|
|
180
|
+
return [User.from_dict(item) for item in response.json()]
|
|
181
|
+
return []
|
|
289
182
|
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
Returns:
|
|
295
|
-
List[LDAPGroup]
|
|
296
|
-
"""
|
|
297
|
-
result = []
|
|
298
|
-
relative_url = self.sast_ac + "/LDAPServers/{id}/GroupEntries".format(id=ldap_server_id)
|
|
183
|
+
def get_group_entries_by_search_criteria(
|
|
184
|
+
self, ldap_server_id: int, name_contains_pattern: str
|
|
185
|
+
) -> List[LDAPGroup]:
|
|
186
|
+
url = self.ac_url + "/LDAPServers/{id}/GroupEntries".format(id=ldap_server_id)
|
|
299
187
|
if name_contains_pattern:
|
|
300
|
-
|
|
301
|
-
response = self.api_client.
|
|
188
|
+
url += "?nameContainsPattern={}".format(name_contains_pattern)
|
|
189
|
+
response = self.api_client.call_api("GET", url)
|
|
302
190
|
if response.status_code == OK:
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
name=item.get("name"),
|
|
306
|
-
dn=item.get("dn")
|
|
307
|
-
) for item in response.json()
|
|
308
|
-
]
|
|
309
|
-
return result
|
|
191
|
+
return [LDAPGroup.from_dict(item) for item in response.json()]
|
|
192
|
+
return []
|
|
310
193
|
|
|
311
194
|
def get_all_ldap_servers(self) -> List[LDAPServer]:
|
|
312
|
-
""
|
|
313
|
-
|
|
314
|
-
Returns:
|
|
315
|
-
List[LDAPServer]
|
|
316
|
-
"""
|
|
317
|
-
result = []
|
|
318
|
-
relative_url = self.sast_ac + "/LDAPServers"
|
|
319
|
-
response = self.api_client.get_request(relative_url=relative_url, is_iam=self.is_iam)
|
|
195
|
+
url = self.ac_url + "/LDAPServers"
|
|
196
|
+
response = self.api_client.call_api("GET", url)
|
|
320
197
|
if response.status_code == OK:
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
ldap_server_id=item.get("id"),
|
|
324
|
-
active=item.get("active"),
|
|
325
|
-
name=item.get("name"),
|
|
326
|
-
host=item.get("host"),
|
|
327
|
-
port=item.get("port"),
|
|
328
|
-
username=item.get("username"),
|
|
329
|
-
use_ssl=item.get("useSsl"),
|
|
330
|
-
verify_ssl_certificate=item.get("verifySslCertificate"),
|
|
331
|
-
ldap_directory_type=item.get("ldapDirectoryType"),
|
|
332
|
-
sso_enabled=item.get("ssoEnabled"),
|
|
333
|
-
mapped_domain_id=item.get("mappedDomainId"),
|
|
334
|
-
based_dn=item.get("baseDn"),
|
|
335
|
-
additional_user_dn=item.get("additionalUserDn"),
|
|
336
|
-
user_object_filter=item.get("userObjectFilter"),
|
|
337
|
-
user_object_class=item.get("userObjectClass"),
|
|
338
|
-
username_attribute=item.get("usernameAttribute"),
|
|
339
|
-
first_name_attribute=item.get("firstNameAttribute"),
|
|
340
|
-
last_name_attribute=item.get("lastNameAttribute"),
|
|
341
|
-
email_attribute=item.get("emailAttribute"),
|
|
342
|
-
synchronization_enabled=item.get("synchronizationEnabled"),
|
|
343
|
-
default_team_id=item.get("defaultTeamId"),
|
|
344
|
-
default_role_id=item.get("defaultRoleId"),
|
|
345
|
-
update_team_and_role_upon_login_enabled=item.get("updateTeamAndRoleUponLoginEnabled"),
|
|
346
|
-
periodical_synchronization_enabled=item.get("periodicalSynchronizationEnabled"),
|
|
347
|
-
advanced_team_and_role_mapping_enabled=item.get("advancedTeamAndRoleMappingEnabled"),
|
|
348
|
-
additional_group_dn=item.get("additionalGroupDn"),
|
|
349
|
-
group_object_class=item.get("groupObjectClass"),
|
|
350
|
-
group_object_filter=item.get("groupObjectFilter"),
|
|
351
|
-
group_name_attribute=item.get("groupNameAttribute"),
|
|
352
|
-
group_members_attribute=item.get("groupMembersAttribute"),
|
|
353
|
-
user_membership_attribute=item.get("userMembershipAttribute")
|
|
354
|
-
) for item in response.json()
|
|
355
|
-
]
|
|
356
|
-
return result
|
|
198
|
+
return [LDAPServer.from_dict(item) for item in response.json()]
|
|
199
|
+
return []
|
|
357
200
|
|
|
358
201
|
def create_new_ldap_server(
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
202
|
+
self,
|
|
203
|
+
password: str,
|
|
204
|
+
active: bool,
|
|
205
|
+
name: str,
|
|
206
|
+
host: str,
|
|
207
|
+
port: int,
|
|
208
|
+
username: str,
|
|
209
|
+
use_ssl: bool,
|
|
210
|
+
verify_ssl_certificate: bool,
|
|
211
|
+
based_dn: str,
|
|
212
|
+
additional_user_dn: str,
|
|
213
|
+
user_object_filter: str,
|
|
214
|
+
user_object_class: str,
|
|
215
|
+
username_attribute: str,
|
|
216
|
+
first_name_attribute: str,
|
|
217
|
+
last_name_attribute: str,
|
|
218
|
+
email_attribute: str,
|
|
219
|
+
ldap_directory_type: str,
|
|
220
|
+
sso_enabled: bool,
|
|
221
|
+
synchronization_enabled: bool,
|
|
222
|
+
default_team_id: int,
|
|
223
|
+
default_role_id: int,
|
|
224
|
+
update_team_and_role_upon_login_enabled: bool,
|
|
225
|
+
periodical_synchronization_enabled: bool,
|
|
226
|
+
advanced_team_and_role_mapping_enabled: bool,
|
|
227
|
+
additional_group_dn: str,
|
|
228
|
+
group_object_class: str,
|
|
229
|
+
group_object_filter: str,
|
|
230
|
+
group_name_attribute: str,
|
|
231
|
+
group_members_attribute: str,
|
|
232
|
+
user_membership_attribute: str,
|
|
367
233
|
) -> bool:
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
"""
|
|
405
|
-
relative_url = self.sast_ac + "/LDAPServers"
|
|
406
|
-
post_data = json.dumps(
|
|
407
|
-
{
|
|
408
|
-
"password": password,
|
|
409
|
-
"active": active,
|
|
410
|
-
"name": name,
|
|
411
|
-
"host": host,
|
|
412
|
-
"port": port,
|
|
413
|
-
"username": username,
|
|
414
|
-
"useSsl": use_ssl,
|
|
415
|
-
"verifySslCertificate": verify_ssl_certificate,
|
|
416
|
-
"baseDn": based_dn,
|
|
417
|
-
"additionalUserDn": additional_user_dn,
|
|
418
|
-
"userObjectFilter": user_object_filter,
|
|
419
|
-
"userObjectClass": user_object_class,
|
|
420
|
-
"usernameAttribute": username_attribute,
|
|
421
|
-
"firstNameAttribute": first_name_attribute,
|
|
422
|
-
"lastNameAttribute": last_name_attribute,
|
|
423
|
-
"emailAttribute": email_attribute,
|
|
424
|
-
"ldapDirectoryType": ldap_directory_type,
|
|
425
|
-
"ssoEnabled": sso_enabled,
|
|
426
|
-
"synchronizationEnabled": synchronization_enabled,
|
|
427
|
-
"defaultTeamId": default_team_id,
|
|
428
|
-
"defaultRoleId": default_role_id,
|
|
429
|
-
"updateTeamAndRoleUponLoginEnabled": update_team_and_role_upon_login_enabled,
|
|
430
|
-
"periodicalSynchronizationEnabled": periodical_synchronization_enabled,
|
|
431
|
-
"advancedTeamAndRoleMappingEnabled": advanced_team_and_role_mapping_enabled,
|
|
432
|
-
"additionalGroupDn": additional_group_dn,
|
|
433
|
-
"groupObjectClass": group_object_class,
|
|
434
|
-
"groupObjectFilter": group_object_filter,
|
|
435
|
-
"groupNameAttribute": group_name_attribute,
|
|
436
|
-
"groupMembersAttribute": group_members_attribute,
|
|
437
|
-
"userMembershipAttribute": user_membership_attribute
|
|
438
|
-
}
|
|
234
|
+
req = LDAPServerRequest(
|
|
235
|
+
password=password,
|
|
236
|
+
active=active,
|
|
237
|
+
name=name,
|
|
238
|
+
host=host,
|
|
239
|
+
port=port,
|
|
240
|
+
username=username,
|
|
241
|
+
useSsl=use_ssl,
|
|
242
|
+
verifySslCertificate=verify_ssl_certificate,
|
|
243
|
+
baseDn=based_dn,
|
|
244
|
+
additionalUserDn=additional_user_dn,
|
|
245
|
+
userObjectFilter=user_object_filter,
|
|
246
|
+
userObjectClass=user_object_class,
|
|
247
|
+
usernameAttribute=username_attribute,
|
|
248
|
+
firstNameAttribute=first_name_attribute,
|
|
249
|
+
lastNameAttribute=last_name_attribute,
|
|
250
|
+
emailAttribute=email_attribute,
|
|
251
|
+
ldapDirectoryType=ldap_directory_type,
|
|
252
|
+
ssoEnabled=sso_enabled,
|
|
253
|
+
synchronizationEnabled=synchronization_enabled,
|
|
254
|
+
defaultTeamId=default_team_id,
|
|
255
|
+
defaultRoleId=default_role_id,
|
|
256
|
+
updateTeamAndRoleUponLoginEnabled=update_team_and_role_upon_login_enabled,
|
|
257
|
+
periodicalSynchronizationEnabled=periodical_synchronization_enabled,
|
|
258
|
+
advancedTeamAndRoleMappingEnabled=advanced_team_and_role_mapping_enabled,
|
|
259
|
+
additionalGroupDn=additional_group_dn,
|
|
260
|
+
groupObjectClass=group_object_class,
|
|
261
|
+
groupObjectFilter=group_object_filter,
|
|
262
|
+
groupNameAttribute=group_name_attribute,
|
|
263
|
+
groupMembersAttribute=group_members_attribute,
|
|
264
|
+
userMembershipAttribute=user_membership_attribute,
|
|
265
|
+
)
|
|
266
|
+
url = self.ac_url + "/LDAPServers"
|
|
267
|
+
response = self.api_client.call_api(
|
|
268
|
+
"POST", url, data=json.dumps(asdict(req)),
|
|
269
|
+
headers={"Content-Type": "application/json"},
|
|
439
270
|
)
|
|
440
|
-
response = self.api_client.post_request(relative_url=relative_url, data=post_data, is_iam=self.is_iam)
|
|
441
271
|
return response.status_code == CREATED
|
|
442
272
|
|
|
443
273
|
def get_ldap_server_by_id(self, ldap_server_id: int) -> LDAPServer:
|
|
444
|
-
""
|
|
445
|
-
|
|
446
|
-
Args:
|
|
447
|
-
ldap_server_id (int):
|
|
448
|
-
|
|
449
|
-
Returns:
|
|
450
|
-
LDAPServer
|
|
451
|
-
"""
|
|
452
|
-
result = None
|
|
453
|
-
relative_url = self.sast_ac + "/LDAPServers/{id}".format(id=ldap_server_id)
|
|
454
|
-
response = self.api_client.get_request(relative_url=relative_url, is_iam=self.is_iam)
|
|
274
|
+
url = self.ac_url + "/LDAPServers/{id}".format(id=ldap_server_id)
|
|
275
|
+
response = self.api_client.call_api("GET", url)
|
|
455
276
|
if response.status_code == OK:
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
ldap_server_id=item.get("id"),
|
|
459
|
-
active=item.get("active"),
|
|
460
|
-
name=item.get("name"),
|
|
461
|
-
host=item.get("host"),
|
|
462
|
-
port=item.get("port"),
|
|
463
|
-
username=item.get("username"),
|
|
464
|
-
use_ssl=item.get("useSsl"),
|
|
465
|
-
verify_ssl_certificate=item.get("verifySslCertificate"),
|
|
466
|
-
ldap_directory_type=item.get("ldapDirectoryType"),
|
|
467
|
-
sso_enabled=item.get("ssoEnabled"),
|
|
468
|
-
mapped_domain_id=item.get("mappedDomainId"),
|
|
469
|
-
based_dn=item.get("baseDn"),
|
|
470
|
-
additional_user_dn=item.get("additionalUserDn"),
|
|
471
|
-
user_object_filter=item.get("userObjectFilter"),
|
|
472
|
-
user_object_class=item.get("userObjectClass"),
|
|
473
|
-
username_attribute=item.get("usernameAttribute"),
|
|
474
|
-
first_name_attribute=item.get("firstNameAttribute"),
|
|
475
|
-
last_name_attribute=item.get("lastNameAttribute"),
|
|
476
|
-
email_attribute=item.get("emailAttribute"),
|
|
477
|
-
synchronization_enabled=item.get("synchronizationEnabled"),
|
|
478
|
-
default_team_id=item.get("defaultTeamId"),
|
|
479
|
-
default_role_id=item.get("defaultRoleId"),
|
|
480
|
-
update_team_and_role_upon_login_enabled=item.get("updateTeamAndRoleUponLoginEnabled"),
|
|
481
|
-
periodical_synchronization_enabled=item.get("periodicalSynchronizationEnabled"),
|
|
482
|
-
advanced_team_and_role_mapping_enabled=item.get("advancedTeamAndRoleMappingEnabled"),
|
|
483
|
-
additional_group_dn=item.get("additionalGroupDn"),
|
|
484
|
-
group_object_class=item.get("groupObjectClass"),
|
|
485
|
-
group_object_filter=item.get("groupObjectFilter"),
|
|
486
|
-
group_name_attribute=item.get("groupNameAttribute"),
|
|
487
|
-
group_members_attribute=item.get("groupMembersAttribute"),
|
|
488
|
-
user_membership_attribute=item.get("userMembershipAttribute")
|
|
489
|
-
)
|
|
490
|
-
return result
|
|
277
|
+
return LDAPServer.from_dict(response.json())
|
|
278
|
+
return None
|
|
491
279
|
|
|
492
280
|
def update_ldap_server(
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
281
|
+
self,
|
|
282
|
+
ldap_server_id: int,
|
|
283
|
+
password: str,
|
|
284
|
+
active: bool,
|
|
285
|
+
name: str,
|
|
286
|
+
host: str,
|
|
287
|
+
port: int,
|
|
288
|
+
username: str,
|
|
289
|
+
use_ssl: bool,
|
|
290
|
+
verify_ssl_certificate: bool,
|
|
291
|
+
based_dn: str,
|
|
292
|
+
additional_user_dn: str,
|
|
293
|
+
user_object_filter: str,
|
|
294
|
+
user_object_class: str,
|
|
295
|
+
username_attribute: str,
|
|
296
|
+
first_name_attribute: str,
|
|
297
|
+
last_name_attribute: str,
|
|
298
|
+
email_attribute: str,
|
|
299
|
+
ldap_directory_type: str,
|
|
300
|
+
sso_enabled: bool,
|
|
301
|
+
synchronization_enabled: bool,
|
|
302
|
+
default_team_id: str,
|
|
303
|
+
default_role_id: str,
|
|
304
|
+
update_team_and_role_upon_login_enabled: bool,
|
|
305
|
+
periodical_synchronization_enabled: bool,
|
|
306
|
+
advanced_team_and_role_mapping_enabled: bool,
|
|
307
|
+
additional_group_dn: str,
|
|
308
|
+
group_object_class: str,
|
|
309
|
+
group_object_filter: str,
|
|
310
|
+
group_name_attribute: str,
|
|
311
|
+
group_members_attribute: str,
|
|
312
|
+
user_membership_attribute: str,
|
|
501
313
|
) -> bool:
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
group_name_attribute (str):
|
|
534
|
-
group_members_attribute (str):
|
|
535
|
-
user_membership_attribute (str):
|
|
536
|
-
|
|
537
|
-
Returns:
|
|
538
|
-
bool
|
|
539
|
-
"""
|
|
540
|
-
result = False
|
|
541
|
-
relative_url = self.sast_ac + "/LDAPServers/{id}".format(id=ldap_server_id)
|
|
542
|
-
put_data = json.dumps(
|
|
543
|
-
{
|
|
544
|
-
"password": password,
|
|
545
|
-
"active": active,
|
|
546
|
-
"name": name,
|
|
547
|
-
"host": host,
|
|
548
|
-
"port": port,
|
|
549
|
-
"username": username,
|
|
550
|
-
"useSsl": use_ssl,
|
|
551
|
-
"verifySslCertificate": verify_ssl_certificate,
|
|
552
|
-
"baseDn": based_dn,
|
|
553
|
-
"additionalUserDn": additional_user_dn,
|
|
554
|
-
"userObjectFilter": user_object_filter,
|
|
555
|
-
"userObjectClass": user_object_class,
|
|
556
|
-
"usernameAttribute": username_attribute,
|
|
557
|
-
"firstNameAttribute": first_name_attribute,
|
|
558
|
-
"lastNameAttribute": last_name_attribute,
|
|
559
|
-
"emailAttribute": email_attribute,
|
|
560
|
-
"ldapDirectoryType": ldap_directory_type,
|
|
561
|
-
"ssoEnabled": sso_enabled,
|
|
562
|
-
"synchronizationEnabled": synchronization_enabled,
|
|
563
|
-
"defaultTeamId": default_team_id,
|
|
564
|
-
"defaultRoleId": default_role_id,
|
|
565
|
-
"updateTeamAndRoleUponLoginEnabled": update_team_and_role_upon_login_enabled,
|
|
566
|
-
"periodicalSynchronizationEnabled": periodical_synchronization_enabled,
|
|
567
|
-
"advancedTeamAndRoleMappingEnabled": advanced_team_and_role_mapping_enabled,
|
|
568
|
-
"additionalGroupDn": additional_group_dn,
|
|
569
|
-
"groupObjectClass": group_object_class,
|
|
570
|
-
"groupObjectFilter": group_object_filter,
|
|
571
|
-
"groupNameAttribute": group_name_attribute,
|
|
572
|
-
"groupMembersAttribute": group_members_attribute,
|
|
573
|
-
"userMembershipAttribute": user_membership_attribute
|
|
574
|
-
}
|
|
314
|
+
req = LDAPServerRequest(
|
|
315
|
+
password=password,
|
|
316
|
+
active=active,
|
|
317
|
+
name=name,
|
|
318
|
+
host=host,
|
|
319
|
+
port=port,
|
|
320
|
+
username=username,
|
|
321
|
+
useSsl=use_ssl,
|
|
322
|
+
verifySslCertificate=verify_ssl_certificate,
|
|
323
|
+
baseDn=based_dn,
|
|
324
|
+
additionalUserDn=additional_user_dn,
|
|
325
|
+
userObjectFilter=user_object_filter,
|
|
326
|
+
userObjectClass=user_object_class,
|
|
327
|
+
usernameAttribute=username_attribute,
|
|
328
|
+
firstNameAttribute=first_name_attribute,
|
|
329
|
+
lastNameAttribute=last_name_attribute,
|
|
330
|
+
emailAttribute=email_attribute,
|
|
331
|
+
ldapDirectoryType=ldap_directory_type,
|
|
332
|
+
ssoEnabled=sso_enabled,
|
|
333
|
+
synchronizationEnabled=synchronization_enabled,
|
|
334
|
+
defaultTeamId=default_team_id,
|
|
335
|
+
defaultRoleId=default_role_id,
|
|
336
|
+
updateTeamAndRoleUponLoginEnabled=update_team_and_role_upon_login_enabled,
|
|
337
|
+
periodicalSynchronizationEnabled=periodical_synchronization_enabled,
|
|
338
|
+
advancedTeamAndRoleMappingEnabled=advanced_team_and_role_mapping_enabled,
|
|
339
|
+
additionalGroupDn=additional_group_dn,
|
|
340
|
+
groupObjectClass=group_object_class,
|
|
341
|
+
groupObjectFilter=group_object_filter,
|
|
342
|
+
groupNameAttribute=group_name_attribute,
|
|
343
|
+
groupMembersAttribute=group_members_attribute,
|
|
344
|
+
userMembershipAttribute=user_membership_attribute,
|
|
575
345
|
)
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
346
|
+
url = self.ac_url + "/LDAPServers/{id}".format(id=ldap_server_id)
|
|
347
|
+
response = self.api_client.call_api(
|
|
348
|
+
"PUT", url, data=json.dumps(asdict(req)),
|
|
349
|
+
headers={"Content-Type": "application/json"},
|
|
350
|
+
)
|
|
351
|
+
return response.status_code == NO_CONTENT
|
|
580
352
|
|
|
581
353
|
def delete_ldap_server(self, ldap_server_id: int) -> bool:
|
|
582
|
-
""
|
|
583
|
-
|
|
584
|
-
Args:
|
|
585
|
-
ldap_server_id (int):
|
|
586
|
-
|
|
587
|
-
Returns:
|
|
588
|
-
bool
|
|
589
|
-
"""
|
|
590
|
-
result = False
|
|
591
|
-
relative_url = self.sast_ac + "/LDAPServers/{id}".format(id=ldap_server_id)
|
|
592
|
-
response = self.api_client.delete_request(relative_url=relative_url, is_iam=self.is_iam)
|
|
354
|
+
url = self.ac_url + "/LDAPServers/{id}".format(id=ldap_server_id)
|
|
355
|
+
response = self.api_client.call_api("DELETE", url)
|
|
593
356
|
return response.status_code == NO_CONTENT
|
|
594
357
|
|
|
595
|
-
def get_ldap_team_mapping(
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
ldap_server_id (int):
|
|
600
|
-
team_id (int):
|
|
601
|
-
|
|
602
|
-
Returns:
|
|
603
|
-
List[LDAPTeamMapping]
|
|
604
|
-
"""
|
|
605
|
-
result = []
|
|
606
|
-
relative_url = self.sast_ac + "/LDAPTeamMappings"
|
|
358
|
+
def get_ldap_team_mapping(
|
|
359
|
+
self, ldap_server_id: int = None, team_id: int = None
|
|
360
|
+
) -> List[LDAPTeamMapping]:
|
|
361
|
+
url = self.ac_url + "/LDAPTeamMappings"
|
|
607
362
|
optionals = []
|
|
608
363
|
if ldap_server_id:
|
|
609
364
|
optionals.append("ldapServerId={id}".format(id=ldap_server_id))
|
|
610
365
|
if team_id:
|
|
611
366
|
optionals.append("teamId={id}".format(id=team_id))
|
|
612
367
|
if optionals:
|
|
613
|
-
|
|
614
|
-
response = self.api_client.
|
|
368
|
+
url += "?" + "&".join(optionals)
|
|
369
|
+
response = self.api_client.call_api("GET", url)
|
|
615
370
|
if response.status_code == OK:
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
ldap_team_mapping_id=item.get("id"),
|
|
619
|
-
ldap_server_id=item.get("ldapServerId"),
|
|
620
|
-
team_id=item.get("teamId"),
|
|
621
|
-
ldap_group_dn=item.get("ldapGroupDn"),
|
|
622
|
-
ldap_group_display_name=item.get("ldapGroupDisplayName")
|
|
623
|
-
) for item in response.json()
|
|
624
|
-
]
|
|
625
|
-
return result
|
|
371
|
+
return [LDAPTeamMapping.from_dict(item) for item in response.json()]
|
|
372
|
+
return []
|
|
626
373
|
|
|
627
374
|
def update_ldap_team_mapping(
|
|
628
|
-
|
|
375
|
+
self,
|
|
376
|
+
ldap_server_id: int,
|
|
377
|
+
team_id: int,
|
|
378
|
+
ldap_group_dn: str,
|
|
379
|
+
ldap_group_display_name: str,
|
|
629
380
|
) -> bool:
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
bool
|
|
640
|
-
"""
|
|
641
|
-
result = False
|
|
642
|
-
relative_url = self.sast_ac + "/LDAPServers/{id}/TeamMappings".format(id=ldap_server_id)
|
|
643
|
-
put_data = json.dumps(
|
|
644
|
-
{
|
|
645
|
-
"teamId": team_id,
|
|
646
|
-
"ldapGroupDn": ldap_group_dn,
|
|
647
|
-
"ldapGroupDisplayName": ldap_group_display_name
|
|
648
|
-
}
|
|
381
|
+
req = LDAPTeamMappingRequest(
|
|
382
|
+
teamId=team_id,
|
|
383
|
+
ldapGroupDn=ldap_group_dn,
|
|
384
|
+
ldapGroupDisplayName=ldap_group_display_name,
|
|
385
|
+
)
|
|
386
|
+
url = self.ac_url + "/LDAPServers/{id}/TeamMappings".format(id=ldap_server_id)
|
|
387
|
+
response = self.api_client.call_api(
|
|
388
|
+
"PUT", url, data=json.dumps(asdict(req)),
|
|
389
|
+
headers={"Content-Type": "application/json"},
|
|
649
390
|
)
|
|
650
|
-
response = self.api_client.put_request(relative_url=relative_url, data=put_data, is_iam=self.is_iam)
|
|
651
391
|
return response.status_code == NO_CONTENT
|
|
652
392
|
|
|
653
393
|
def delete_ldap_team_mapping(self, ldap_team_mapping_id: int) -> bool:
|
|
654
|
-
""
|
|
655
|
-
|
|
656
|
-
Args:
|
|
657
|
-
ldap_team_mapping_id (int):
|
|
658
|
-
|
|
659
|
-
Returns:
|
|
660
|
-
bool
|
|
661
|
-
"""
|
|
662
|
-
result = False
|
|
663
|
-
relative_url = self.sast_ac + "/LDAPTeamMappings/{id}".format(id=ldap_team_mapping_id)
|
|
664
|
-
response = self.api_client.delete_request(relative_url=relative_url, is_iam=self.is_iam)
|
|
394
|
+
url = self.ac_url + "/LDAPTeamMappings/{id}".format(id=ldap_team_mapping_id)
|
|
395
|
+
response = self.api_client.call_api("DELETE", url)
|
|
665
396
|
return response.status_code == NO_CONTENT
|
|
666
397
|
|
|
667
398
|
def get_my_profile(self) -> MyProfile:
|
|
668
|
-
""
|
|
669
|
-
|
|
670
|
-
Returns:
|
|
671
|
-
MyProfile
|
|
672
|
-
"""
|
|
673
|
-
result = None
|
|
674
|
-
relative_url = self.sast_ac + "/MyProfile"
|
|
675
|
-
response = self.api_client.get_request(relative_url=relative_url, is_iam=self.is_iam)
|
|
399
|
+
url = self.ac_url + "/MyProfile"
|
|
400
|
+
response = self.api_client.call_api("GET", url)
|
|
676
401
|
if response.status_code == OK:
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
profile_id=item.get("id"),
|
|
680
|
-
username=item.get("userName"),
|
|
681
|
-
first_name=item.get("firstName"),
|
|
682
|
-
last_name=item.get("lastName"),
|
|
683
|
-
email=item.get("email"),
|
|
684
|
-
phone_number=item.get("phoneNumber"),
|
|
685
|
-
cellphone_number=item.get("cellPhoneNumber"),
|
|
686
|
-
job_title=item.get("jobTitle"),
|
|
687
|
-
other=item.get("other"),
|
|
688
|
-
country=item.get("country"),
|
|
689
|
-
locale_id=item.get("localeId"),
|
|
690
|
-
teams=item.get("teams"),
|
|
691
|
-
authentication_provider_id=item.get("authenticationProviderId")
|
|
692
|
-
)
|
|
693
|
-
return result
|
|
402
|
+
return MyProfile.from_dict(response.json())
|
|
403
|
+
return None
|
|
694
404
|
|
|
695
405
|
def update_my_profile(
|
|
696
|
-
|
|
697
|
-
|
|
406
|
+
self,
|
|
407
|
+
first_name: str,
|
|
408
|
+
last_name: str,
|
|
409
|
+
email: str,
|
|
410
|
+
phone_number: str,
|
|
411
|
+
cell_phone_number: str,
|
|
412
|
+
job_title: str,
|
|
413
|
+
other: str,
|
|
414
|
+
country: str,
|
|
415
|
+
locale_id: int,
|
|
698
416
|
) -> bool:
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
result = False
|
|
716
|
-
put_data = json.dumps({
|
|
717
|
-
"firstName": first_name,
|
|
718
|
-
"lastName": last_name,
|
|
719
|
-
"email": email,
|
|
720
|
-
"phoneNumber": phone_number,
|
|
721
|
-
"cellPhoneNumber": cell_phone_number,
|
|
722
|
-
"jobTitle": job_title,
|
|
723
|
-
"other": other,
|
|
724
|
-
"country": country,
|
|
725
|
-
"localeId": locale_id
|
|
726
|
-
})
|
|
727
|
-
relative_url = self.sast_ac + "/MyProfile"
|
|
728
|
-
response = self.api_client.put_request(relative_url=relative_url, data=put_data, is_iam=self.is_iam)
|
|
417
|
+
req = MyProfileUpdateRequest(
|
|
418
|
+
firstName=first_name,
|
|
419
|
+
lastName=last_name,
|
|
420
|
+
email=email,
|
|
421
|
+
phoneNumber=phone_number,
|
|
422
|
+
cellPhoneNumber=cell_phone_number,
|
|
423
|
+
jobTitle=job_title,
|
|
424
|
+
other=other,
|
|
425
|
+
country=country,
|
|
426
|
+
localeId=locale_id,
|
|
427
|
+
)
|
|
428
|
+
url = self.ac_url + "/MyProfile"
|
|
429
|
+
response = self.api_client.call_api(
|
|
430
|
+
"PUT", url, data=json.dumps(asdict(req)),
|
|
431
|
+
headers={"Content-Type": "application/json"},
|
|
432
|
+
)
|
|
729
433
|
return response.status_code == NO_CONTENT
|
|
730
434
|
|
|
731
435
|
def get_all_oidc_clients(self) -> List[OIDCClient]:
|
|
732
|
-
""
|
|
733
|
-
|
|
734
|
-
Returns:
|
|
735
|
-
List[OIDCClient]
|
|
736
|
-
"""
|
|
737
|
-
result = []
|
|
738
|
-
relative_url = self.sast_ac + "/OIDCClients"
|
|
739
|
-
response = self.api_client.get_request(relative_url=relative_url, is_iam=self.is_iam)
|
|
436
|
+
url = self.ac_url + "/OIDCClients"
|
|
437
|
+
response = self.api_client.call_api("GET", url)
|
|
740
438
|
if response.status_code == OK:
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
oidc_client_id=item.get("id"),
|
|
744
|
-
update_access_token_claims_on_refresh=item.get("updateAccessTokenClaimsOnRefresh"),
|
|
745
|
-
access_token_type=item.get("accessTokenType"),
|
|
746
|
-
include_jwt_id=item.get("includeJwtId"),
|
|
747
|
-
always_include_user_claims_in_id_token=item.get("alwaysIncludeUserClaimsInIdToken"),
|
|
748
|
-
client_id=item.get("clientId"),
|
|
749
|
-
client_name=item.get("clientName"),
|
|
750
|
-
allow_offline_access=item.get("allowOfflineAccess"),
|
|
751
|
-
client_secrets=item.get("clientSecrets"),
|
|
752
|
-
allow_grant_types=item.get("allowedGrantTypes"),
|
|
753
|
-
allowed_scopes=item.get("allowedScopes"),
|
|
754
|
-
enabled=item.get("enabled"),
|
|
755
|
-
require_client_secret=item.get("requireClientSecret"),
|
|
756
|
-
redirect_uris=item.get("redirectUris"),
|
|
757
|
-
post_logout_redrect_uris=item.get("postLogoutRedirectUris"),
|
|
758
|
-
front_channel_logout_uri=item.get("frontChannelLogoutUri"),
|
|
759
|
-
front_channel_logout_session_required=item.get("frontChannelLogoutSessionRequired"),
|
|
760
|
-
back_channel_logout_uri=item.get("backChannelLogoutUri"),
|
|
761
|
-
back_channel_logout_session_required=item.get("backChannelLogoutSessionRequired"),
|
|
762
|
-
identity_token_life_time=item.get("identityTokenLifetime"),
|
|
763
|
-
access_token_life_time=item.get("accessTokenLifetime"),
|
|
764
|
-
authorization_code_life_time=item.get("authorizationCodeLifetime"),
|
|
765
|
-
absolute_refresh_token_life_time=item.get("absoluteRefreshTokenLifetime"),
|
|
766
|
-
sliding_refresh_token_life_time=item.get("slidingRefreshTokenLifetime"),
|
|
767
|
-
refresh_token_usage=item.get("refreshTokenUsage"),
|
|
768
|
-
refresh_token_expiration=item.get("refreshTokenExpiration"),
|
|
769
|
-
allowed_cors_origins=item.get("allowedCorsOrigins"),
|
|
770
|
-
allowed_access_tokens_via_browser=item.get("allowAccessTokensViaBrowser"),
|
|
771
|
-
claims=item.get("claims"),
|
|
772
|
-
client_claims_prefix=item.get("clientClaimsPrefix")
|
|
773
|
-
) for item in response.json()
|
|
774
|
-
]
|
|
775
|
-
return result
|
|
439
|
+
return [OIDCClient.from_dict(item) for item in response.json()]
|
|
440
|
+
return []
|
|
776
441
|
|
|
777
442
|
def create_new_oidc_client(
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
443
|
+
self,
|
|
444
|
+
update_access_token_claims_on_refresh: bool,
|
|
445
|
+
access_token_type: int,
|
|
446
|
+
include_jwt_id: bool,
|
|
447
|
+
always_include_user_claims_in_id_token: bool,
|
|
448
|
+
client_id: str,
|
|
449
|
+
client_name: str,
|
|
450
|
+
allow_offline_access: bool,
|
|
451
|
+
client_secrets: List[str],
|
|
452
|
+
allow_grant_types: List[str],
|
|
453
|
+
allowed_scopes: List[str],
|
|
454
|
+
enabled: bool,
|
|
455
|
+
require_client_secret: bool,
|
|
456
|
+
redirect_uris: List[str],
|
|
457
|
+
post_logout_redirect_uris: List[str],
|
|
458
|
+
front_channel_logout_uri: str,
|
|
459
|
+
front_channel_logout_session_required: bool,
|
|
460
|
+
back_channel_logout_uri: str,
|
|
461
|
+
back_channel_logout_session_required: bool,
|
|
462
|
+
identity_token_life_time: int,
|
|
463
|
+
access_token_life_time: int,
|
|
464
|
+
authorization_code_life_time: int,
|
|
465
|
+
absolute_refresh_token_life_time: int,
|
|
466
|
+
sliding_refresh_token_life_time: int,
|
|
467
|
+
refresh_token_usage: int,
|
|
468
|
+
refresh_token_expiration: int,
|
|
469
|
+
allowed_cors_origins: List[str],
|
|
470
|
+
allowed_access_tokens_via_browser: bool,
|
|
471
|
+
claims: List[str],
|
|
472
|
+
client_claims_prefix: str,
|
|
788
473
|
) -> bool:
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
claims (list):
|
|
820
|
-
client_claims_prefix (str):
|
|
821
|
-
|
|
822
|
-
Returns:
|
|
823
|
-
bool
|
|
824
|
-
"""
|
|
825
|
-
result = False
|
|
826
|
-
post_data = json.dumps(
|
|
827
|
-
{
|
|
828
|
-
"updateAccessTokenClaimsOnRefresh": update_access_token_claims_on_refresh,
|
|
829
|
-
"accessTokenType": access_token_type,
|
|
830
|
-
"includeJwtId": include_jwt_id,
|
|
831
|
-
"alwaysIncludeUserClaimsInIdToken": always_include_user_claims_in_id_token,
|
|
832
|
-
"clientId": client_id,
|
|
833
|
-
"clientName": client_name,
|
|
834
|
-
"allowOfflineAccess": allow_offline_access,
|
|
835
|
-
"clientSecrets": client_secrets,
|
|
836
|
-
"allowedGrantTypes": allow_grant_types,
|
|
837
|
-
"allowedScopes": allowed_scopes,
|
|
838
|
-
"enabled": enabled,
|
|
839
|
-
"requireClientSecret": require_client_secret,
|
|
840
|
-
"redirectUris": redirect_uris,
|
|
841
|
-
"postLogoutRedirectUris": post_logout_redirect_uris,
|
|
842
|
-
"frontChannelLogoutUri": front_channel_logout_uri,
|
|
843
|
-
"frontChannelLogoutSessionRequired": front_channel_logout_session_required,
|
|
844
|
-
"backChannelLogoutUri": back_channel_logout_uri,
|
|
845
|
-
"backChannelLogoutSessionRequired": back_channel_logout_session_required,
|
|
846
|
-
"identityTokenLifetime": identity_token_life_time,
|
|
847
|
-
"accessTokenLifetime": access_token_life_time,
|
|
848
|
-
"authorizationCodeLifetime": authorization_code_life_time,
|
|
849
|
-
"absoluteRefreshTokenLifetime": absolute_refresh_token_life_time,
|
|
850
|
-
"slidingRefreshTokenLifetime": sliding_refresh_token_life_time,
|
|
851
|
-
"refreshTokenUsage": refresh_token_usage,
|
|
852
|
-
"refreshTokenExpiration": refresh_token_expiration,
|
|
853
|
-
"allowedCorsOrigins": allowed_cors_origins,
|
|
854
|
-
"allowAccessTokensViaBrowser": allowed_access_tokens_via_browser,
|
|
855
|
-
"claims": claims,
|
|
856
|
-
"clientClaimsPrefix": client_claims_prefix
|
|
857
|
-
}
|
|
474
|
+
req = OIDCClientRequest(
|
|
475
|
+
updateAccessTokenClaimsOnRefresh=update_access_token_claims_on_refresh,
|
|
476
|
+
accessTokenType=access_token_type,
|
|
477
|
+
includeJwtId=include_jwt_id,
|
|
478
|
+
alwaysIncludeUserClaimsInIdToken=always_include_user_claims_in_id_token,
|
|
479
|
+
clientId=client_id,
|
|
480
|
+
clientName=client_name,
|
|
481
|
+
allowOfflineAccess=allow_offline_access,
|
|
482
|
+
clientSecrets=client_secrets,
|
|
483
|
+
allowedGrantTypes=allow_grant_types,
|
|
484
|
+
allowedScopes=allowed_scopes,
|
|
485
|
+
enabled=enabled,
|
|
486
|
+
requireClientSecret=require_client_secret,
|
|
487
|
+
redirectUris=redirect_uris,
|
|
488
|
+
postLogoutRedirectUris=post_logout_redirect_uris,
|
|
489
|
+
frontChannelLogoutUri=front_channel_logout_uri,
|
|
490
|
+
frontChannelLogoutSessionRequired=front_channel_logout_session_required,
|
|
491
|
+
backChannelLogoutUri=back_channel_logout_uri,
|
|
492
|
+
backChannelLogoutSessionRequired=back_channel_logout_session_required,
|
|
493
|
+
identityTokenLifetime=identity_token_life_time,
|
|
494
|
+
accessTokenLifetime=access_token_life_time,
|
|
495
|
+
authorizationCodeLifetime=authorization_code_life_time,
|
|
496
|
+
absoluteRefreshTokenLifetime=absolute_refresh_token_life_time,
|
|
497
|
+
slidingRefreshTokenLifetime=sliding_refresh_token_life_time,
|
|
498
|
+
refreshTokenUsage=refresh_token_usage,
|
|
499
|
+
refreshTokenExpiration=refresh_token_expiration,
|
|
500
|
+
allowedCorsOrigins=allowed_cors_origins,
|
|
501
|
+
allowAccessTokensViaBrowser=allowed_access_tokens_via_browser,
|
|
502
|
+
claims=claims,
|
|
503
|
+
clientClaimsPrefix=client_claims_prefix,
|
|
858
504
|
)
|
|
859
|
-
|
|
860
|
-
response = self.api_client.
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
505
|
+
url = self.ac_url + "/OIDCClients"
|
|
506
|
+
response = self.api_client.call_api(
|
|
507
|
+
"POST", url, data=json.dumps(asdict(req)),
|
|
508
|
+
headers={"Content-Type": "application/json"},
|
|
509
|
+
)
|
|
510
|
+
return response.status_code == CREATED
|
|
864
511
|
|
|
865
512
|
def get_oidc_client_by_id(self, oidc_client_id: int) -> OIDCClient:
|
|
866
|
-
""
|
|
867
|
-
|
|
868
|
-
Args:
|
|
869
|
-
oidc_client_id (int):
|
|
870
|
-
|
|
871
|
-
Returns:
|
|
872
|
-
OIDCClient
|
|
873
|
-
"""
|
|
874
|
-
result = None
|
|
875
|
-
relative_url = self.sast_ac + "/OIDCClients/{id}".format(id=oidc_client_id)
|
|
876
|
-
response = self.api_client.get_request(relative_url=relative_url, is_iam=self.is_iam)
|
|
513
|
+
url = self.ac_url + "/OIDCClients/{id}".format(id=oidc_client_id)
|
|
514
|
+
response = self.api_client.call_api("GET", url)
|
|
877
515
|
if response.status_code == OK:
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
oidc_client_id=item.get("id"),
|
|
881
|
-
update_access_token_claims_on_refresh=item.get("updateAccessTokenClaimsOnRefresh"),
|
|
882
|
-
access_token_type=item.get("accessTokenType"),
|
|
883
|
-
include_jwt_id=item.get("includeJwtId"),
|
|
884
|
-
always_include_user_claims_in_id_token=item.get("alwaysIncludeUserClaimsInIdToken"),
|
|
885
|
-
client_id=item.get("clientId"),
|
|
886
|
-
client_name=item.get("clientName"),
|
|
887
|
-
allow_offline_access=item.get("allowOfflineAccess"),
|
|
888
|
-
client_secrets=item.get("clientSecrets"),
|
|
889
|
-
allow_grant_types=item.get("allowedGrantTypes"),
|
|
890
|
-
allowed_scopes=item.get("allowedScopes"),
|
|
891
|
-
enabled=item.get("enabled"),
|
|
892
|
-
require_client_secret=item.get("requireClientSecret"),
|
|
893
|
-
redirect_uris=item.get("redirectUris"),
|
|
894
|
-
post_logout_redrect_uris=item.get("postLogoutRedirectUris"),
|
|
895
|
-
front_channel_logout_uri=item.get("frontChannelLogoutUri"),
|
|
896
|
-
front_channel_logout_session_required=item.get("frontChannelLogoutSessionRequired"),
|
|
897
|
-
back_channel_logout_uri=item.get("backChannelLogoutUri"),
|
|
898
|
-
back_channel_logout_session_required=item.get("backChannelLogoutSessionRequired"),
|
|
899
|
-
identity_token_life_time=item.get("identityTokenLifetime"),
|
|
900
|
-
access_token_life_time=item.get("accessTokenLifetime"),
|
|
901
|
-
authorization_code_life_time=item.get("authorizationCodeLifetime"),
|
|
902
|
-
absolute_refresh_token_life_time=item.get("absoluteRefreshTokenLifetime"),
|
|
903
|
-
sliding_refresh_token_life_time=item.get("slidingRefreshTokenLifetime"),
|
|
904
|
-
refresh_token_usage=item.get("refreshTokenUsage"),
|
|
905
|
-
refresh_token_expiration=item.get("refreshTokenExpiration"),
|
|
906
|
-
allowed_cors_origins=item.get("allowedCorsOrigins"),
|
|
907
|
-
allowed_access_tokens_via_browser=item.get("allowAccessTokensViaBrowser"),
|
|
908
|
-
claims=item.get("claims"),
|
|
909
|
-
client_claims_prefix=item.get("clientClaimsPrefix")
|
|
910
|
-
)
|
|
911
|
-
return result
|
|
516
|
+
return OIDCClient.from_dict(response.json())
|
|
517
|
+
return None
|
|
912
518
|
|
|
913
519
|
def update_an_oidc_client(
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
520
|
+
self,
|
|
521
|
+
oidc_client_id: int,
|
|
522
|
+
update_access_token_claims_on_refresh: bool,
|
|
523
|
+
access_token_type: int,
|
|
524
|
+
include_jwt_id: bool,
|
|
525
|
+
always_include_user_claims_in_id_token: bool,
|
|
526
|
+
client_id: str,
|
|
527
|
+
client_name: str,
|
|
528
|
+
allow_offline_access: bool,
|
|
529
|
+
client_secrets: List[str],
|
|
530
|
+
allow_grant_types: List[str],
|
|
531
|
+
allowed_scopes: List[str],
|
|
532
|
+
enabled: bool,
|
|
533
|
+
require_client_secret: bool,
|
|
534
|
+
redirect_uris: List[str],
|
|
535
|
+
post_logout_redirect_uris: List[str],
|
|
536
|
+
front_channel_logout_uri: str,
|
|
537
|
+
front_channel_logout_session_required: bool,
|
|
538
|
+
back_channel_logout_uri: str,
|
|
539
|
+
back_channel_logout_session_required: bool,
|
|
540
|
+
identity_token_life_time: int,
|
|
541
|
+
access_token_life_time: int,
|
|
542
|
+
authorization_code_life_time: int,
|
|
543
|
+
absolute_refresh_token_life_time: int,
|
|
544
|
+
sliding_refresh_token_life_time: int,
|
|
545
|
+
refresh_token_usage: int,
|
|
546
|
+
refresh_token_expiration: int,
|
|
547
|
+
allowed_cors_origins: List[str],
|
|
548
|
+
allowed_access_tokens_via_browser: bool,
|
|
549
|
+
claims: List[str],
|
|
550
|
+
client_claims_prefix: str,
|
|
925
551
|
) -> bool:
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
bool
|
|
962
|
-
"""
|
|
963
|
-
result = False
|
|
964
|
-
put_data = json.dumps(
|
|
965
|
-
{
|
|
966
|
-
"updateAccessTokenClaimsOnRefresh": update_access_token_claims_on_refresh,
|
|
967
|
-
"accessTokenType": access_token_type,
|
|
968
|
-
"includeJwtId": include_jwt_id,
|
|
969
|
-
"alwaysIncludeUserClaimsInIdToken": always_include_user_claims_in_id_token,
|
|
970
|
-
"clientId": client_id,
|
|
971
|
-
"clientName": client_name,
|
|
972
|
-
"allowOfflineAccess": allow_offline_access,
|
|
973
|
-
"clientSecrets": client_secrets,
|
|
974
|
-
"allowedGrantTypes": allow_grant_types,
|
|
975
|
-
"allowedScopes": allowed_scopes,
|
|
976
|
-
"enabled": enabled,
|
|
977
|
-
"requireClientSecret": require_client_secret,
|
|
978
|
-
"redirectUris": redirect_uris,
|
|
979
|
-
"postLogoutRedirectUris": post_logout_redirect_uris,
|
|
980
|
-
"frontChannelLogoutUri": front_channel_logout_uri,
|
|
981
|
-
"frontChannelLogoutSessionRequired": front_channel_logout_session_required,
|
|
982
|
-
"backChannelLogoutUri": back_channel_logout_uri,
|
|
983
|
-
"backChannelLogoutSessionRequired": back_channel_logout_session_required,
|
|
984
|
-
"identityTokenLifetime": identity_token_life_time,
|
|
985
|
-
"accessTokenLifetime": access_token_life_time,
|
|
986
|
-
"authorizationCodeLifetime": authorization_code_life_time,
|
|
987
|
-
"absoluteRefreshTokenLifetime": absolute_refresh_token_life_time,
|
|
988
|
-
"slidingRefreshTokenLifetime": sliding_refresh_token_life_time,
|
|
989
|
-
"refreshTokenUsage": refresh_token_usage,
|
|
990
|
-
"refreshTokenExpiration": refresh_token_expiration,
|
|
991
|
-
"allowedCorsOrigins": allowed_cors_origins,
|
|
992
|
-
"allowAccessTokensViaBrowser": allowed_access_tokens_via_browser,
|
|
993
|
-
"claims": claims,
|
|
994
|
-
"clientClaimsPrefix": client_claims_prefix
|
|
995
|
-
}
|
|
552
|
+
req = OIDCClientRequest(
|
|
553
|
+
updateAccessTokenClaimsOnRefresh=update_access_token_claims_on_refresh,
|
|
554
|
+
accessTokenType=access_token_type,
|
|
555
|
+
includeJwtId=include_jwt_id,
|
|
556
|
+
alwaysIncludeUserClaimsInIdToken=always_include_user_claims_in_id_token,
|
|
557
|
+
clientId=client_id,
|
|
558
|
+
clientName=client_name,
|
|
559
|
+
allowOfflineAccess=allow_offline_access,
|
|
560
|
+
clientSecrets=client_secrets,
|
|
561
|
+
allowedGrantTypes=allow_grant_types,
|
|
562
|
+
allowedScopes=allowed_scopes,
|
|
563
|
+
enabled=enabled,
|
|
564
|
+
requireClientSecret=require_client_secret,
|
|
565
|
+
redirectUris=redirect_uris,
|
|
566
|
+
postLogoutRedirectUris=post_logout_redirect_uris,
|
|
567
|
+
frontChannelLogoutUri=front_channel_logout_uri,
|
|
568
|
+
frontChannelLogoutSessionRequired=front_channel_logout_session_required,
|
|
569
|
+
backChannelLogoutUri=back_channel_logout_uri,
|
|
570
|
+
backChannelLogoutSessionRequired=back_channel_logout_session_required,
|
|
571
|
+
identityTokenLifetime=identity_token_life_time,
|
|
572
|
+
accessTokenLifetime=access_token_life_time,
|
|
573
|
+
authorizationCodeLifetime=authorization_code_life_time,
|
|
574
|
+
absoluteRefreshTokenLifetime=absolute_refresh_token_life_time,
|
|
575
|
+
slidingRefreshTokenLifetime=sliding_refresh_token_life_time,
|
|
576
|
+
refreshTokenUsage=refresh_token_usage,
|
|
577
|
+
refreshTokenExpiration=refresh_token_expiration,
|
|
578
|
+
allowedCorsOrigins=allowed_cors_origins,
|
|
579
|
+
allowAccessTokensViaBrowser=allowed_access_tokens_via_browser,
|
|
580
|
+
claims=claims,
|
|
581
|
+
clientClaimsPrefix=client_claims_prefix,
|
|
582
|
+
)
|
|
583
|
+
url = self.ac_url + "/OIDCClients/{id}".format(id=oidc_client_id)
|
|
584
|
+
response = self.api_client.call_api(
|
|
585
|
+
"PUT", url, data=json.dumps(asdict(req)),
|
|
586
|
+
headers={"Content-Type": "application/json"},
|
|
996
587
|
)
|
|
997
|
-
|
|
998
|
-
relative_url = self.sast_ac + "/OIDCClients/{id}".format(id=oidc_client_id)
|
|
999
|
-
response = self.api_client.put_request(relative_url=relative_url, data=put_data, is_iam=self.is_iam)
|
|
1000
588
|
return response.status_code == NO_CONTENT
|
|
1001
589
|
|
|
1002
590
|
def delete_an_oidc_client(self, oidc_client_id: int) -> bool:
|
|
1003
|
-
""
|
|
1004
|
-
|
|
1005
|
-
Args:
|
|
1006
|
-
oidc_client_id (int):
|
|
1007
|
-
|
|
1008
|
-
Returns:
|
|
1009
|
-
bool
|
|
1010
|
-
"""
|
|
1011
|
-
result = False
|
|
1012
|
-
relative_url = self.sast_ac + "/OIDCClients/{id}".format(id=oidc_client_id)
|
|
1013
|
-
response = self.api_client.delete_request(relative_url=relative_url, is_iam=self.is_iam)
|
|
591
|
+
url = self.ac_url + "/OIDCClients/{id}".format(id=oidc_client_id)
|
|
592
|
+
response = self.api_client.call_api("DELETE", url)
|
|
1014
593
|
return response.status_code == NO_CONTENT
|
|
1015
594
|
|
|
1016
595
|
def get_all_permissions(self) -> List[Permission]:
|
|
1017
|
-
""
|
|
1018
|
-
|
|
1019
|
-
Returns:
|
|
1020
|
-
List[Permission]
|
|
1021
|
-
"""
|
|
1022
|
-
result = []
|
|
1023
|
-
relative_url = self.sast_ac + "/Permissions"
|
|
1024
|
-
response = self.api_client.get_request(relative_url=relative_url, is_iam=self.is_iam)
|
|
596
|
+
url = self.ac_url + "/Permissions"
|
|
597
|
+
response = self.api_client.call_api("GET", url)
|
|
1025
598
|
if response.status_code == OK:
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
permission_id=item.get("id"),
|
|
1029
|
-
service_provider_id=item.get("serviceProviderId"),
|
|
1030
|
-
name=item.get("name"),
|
|
1031
|
-
category=item.get("category"),
|
|
1032
|
-
) for item in response.json()
|
|
1033
|
-
]
|
|
1034
|
-
return result
|
|
599
|
+
return [Permission.from_dict(item) for item in response.json()]
|
|
600
|
+
return []
|
|
1035
601
|
|
|
1036
602
|
def get_permission_by_id(self, permission_id: int) -> Permission:
|
|
1037
|
-
""
|
|
1038
|
-
|
|
1039
|
-
Args:
|
|
1040
|
-
permission_id (int):
|
|
1041
|
-
|
|
1042
|
-
Returns:
|
|
1043
|
-
Permission
|
|
1044
|
-
"""
|
|
1045
|
-
result = None
|
|
1046
|
-
relative_url = self.sast_ac + "/Permissions/{id}".format(id=permission_id)
|
|
1047
|
-
response = self.api_client.get_request(relative_url=relative_url, is_iam=self.is_iam)
|
|
603
|
+
url = self.ac_url + "/Permissions/{id}".format(id=permission_id)
|
|
604
|
+
response = self.api_client.call_api("GET", url)
|
|
1048
605
|
if response.status_code == OK:
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
permission_id=item.get("id"),
|
|
1052
|
-
service_provider_id=item.get("serviceProviderId"),
|
|
1053
|
-
name=item.get("name"),
|
|
1054
|
-
category=item.get("category")
|
|
1055
|
-
)
|
|
1056
|
-
return result
|
|
606
|
+
return Permission.from_dict(response.json())
|
|
607
|
+
return None
|
|
1057
608
|
|
|
1058
609
|
def get_all_roles(self) -> List[Role]:
|
|
1059
|
-
""
|
|
1060
|
-
|
|
1061
|
-
Returns:
|
|
1062
|
-
List[Role]
|
|
1063
|
-
"""
|
|
1064
|
-
result = []
|
|
1065
|
-
relative_url = self.sast_ac + "/Roles"
|
|
1066
|
-
response = self.api_client.get_request(relative_url=relative_url, is_iam=self.is_iam)
|
|
610
|
+
url = self.ac_url + "/Roles"
|
|
611
|
+
response = self.api_client.call_api("GET", url)
|
|
1067
612
|
if response.status_code == OK:
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
role_id=item.get("id"),
|
|
1071
|
-
is_system_role=item.get("isSystemRole"),
|
|
1072
|
-
name=item.get("name"),
|
|
1073
|
-
description=item.get("description"),
|
|
1074
|
-
permission_ids=item.get("permissionIds")
|
|
1075
|
-
) for item in response.json()
|
|
1076
|
-
]
|
|
1077
|
-
return result
|
|
1078
|
-
|
|
1079
|
-
def get_role_id_by_name(self, name: Union[str, List[str]]) -> Union[int, List[int], None]:
|
|
1080
|
-
"""
|
|
1081
|
-
|
|
1082
|
-
Args:
|
|
1083
|
-
name (str, list of str):
|
|
1084
|
-
|
|
1085
|
-
Returns:
|
|
1086
|
-
int, list of int
|
|
1087
|
-
"""
|
|
613
|
+
return [Role.from_dict(item) for item in response.json()]
|
|
614
|
+
return []
|
|
1088
615
|
|
|
616
|
+
def get_role_id_by_name(
|
|
617
|
+
self, name: Union[str, List[str]]
|
|
618
|
+
) -> Union[int, List[int], None]:
|
|
1089
619
|
all_roles = self.get_all_roles()
|
|
1090
620
|
|
|
1091
621
|
if isinstance(name, str):
|
|
@@ -1099,828 +629,389 @@ class AccessControl:
|
|
|
1099
629
|
|
|
1100
630
|
if not roles:
|
|
1101
631
|
return None
|
|
1102
|
-
|
|
1103
632
|
if len(roles) == 1:
|
|
1104
633
|
return roles[0].id
|
|
1105
|
-
|
|
1106
|
-
if len(roles) > 1:
|
|
1107
|
-
return [role.id for role in roles]
|
|
634
|
+
return [role.id for role in roles]
|
|
1108
635
|
|
|
1109
636
|
def create_new_role(self, name: str, description: str, permission_ids: List[int]) -> bool:
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
permission_ids (list of int):
|
|
1116
|
-
|
|
1117
|
-
Returns:
|
|
1118
|
-
boolean
|
|
1119
|
-
"""
|
|
1120
|
-
post_data = json.dumps(
|
|
1121
|
-
{
|
|
1122
|
-
"name": name,
|
|
1123
|
-
"description": description,
|
|
1124
|
-
"permissionIds": permission_ids
|
|
1125
|
-
}
|
|
637
|
+
req = RoleRequest(name=name, description=description, permissionIds=permission_ids)
|
|
638
|
+
url = self.ac_url + "/Roles"
|
|
639
|
+
response = self.api_client.call_api(
|
|
640
|
+
"POST", url, data=json.dumps(asdict(req)),
|
|
641
|
+
headers={"Content-Type": "application/json"},
|
|
1126
642
|
)
|
|
1127
|
-
relative_url = self.sast_ac + "/Roles"
|
|
1128
|
-
response = self.api_client.post_request(relative_url=relative_url, data=post_data, is_iam=self.is_iam)
|
|
1129
643
|
return response.status_code == CREATED
|
|
1130
644
|
|
|
1131
645
|
def get_role_by_id(self, role_id: int) -> Role:
|
|
1132
|
-
""
|
|
1133
|
-
|
|
1134
|
-
Args:
|
|
1135
|
-
role_id (int): unique id of the role
|
|
1136
|
-
|
|
1137
|
-
Returns:
|
|
1138
|
-
Role
|
|
1139
|
-
"""
|
|
1140
|
-
result = None
|
|
1141
|
-
relative_url = self.sast_ac + "/Roles/{id}".format(id=role_id)
|
|
1142
|
-
response = self.api_client.get_request(relative_url=relative_url, is_iam=self.is_iam)
|
|
646
|
+
url = self.ac_url + "/Roles/{id}".format(id=role_id)
|
|
647
|
+
response = self.api_client.call_api("GET", url)
|
|
1143
648
|
if response.status_code == OK:
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
role_id=item.get("id"),
|
|
1147
|
-
is_system_role=item.get("isSystemRole"),
|
|
1148
|
-
name=item.get("name"),
|
|
1149
|
-
description=item.get("description"),
|
|
1150
|
-
permission_ids=item.get("permissionIds")
|
|
1151
|
-
)
|
|
1152
|
-
return result
|
|
1153
|
-
|
|
1154
|
-
def update_a_role(self, role_id: int, name: str, description: str, permission_ids: List[int]) -> bool:
|
|
1155
|
-
"""
|
|
649
|
+
return Role.from_dict(response.json())
|
|
650
|
+
return None
|
|
1156
651
|
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
"""
|
|
1166
|
-
result = False
|
|
1167
|
-
put_data = json.dumps(
|
|
1168
|
-
{
|
|
1169
|
-
"name": name,
|
|
1170
|
-
"description": description,
|
|
1171
|
-
"permissionIds": permission_ids
|
|
1172
|
-
}
|
|
652
|
+
def update_a_role(
|
|
653
|
+
self, role_id: int, name: str, description: str, permission_ids: List[int]
|
|
654
|
+
) -> bool:
|
|
655
|
+
req = RoleRequest(name=name, description=description, permissionIds=permission_ids)
|
|
656
|
+
url = self.ac_url + "/Roles/{id}".format(id=role_id)
|
|
657
|
+
response = self.api_client.call_api(
|
|
658
|
+
"PUT", url, data=json.dumps(asdict(req)),
|
|
659
|
+
headers={"Content-Type": "application/json"},
|
|
1173
660
|
)
|
|
1174
|
-
|
|
1175
|
-
response = self.api_client.put_request(relative_url=relative_url, data=put_data, is_iam=self.is_iam)
|
|
1176
|
-
if response.status_code == NO_CONTENT:
|
|
1177
|
-
result = True
|
|
1178
|
-
return result
|
|
661
|
+
return response.status_code == NO_CONTENT
|
|
1179
662
|
|
|
1180
663
|
def delete_a_role(self, role_id: int) -> bool:
|
|
1181
|
-
""
|
|
1182
|
-
|
|
1183
|
-
Args:
|
|
1184
|
-
role_id (int):
|
|
1185
|
-
|
|
1186
|
-
Returns:
|
|
1187
|
-
Boolean
|
|
1188
|
-
"""
|
|
1189
|
-
result = False
|
|
1190
|
-
relative_url = self.sast_ac + "/Roles/{id}".format(id=role_id)
|
|
1191
|
-
response = self.api_client.delete_request(relative_url=relative_url, is_iam=self.is_iam)
|
|
664
|
+
url = self.ac_url + "/Roles/{id}".format(id=role_id)
|
|
665
|
+
response = self.api_client.call_api("DELETE", url)
|
|
1192
666
|
return response.status_code == NO_CONTENT
|
|
1193
667
|
|
|
1194
668
|
def get_all_saml_identity_providers(self) -> List[SAMLIdentityProvider]:
|
|
1195
|
-
""
|
|
1196
|
-
|
|
1197
|
-
Returns:
|
|
1198
|
-
List[SAMLIdentityProvider]
|
|
1199
|
-
"""
|
|
1200
|
-
result = []
|
|
1201
|
-
relative_url = self.sast_ac + "/SamlIdentityProviders"
|
|
1202
|
-
response = self.api_client.get_request(relative_url=relative_url, is_iam=self.is_iam)
|
|
669
|
+
url = self.ac_url + "/SamlIdentityProviders"
|
|
670
|
+
response = self.api_client.call_api("GET", url)
|
|
1203
671
|
if response.status_code == OK:
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
saml_identity_provider_id=item.get("id"),
|
|
1207
|
-
certificate_file_name=item.get("certificateFileName"),
|
|
1208
|
-
certificate_subject=item.get("certificateSubject"),
|
|
1209
|
-
active=item.get("active"),
|
|
1210
|
-
name=item.get("name"),
|
|
1211
|
-
issuer=item.get("issuer"),
|
|
1212
|
-
login_url=item.get("loginUrl"),
|
|
1213
|
-
logout_url=item.get("logoutUrl"),
|
|
1214
|
-
error_url=item.get("errorUrl"),
|
|
1215
|
-
sign_authn_request=item.get("signAuthnRequest"),
|
|
1216
|
-
authn_request_binding=item.get("authnRequestBinding"),
|
|
1217
|
-
is_manual_management=item.get("isManualManagement"),
|
|
1218
|
-
default_team_id=item.get("defaultTeamId"),
|
|
1219
|
-
default_role_id=item.get("defaultRoleId")
|
|
1220
|
-
) for item in response.json()
|
|
1221
|
-
]
|
|
1222
|
-
return result
|
|
672
|
+
return [SAMLIdentityProvider.from_dict(item) for item in response.json()]
|
|
673
|
+
return []
|
|
1223
674
|
|
|
1224
675
|
def create_new_saml_identity_provider(
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
676
|
+
self,
|
|
677
|
+
certificate_file_path: str,
|
|
678
|
+
active: bool,
|
|
679
|
+
name: str,
|
|
680
|
+
issuer: str,
|
|
681
|
+
login_url: str,
|
|
682
|
+
logout_url: str,
|
|
683
|
+
error_url: str,
|
|
684
|
+
sign_authn_request: bool,
|
|
685
|
+
authn_request_binding: str,
|
|
686
|
+
is_manual_management: bool,
|
|
687
|
+
default_team_id: int,
|
|
688
|
+
default_role_id: int,
|
|
1228
689
|
) -> bool:
|
|
1229
|
-
"""
|
|
1230
|
-
|
|
1231
|
-
Args:
|
|
1232
|
-
certificate_file_path (str):
|
|
1233
|
-
active (bool):
|
|
1234
|
-
name (str):
|
|
1235
|
-
issuer (str):
|
|
1236
|
-
login_url (str):
|
|
1237
|
-
logout_url (str, None):
|
|
1238
|
-
error_url (str, None):
|
|
1239
|
-
sign_authn_request (bool):
|
|
1240
|
-
authn_request_binding (str):
|
|
1241
|
-
is_manual_management (bool):
|
|
1242
|
-
default_team_id (int):
|
|
1243
|
-
default_role_id (int):
|
|
1244
|
-
|
|
1245
|
-
Returns:
|
|
1246
|
-
bool
|
|
1247
|
-
"""
|
|
1248
|
-
result = False
|
|
1249
690
|
file_name = os.path.basename(certificate_file_path)
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
691
|
+
url = self.ac_url + "/SamlIdentityProviders"
|
|
692
|
+
response = self.api_client.call_api(
|
|
693
|
+
"POST",
|
|
694
|
+
url,
|
|
695
|
+
files={"CertificateFile": (file_name, open(certificate_file_path, "rb"))},
|
|
696
|
+
data={
|
|
697
|
+
"Active": str(active),
|
|
1254
698
|
"Name": name,
|
|
1255
699
|
"Issuer": issuer,
|
|
1256
700
|
"LoginUrl": login_url,
|
|
1257
701
|
"LogoutUrl": logout_url,
|
|
1258
702
|
"ErrorUrl": error_url,
|
|
1259
|
-
"SignAuthnRequest": sign_authn_request,
|
|
703
|
+
"SignAuthnRequest": str(sign_authn_request),
|
|
1260
704
|
"AuthnRequestBinding": authn_request_binding,
|
|
1261
|
-
"IsManualManagement": is_manual_management,
|
|
1262
|
-
"DefaultTeamId": default_team_id,
|
|
1263
|
-
"DefaultRoleId": default_role_id
|
|
1264
|
-
}
|
|
705
|
+
"IsManualManagement": str(is_manual_management),
|
|
706
|
+
"DefaultTeamId": str(default_team_id),
|
|
707
|
+
"DefaultRoleId": str(default_role_id),
|
|
708
|
+
},
|
|
1265
709
|
)
|
|
1266
|
-
headers = {"Content-Type": m.content_type}
|
|
1267
|
-
relative_url = self.sast_ac + "/SamlIdentityProviders"
|
|
1268
|
-
response = self.api_client.post_request(relative_url=relative_url, data=m, headers=headers, is_iam=self.is_iam)
|
|
1269
710
|
return response.status_code == CREATED
|
|
1270
711
|
|
|
1271
712
|
def get_saml_identity_provider_by_id(self, saml_identity_provider_id: int) -> SAMLIdentityProvider:
|
|
1272
|
-
""
|
|
1273
|
-
|
|
1274
|
-
Args:
|
|
1275
|
-
saml_identity_provider_id (int):
|
|
1276
|
-
|
|
1277
|
-
Returns:
|
|
1278
|
-
SAMLIdentityProvider
|
|
1279
|
-
"""
|
|
1280
|
-
result = None
|
|
1281
|
-
relative_url = self.sast_ac + "/SamlIdentityProviders/{id}".format(id=saml_identity_provider_id)
|
|
1282
|
-
response = self.api_client.get_request(relative_url=relative_url, is_iam=self.is_iam)
|
|
713
|
+
url = self.ac_url + "/SamlIdentityProviders/{id}".format(id=saml_identity_provider_id)
|
|
714
|
+
response = self.api_client.call_api("GET", url)
|
|
1283
715
|
if response.status_code == OK:
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
saml_identity_provider_id=item.get("id"),
|
|
1287
|
-
certificate_file_name=item.get("certificateFileName"),
|
|
1288
|
-
certificate_subject=item.get("certificateSubject"),
|
|
1289
|
-
active=item.get("active"),
|
|
1290
|
-
name=item.get("name"),
|
|
1291
|
-
issuer=item.get("issuer"),
|
|
1292
|
-
login_url=item.get("loginUrl"),
|
|
1293
|
-
logout_url=item.get("logoutUrl"),
|
|
1294
|
-
error_url=item.get("errorUrl"),
|
|
1295
|
-
sign_authn_request=item.get("signAuthnRequest"),
|
|
1296
|
-
authn_request_binding=item.get("authnRequestBinding"),
|
|
1297
|
-
is_manual_management=item.get("isManualManagement"),
|
|
1298
|
-
default_team_id=item.get("defaultTeamId"),
|
|
1299
|
-
default_role_id=item.get("defaultRoleId")
|
|
1300
|
-
)
|
|
1301
|
-
return result
|
|
716
|
+
return SAMLIdentityProvider.from_dict(response.json())
|
|
717
|
+
return None
|
|
1302
718
|
|
|
1303
719
|
def update_new_saml_identity_provider(
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
720
|
+
self,
|
|
721
|
+
saml_identity_provider_id: int,
|
|
722
|
+
certificate_file: str,
|
|
723
|
+
active: bool,
|
|
724
|
+
name: str,
|
|
725
|
+
issuer: str,
|
|
726
|
+
login_url: str,
|
|
727
|
+
logout_url: str,
|
|
728
|
+
error_url: str,
|
|
729
|
+
sign_authn_request: bool,
|
|
730
|
+
authn_request_binding: str,
|
|
731
|
+
is_manual_management: bool,
|
|
732
|
+
default_team_id: int,
|
|
733
|
+
default_role_id: int,
|
|
1307
734
|
) -> bool:
|
|
1308
|
-
"""
|
|
1309
|
-
|
|
1310
|
-
Args:
|
|
1311
|
-
saml_identity_provider_id (int):
|
|
1312
|
-
certificate_file (str):
|
|
1313
|
-
active (bool):
|
|
1314
|
-
name (str):
|
|
1315
|
-
issuer (str):
|
|
1316
|
-
login_url (str):
|
|
1317
|
-
logout_url (str):
|
|
1318
|
-
error_url (str):
|
|
1319
|
-
sign_authn_request (bool):
|
|
1320
|
-
authn_request_binding (str):
|
|
1321
|
-
is_manual_management (bool):
|
|
1322
|
-
default_team_id (int):
|
|
1323
|
-
default_role_id (int):
|
|
1324
|
-
|
|
1325
|
-
Returns:
|
|
1326
|
-
bool
|
|
1327
|
-
"""
|
|
1328
|
-
result = False
|
|
1329
735
|
file_name = os.path.basename(certificate_file)
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
736
|
+
url = self.ac_url + "/SamlIdentityProviders/{id}".format(id=saml_identity_provider_id)
|
|
737
|
+
response = self.api_client.call_api(
|
|
738
|
+
"PUT",
|
|
739
|
+
url,
|
|
740
|
+
files={"CertificateFile": (file_name, open(certificate_file, "rb"))},
|
|
741
|
+
data={
|
|
742
|
+
"Active": str(active),
|
|
1334
743
|
"Name": name,
|
|
1335
744
|
"Issuer": issuer,
|
|
1336
745
|
"LoginUrl": login_url,
|
|
1337
746
|
"LogoutUrl": logout_url,
|
|
1338
747
|
"ErrorUrl": error_url,
|
|
1339
|
-
"SignAuthnRequest": sign_authn_request,
|
|
748
|
+
"SignAuthnRequest": str(sign_authn_request),
|
|
1340
749
|
"AuthnRequestBinding": authn_request_binding,
|
|
1341
|
-
"IsManualManagement": is_manual_management,
|
|
1342
|
-
"DefaultTeamId": default_team_id,
|
|
1343
|
-
"DefaultRoleId": default_role_id
|
|
1344
|
-
}
|
|
750
|
+
"IsManualManagement": str(is_manual_management),
|
|
751
|
+
"DefaultTeamId": str(default_team_id),
|
|
752
|
+
"DefaultRoleId": str(default_role_id),
|
|
753
|
+
},
|
|
1345
754
|
)
|
|
1346
|
-
headers = {"Content-Type": m.content_type}
|
|
1347
|
-
relative_url = self.sast_ac + "/SamlIdentityProviders/{id}".format(id=saml_identity_provider_id)
|
|
1348
|
-
response = self.api_client.put_request(relative_url=relative_url, data=m, headers=headers, is_iam=self.is_iam)
|
|
1349
755
|
return response.status_code == NO_CONTENT
|
|
1350
756
|
|
|
1351
757
|
def delete_a_saml_identity_provider(self, saml_identity_provider_id: int) -> bool:
|
|
1352
|
-
""
|
|
1353
|
-
|
|
1354
|
-
Args:
|
|
1355
|
-
saml_identity_provider_id (int):
|
|
1356
|
-
|
|
1357
|
-
Returns:
|
|
1358
|
-
bool
|
|
1359
|
-
"""
|
|
1360
|
-
result = False
|
|
1361
|
-
relative_url = self.sast_ac + "/SamlIdentityProviders/{id}".format(id=saml_identity_provider_id)
|
|
1362
|
-
response = self.api_client.delete_request(relative_url=relative_url, is_iam=self.is_iam)
|
|
758
|
+
url = self.ac_url + "/SamlIdentityProviders/{id}".format(id=saml_identity_provider_id)
|
|
759
|
+
response = self.api_client.call_api("DELETE", url)
|
|
1363
760
|
return response.status_code == NO_CONTENT
|
|
1364
761
|
|
|
1365
762
|
def get_details_of_saml_role_mappings(self, saml_identity_provider_id: int = None) -> List[SAMLRoleMapping]:
|
|
1366
|
-
""
|
|
1367
|
-
|
|
1368
|
-
Args:
|
|
1369
|
-
saml_identity_provider_id (int):
|
|
1370
|
-
|
|
1371
|
-
Returns:
|
|
1372
|
-
`list` of `SAMLRoleMapping`
|
|
1373
|
-
"""
|
|
1374
|
-
result = []
|
|
1375
|
-
relative_url = self.sast_ac + "/SamlRoleMappings"
|
|
763
|
+
url = self.ac_url + "/SamlRoleMappings"
|
|
1376
764
|
if saml_identity_provider_id:
|
|
1377
|
-
|
|
1378
|
-
response = self.api_client.
|
|
765
|
+
url += "?samlProviderId={}".format(saml_identity_provider_id)
|
|
766
|
+
response = self.api_client.call_api("GET", url)
|
|
1379
767
|
if response.status_code == OK:
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
saml_role_mapping_id=item.get('id'),
|
|
1383
|
-
saml_identity_provider_id=item.get('samlIdentityProviderId'),
|
|
1384
|
-
role_id=item.get('roleId'),
|
|
1385
|
-
role_name=item.get('roleName'),
|
|
1386
|
-
saml_attribute_value=item.get('samlAttributeValue')
|
|
1387
|
-
) for item in response.json()
|
|
1388
|
-
]
|
|
1389
|
-
return result
|
|
768
|
+
return [SAMLRoleMapping.from_dict(item) for item in response.json()]
|
|
769
|
+
return []
|
|
1390
770
|
|
|
1391
771
|
def set_saml_group_and_role_mapping_details(
|
|
1392
|
-
|
|
772
|
+
self,
|
|
773
|
+
saml_identity_provider_id: int,
|
|
774
|
+
sample_role_mapping_details: List[dict] = (),
|
|
1393
775
|
) -> bool:
|
|
1394
|
-
"""
|
|
1395
|
-
|
|
1396
|
-
Args:
|
|
1397
|
-
saml_identity_provider_id (int):
|
|
1398
|
-
sample_role_mapping_details (`list` of dict):
|
|
1399
|
-
[
|
|
1400
|
-
{
|
|
1401
|
-
"roleName": "string",
|
|
1402
|
-
"samlAttributeValue": "string"
|
|
1403
|
-
}
|
|
1404
|
-
]
|
|
1405
|
-
|
|
1406
|
-
Returns:
|
|
1407
|
-
bool
|
|
1408
|
-
"""
|
|
1409
|
-
result = False
|
|
1410
776
|
put_data = json.dumps(
|
|
1411
777
|
[
|
|
1412
|
-
{
|
|
1413
|
-
"roleName": item.get("roleName"),
|
|
1414
|
-
"samlAttributeValue": item.get("samlAttributeValue")
|
|
1415
|
-
}
|
|
778
|
+
{"roleName": item.get("roleName"), "samlAttributeValue": item.get("samlAttributeValue")}
|
|
1416
779
|
for item in sample_role_mapping_details
|
|
1417
780
|
]
|
|
1418
781
|
)
|
|
1419
|
-
|
|
782
|
+
url = self.ac_url + "/SamlIdentityProviders/{samlProviderId}/RoleMappings".format(
|
|
1420
783
|
samlProviderId=saml_identity_provider_id
|
|
1421
784
|
)
|
|
1422
|
-
response = self.api_client.
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
return
|
|
785
|
+
response = self.api_client.call_api(
|
|
786
|
+
"PUT", url, data=put_data, headers={"Content-Type": "application/json"}
|
|
787
|
+
)
|
|
788
|
+
return response.status_code == NO_CONTENT
|
|
1426
789
|
|
|
1427
790
|
def get_saml_service_provider_metadata(self) -> bytes:
|
|
1428
|
-
""
|
|
1429
|
-
|
|
1430
|
-
Returns:
|
|
1431
|
-
byte
|
|
1432
|
-
"""
|
|
1433
|
-
result = None
|
|
1434
|
-
relative_url = self.sast_ac + "/SamlServiceProvider/metadata"
|
|
1435
|
-
response = self.api_client.get_request(relative_url=relative_url, is_iam=self.is_iam)
|
|
791
|
+
url = self.ac_url + "/SamlServiceProvider/metadata"
|
|
792
|
+
response = self.api_client.call_api("GET", url)
|
|
1436
793
|
if response.status_code == OK:
|
|
1437
|
-
|
|
1438
|
-
return
|
|
794
|
+
return response.content
|
|
795
|
+
return None
|
|
1439
796
|
|
|
1440
797
|
def get_saml_service_provider(self) -> SAMLServiceProvider:
|
|
1441
|
-
""
|
|
1442
|
-
|
|
1443
|
-
Returns:
|
|
1444
|
-
SAMLServiceProvider
|
|
1445
|
-
"""
|
|
1446
|
-
result = None
|
|
1447
|
-
relative_url = self.sast_ac + "/SamlServiceProvider"
|
|
1448
|
-
response = self.api_client.get_request(relative_url=relative_url, is_iam=self.is_iam)
|
|
798
|
+
url = self.ac_url + "/SamlServiceProvider"
|
|
799
|
+
response = self.api_client.call_api("GET", url)
|
|
1449
800
|
if response.status_code == OK:
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
assertion_consumer_service_url=item.get("assertionConsumerServiceUrl"),
|
|
1453
|
-
certificate_file_name=item.get("certificateFileName"),
|
|
1454
|
-
certificate_subject=item.get("certificateSubject"),
|
|
1455
|
-
issuer=item.get("issuer")
|
|
1456
|
-
)
|
|
1457
|
-
return result
|
|
801
|
+
return SAMLServiceProvider.from_dict(response.json())
|
|
802
|
+
return None
|
|
1458
803
|
|
|
1459
804
|
def update_a_saml_service_provider(
|
|
1460
|
-
|
|
805
|
+
self, certificate_file: str, certificate_password: str, issuer: str
|
|
1461
806
|
) -> bool:
|
|
1462
|
-
"""
|
|
1463
|
-
|
|
1464
|
-
Args:
|
|
1465
|
-
|
|
1466
|
-
certificate_file (str):
|
|
1467
|
-
certificate_password (str):
|
|
1468
|
-
issuer (str):
|
|
1469
|
-
|
|
1470
|
-
Returns:
|
|
1471
|
-
bool
|
|
1472
|
-
"""
|
|
1473
|
-
result = False
|
|
1474
807
|
file_name = os.path.basename(certificate_file)
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
}
|
|
808
|
+
url = self.ac_url + "/SamlServiceProvider"
|
|
809
|
+
response = self.api_client.call_api(
|
|
810
|
+
"PUT",
|
|
811
|
+
url,
|
|
812
|
+
files={"CertificateFile": (file_name, open(certificate_file, "rb"))},
|
|
813
|
+
data={"CertificatePassword": certificate_password, "Issuer": issuer},
|
|
1481
814
|
)
|
|
1482
|
-
|
|
1483
|
-
relative_url = self.sast_ac + "/SamlServiceProvider"
|
|
1484
|
-
response = self.api_client.put_request(relative_url=relative_url, data=m, headers=headers, is_iam=self.is_iam)
|
|
1485
|
-
if response.status_code == NO_CONTENT:
|
|
1486
|
-
result = True
|
|
1487
|
-
return result
|
|
815
|
+
return response.status_code == NO_CONTENT
|
|
1488
816
|
|
|
1489
817
|
def get_details_of_saml_team_mappings(self, saml_identity_provider_id: int = None) -> List[SAMLTeamMapping]:
|
|
1490
|
-
""
|
|
1491
|
-
|
|
1492
|
-
Args:
|
|
1493
|
-
saml_identity_provider_id (int):
|
|
1494
|
-
|
|
1495
|
-
Returns:
|
|
1496
|
-
List[SAMLTeamMapping]
|
|
1497
|
-
"""
|
|
1498
|
-
result = []
|
|
1499
|
-
relative_url = self.sast_ac + "/SamlTeamMappings"
|
|
818
|
+
url = self.ac_url + "/SamlTeamMappings"
|
|
1500
819
|
if saml_identity_provider_id:
|
|
1501
|
-
|
|
1502
|
-
response = self.api_client.
|
|
820
|
+
url += "?samlProviderId={}".format(saml_identity_provider_id)
|
|
821
|
+
response = self.api_client.call_api("GET", url)
|
|
1503
822
|
if response.status_code == OK:
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
saml_team_mapping_id=item.get("id"),
|
|
1507
|
-
saml_identity_provider_id=item.get("samlIdentityProviderId"),
|
|
1508
|
-
team_id=item.get("teamId"),
|
|
1509
|
-
team_full_path=item.get("teamFullPath"),
|
|
1510
|
-
saml_attribute_value=item.get("samlAttributeValue")
|
|
1511
|
-
) for item in response.json()
|
|
1512
|
-
]
|
|
1513
|
-
return result
|
|
823
|
+
return [SAMLTeamMapping.from_dict(item) for item in response.json()]
|
|
824
|
+
return []
|
|
1514
825
|
|
|
1515
826
|
def set_saml_group_and_team_mapping_details(
|
|
1516
|
-
|
|
827
|
+
self, saml_identity_provider_id: int, saml_team_mapping_details: List[dict] = ()
|
|
1517
828
|
) -> bool:
|
|
1518
|
-
"""
|
|
1519
|
-
|
|
1520
|
-
Args:
|
|
1521
|
-
saml_identity_provider_id (int):
|
|
1522
|
-
saml_team_mapping_details (`list` of dict):
|
|
1523
|
-
[
|
|
1524
|
-
{
|
|
1525
|
-
"teamFullPath": "string",
|
|
1526
|
-
"samlAttributeValue": "string"
|
|
1527
|
-
}
|
|
1528
|
-
]
|
|
1529
|
-
Returns:
|
|
1530
|
-
bool
|
|
1531
|
-
"""
|
|
1532
|
-
result = False
|
|
1533
829
|
put_data = json.dumps(
|
|
1534
830
|
[
|
|
1535
|
-
{
|
|
1536
|
-
"teamFullPath": item.get("teamFullPath"),
|
|
1537
|
-
"samlAttributeValue": item.get("samlAttributeValue")
|
|
1538
|
-
}
|
|
831
|
+
{"teamFullPath": item.get("teamFullPath"), "samlAttributeValue": item.get("samlAttributeValue")}
|
|
1539
832
|
for item in saml_team_mapping_details
|
|
1540
833
|
]
|
|
1541
834
|
)
|
|
1542
|
-
|
|
1543
|
-
|
|
835
|
+
url = self.ac_url + "/SamlIdentityProviders/{id}/TeamMappings".format(id=saml_identity_provider_id)
|
|
836
|
+
response = self.api_client.call_api(
|
|
837
|
+
"PUT", url, data=put_data, headers={"Content-Type": "application/json"}
|
|
1544
838
|
)
|
|
1545
|
-
response
|
|
1546
|
-
if response.status_code == NO_CONTENT:
|
|
1547
|
-
result = True
|
|
1548
|
-
return result
|
|
839
|
+
return response.status_code == NO_CONTENT
|
|
1549
840
|
|
|
1550
841
|
def get_all_service_providers(self) -> List[ServiceProvider]:
|
|
1551
|
-
""
|
|
1552
|
-
|
|
1553
|
-
Returns:
|
|
1554
|
-
List[ServiceProvider]
|
|
1555
|
-
"""
|
|
1556
|
-
result = []
|
|
1557
|
-
relative_url = self.sast_ac + "/ServiceProviders"
|
|
1558
|
-
response = self.api_client.get_request(relative_url=relative_url, is_iam=self.is_iam)
|
|
842
|
+
url = self.ac_url + "/ServiceProviders"
|
|
843
|
+
response = self.api_client.call_api("GET", url)
|
|
1559
844
|
if response.status_code == OK:
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
service_provider_id=item.get("id"),
|
|
1563
|
-
name=item.get("name")
|
|
1564
|
-
) for item in response.json()
|
|
1565
|
-
]
|
|
1566
|
-
return result
|
|
845
|
+
return [ServiceProvider.from_dict(item) for item in response.json()]
|
|
846
|
+
return []
|
|
1567
847
|
|
|
1568
848
|
def get_service_provider_by_id(self, service_provider_id: int) -> ServiceProvider:
|
|
1569
|
-
""
|
|
1570
|
-
|
|
1571
|
-
Args:
|
|
1572
|
-
service_provider_id (int):
|
|
1573
|
-
|
|
1574
|
-
Returns:
|
|
1575
|
-
ServiceProvider
|
|
1576
|
-
"""
|
|
1577
|
-
result = None
|
|
1578
|
-
relative_url = self.sast_ac + "/ServiceProviders/{id}".format(id=service_provider_id)
|
|
1579
|
-
response = self.api_client.get_request(relative_url=relative_url, is_iam=self.is_iam)
|
|
849
|
+
url = self.ac_url + "/ServiceProviders/{id}".format(id=service_provider_id)
|
|
850
|
+
response = self.api_client.call_api("GET", url)
|
|
1580
851
|
if response.status_code == OK:
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
service_provider_id=item.get("id"),
|
|
1584
|
-
name=item.get("name")
|
|
1585
|
-
)
|
|
1586
|
-
return result
|
|
852
|
+
return ServiceProvider.from_dict(response.json())
|
|
853
|
+
return None
|
|
1587
854
|
|
|
1588
855
|
def get_all_smtp_settings(self) -> List[SMTPSetting]:
|
|
1589
|
-
""
|
|
1590
|
-
|
|
1591
|
-
Returns:
|
|
1592
|
-
List[SMTPSetting]
|
|
1593
|
-
"""
|
|
1594
|
-
result = []
|
|
1595
|
-
relative_url = self.sast_ac + "/SMTPSettings"
|
|
1596
|
-
response = self.api_client.get_request(relative_url=relative_url, is_iam=self.is_iam)
|
|
856
|
+
url = self.ac_url + "/SMTPSettings"
|
|
857
|
+
response = self.api_client.call_api("GET", url)
|
|
1597
858
|
if response.status_code == OK:
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
smtp_settings_id=item.get("id"),
|
|
1601
|
-
host=item.get("host"),
|
|
1602
|
-
port=item.get("port"),
|
|
1603
|
-
encryption_type=item.get("encryptionType"),
|
|
1604
|
-
from_address=item.get("fromAddress"),
|
|
1605
|
-
use_default_credentials=item.get("useDefaultCredentials"),
|
|
1606
|
-
username=item.get("username")
|
|
1607
|
-
) for item in response.json()
|
|
1608
|
-
]
|
|
1609
|
-
return result
|
|
859
|
+
return [SMTPSetting.from_dict(item) for item in response.json()]
|
|
860
|
+
return []
|
|
1610
861
|
|
|
1611
862
|
def create_smtp_settings(
|
|
1612
|
-
|
|
1613
|
-
|
|
863
|
+
self,
|
|
864
|
+
password: str,
|
|
865
|
+
host: str,
|
|
866
|
+
port: int,
|
|
867
|
+
encryption_type: str,
|
|
868
|
+
from_address: str,
|
|
869
|
+
use_default_credentials: str,
|
|
870
|
+
username: str,
|
|
1614
871
|
) -> bool:
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
"""
|
|
1629
|
-
result = False
|
|
1630
|
-
post_data = json.dumps(
|
|
1631
|
-
{
|
|
1632
|
-
"password": password,
|
|
1633
|
-
"host": host,
|
|
1634
|
-
"port": port,
|
|
1635
|
-
"encryptionType": encryption_type,
|
|
1636
|
-
"fromAddress": from_address,
|
|
1637
|
-
"useDefaultCredentials": use_default_credentials,
|
|
1638
|
-
"username": username
|
|
1639
|
-
}
|
|
872
|
+
req = SMTPSettingRequest(
|
|
873
|
+
password=password,
|
|
874
|
+
host=host,
|
|
875
|
+
port=port,
|
|
876
|
+
encryptionType=encryption_type,
|
|
877
|
+
fromAddress=from_address,
|
|
878
|
+
useDefaultCredentials=use_default_credentials,
|
|
879
|
+
username=username,
|
|
880
|
+
)
|
|
881
|
+
url = self.ac_url + "/SMTPSettings"
|
|
882
|
+
response = self.api_client.call_api(
|
|
883
|
+
"POST", url, data=json.dumps(asdict(req)),
|
|
884
|
+
headers={"Content-Type": "application/json"},
|
|
1640
885
|
)
|
|
1641
|
-
relative_url = self.sast_ac + "/SMTPSettings"
|
|
1642
|
-
response = self.api_client.post_request(relative_url=relative_url, data=post_data, is_iam=self.is_iam)
|
|
1643
886
|
return response.status_code == CREATED
|
|
1644
887
|
|
|
1645
888
|
def get_smtp_settings_by_id(self, smtp_settings_id: int) -> SMTPSetting:
|
|
1646
|
-
""
|
|
1647
|
-
|
|
1648
|
-
Args:
|
|
1649
|
-
smtp_settings_id (int):
|
|
1650
|
-
|
|
1651
|
-
Returns:
|
|
1652
|
-
SMTPSetting
|
|
1653
|
-
"""
|
|
1654
|
-
result = None
|
|
1655
|
-
relative_url = self.sast_ac + "/SMTPSettings/{id}".format(id=smtp_settings_id)
|
|
1656
|
-
response = self.api_client.get_request(relative_url=relative_url, is_iam=self.is_iam)
|
|
889
|
+
url = self.ac_url + "/SMTPSettings/{id}".format(id=smtp_settings_id)
|
|
890
|
+
response = self.api_client.call_api("GET", url)
|
|
1657
891
|
if response.status_code == OK:
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
smtp_settings_id=item.get("id"),
|
|
1661
|
-
host=item.get("host"),
|
|
1662
|
-
port=item.get("port"),
|
|
1663
|
-
encryption_type=item.get("encryptionType"),
|
|
1664
|
-
from_address=item.get("fromAddress"),
|
|
1665
|
-
use_default_credentials=item.get("useDefaultCredentials"),
|
|
1666
|
-
username=item.get("username")
|
|
1667
|
-
)
|
|
1668
|
-
return result
|
|
892
|
+
return SMTPSetting.from_dict(response.json())
|
|
893
|
+
return None
|
|
1669
894
|
|
|
1670
895
|
def update_smtp_settings(
|
|
1671
|
-
|
|
1672
|
-
|
|
896
|
+
self,
|
|
897
|
+
smtp_settings_id: int,
|
|
898
|
+
password: str,
|
|
899
|
+
host: str,
|
|
900
|
+
port: int,
|
|
901
|
+
encryption_type: str,
|
|
902
|
+
from_address: str,
|
|
903
|
+
use_default_credentials: str,
|
|
904
|
+
username: str,
|
|
1673
905
|
) -> bool:
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
bool
|
|
1688
|
-
"""
|
|
1689
|
-
result = False
|
|
1690
|
-
put_data = json.dumps(
|
|
1691
|
-
{
|
|
1692
|
-
"password": password,
|
|
1693
|
-
"host": host,
|
|
1694
|
-
"port": port,
|
|
1695
|
-
"encryptionType": encryption_type,
|
|
1696
|
-
"fromAddress": from_address,
|
|
1697
|
-
"useDefaultCredentials": use_default_credentials,
|
|
1698
|
-
"username": username
|
|
1699
|
-
}
|
|
906
|
+
req = SMTPSettingRequest(
|
|
907
|
+
password=password,
|
|
908
|
+
host=host,
|
|
909
|
+
port=port,
|
|
910
|
+
encryptionType=encryption_type,
|
|
911
|
+
fromAddress=from_address,
|
|
912
|
+
useDefaultCredentials=use_default_credentials,
|
|
913
|
+
username=username,
|
|
914
|
+
)
|
|
915
|
+
url = self.ac_url + "/SMTPSettings/{id}".format(id=smtp_settings_id)
|
|
916
|
+
response = self.api_client.call_api(
|
|
917
|
+
"PUT", url, data=json.dumps(asdict(req)),
|
|
918
|
+
headers={"Content-Type": "application/json"},
|
|
1700
919
|
)
|
|
1701
|
-
relative_url = self.sast_ac + "/SMTPSettings/{id}".format(id=smtp_settings_id)
|
|
1702
|
-
response = self.api_client.put_request(relative_url=relative_url, data=put_data, is_iam=self.is_iam)
|
|
1703
920
|
return response.status_code == NO_CONTENT
|
|
1704
921
|
|
|
1705
922
|
def delete_smtp_settings(self, smtp_settings_id: int) -> bool:
|
|
1706
|
-
""
|
|
1707
|
-
|
|
1708
|
-
Args:
|
|
1709
|
-
smtp_settings_id (int):
|
|
1710
|
-
|
|
1711
|
-
Returns:
|
|
1712
|
-
bool
|
|
1713
|
-
"""
|
|
1714
|
-
result = False
|
|
1715
|
-
relative_url = self.sast_ac + "/SMTPSettings/{id}".format(id=smtp_settings_id)
|
|
1716
|
-
response = self.api_client.delete_request(relative_url=relative_url, is_iam=self.is_iam)
|
|
923
|
+
url = self.ac_url + "/SMTPSettings/{id}".format(id=smtp_settings_id)
|
|
924
|
+
response = self.api_client.call_api("DELETE", url)
|
|
1717
925
|
return response.status_code == NO_CONTENT
|
|
1718
926
|
|
|
1719
927
|
def test_smtp_connection(
|
|
1720
|
-
|
|
1721
|
-
|
|
928
|
+
self,
|
|
929
|
+
receiver_email: str,
|
|
930
|
+
password: str,
|
|
931
|
+
host: str,
|
|
932
|
+
port: int,
|
|
933
|
+
encryption_type: str,
|
|
934
|
+
from_address: str,
|
|
935
|
+
use_default_credentials: str,
|
|
936
|
+
username: str,
|
|
1722
937
|
) -> bool:
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
"""
|
|
1738
|
-
result = False
|
|
1739
|
-
post_data = json.dumps(
|
|
1740
|
-
{
|
|
1741
|
-
"recieverEmail": receiver_email,
|
|
1742
|
-
"password": password,
|
|
1743
|
-
"host": host,
|
|
1744
|
-
"port": port,
|
|
1745
|
-
"encryptionType": encryption_type,
|
|
1746
|
-
"fromAddress": from_address,
|
|
1747
|
-
"useDefaultCredentials": use_default_credentials,
|
|
1748
|
-
"username": username
|
|
1749
|
-
}
|
|
938
|
+
req = SMTPSettingRequest(
|
|
939
|
+
recieverEmail=receiver_email,
|
|
940
|
+
password=password,
|
|
941
|
+
host=host,
|
|
942
|
+
port=port,
|
|
943
|
+
encryptionType=encryption_type,
|
|
944
|
+
fromAddress=from_address,
|
|
945
|
+
useDefaultCredentials=use_default_credentials,
|
|
946
|
+
username=username,
|
|
947
|
+
)
|
|
948
|
+
url = self.ac_url + "/SMTPSettings/testconnection"
|
|
949
|
+
response = self.api_client.call_api(
|
|
950
|
+
"POST", url, data=json.dumps(asdict(req)),
|
|
951
|
+
headers={"Content-Type": "application/json"},
|
|
1750
952
|
)
|
|
1751
|
-
relative_url = self.sast_ac + "/SMTPSettings/testconnection"
|
|
1752
|
-
response = self.api_client.post_request(relative_url=relative_url, data=post_data, is_iam=self.is_iam)
|
|
1753
953
|
return response.status_code == OK
|
|
1754
954
|
|
|
1755
955
|
def get_all_system_locales(self) -> List[SystemLocale]:
|
|
1756
|
-
""
|
|
1757
|
-
|
|
1758
|
-
Returns:
|
|
1759
|
-
List[SystemLocale]
|
|
1760
|
-
"""
|
|
1761
|
-
result = []
|
|
1762
|
-
relative_url = self.sast_ac + "/SystemLocales"
|
|
1763
|
-
response = self.api_client.get_request(relative_url=relative_url, is_iam=self.is_iam)
|
|
956
|
+
url = self.ac_url + "/SystemLocales"
|
|
957
|
+
response = self.api_client.call_api("GET", url)
|
|
1764
958
|
if response.status_code == OK:
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
system_locale_id=item.get("id"),
|
|
1768
|
-
lcid=item.get("lcid"),
|
|
1769
|
-
code=item.get("code"),
|
|
1770
|
-
display_name=item.get("displayName")
|
|
1771
|
-
) for item in response.json()
|
|
1772
|
-
]
|
|
1773
|
-
return result
|
|
959
|
+
return [SystemLocale.from_dict(item) for item in response.json()]
|
|
960
|
+
return []
|
|
1774
961
|
|
|
1775
962
|
def get_members_by_team_id(self, team_id: int) -> List[User]:
|
|
1776
|
-
""
|
|
1777
|
-
|
|
1778
|
-
Args:
|
|
1779
|
-
team_id (int):
|
|
1780
|
-
|
|
1781
|
-
Returns:
|
|
1782
|
-
List[User]
|
|
1783
|
-
"""
|
|
1784
|
-
result = []
|
|
1785
|
-
relative_url = self.sast_ac + "/Teams/{id}/Users".format(id=team_id)
|
|
1786
|
-
response = self.api_client.get_request(relative_url=relative_url, is_iam=self.is_iam)
|
|
963
|
+
url = self.ac_url + "/Teams/{id}/Users".format(id=team_id)
|
|
964
|
+
response = self.api_client.call_api("GET", url)
|
|
1787
965
|
if response.status_code == OK:
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
Args:
|
|
1797
|
-
team_id (int):
|
|
1798
|
-
user_ids (list[int]):
|
|
1799
|
-
|
|
1800
|
-
Returns:
|
|
1801
|
-
bool
|
|
1802
|
-
"""
|
|
1803
|
-
result = False
|
|
1804
|
-
put_data = json.dumps(
|
|
1805
|
-
{"userIds": user_ids}
|
|
966
|
+
return [User.from_dict(item) for item in response.json()]
|
|
967
|
+
return []
|
|
968
|
+
|
|
969
|
+
def update_members_by_team_id(self, team_id: int, user_ids: List[int]) -> bool:
|
|
970
|
+
put_data = json.dumps({"userIds": user_ids})
|
|
971
|
+
url = self.ac_url + "/Teams/{teamId}/Users".format(teamId=team_id)
|
|
972
|
+
response = self.api_client.call_api(
|
|
973
|
+
"PUT", url, data=put_data, headers={"Content-Type": "application/json"}
|
|
1806
974
|
)
|
|
1807
|
-
|
|
1808
|
-
response = self.api_client.put_request(relative_url=relative_url, data=put_data, is_iam=self.is_iam)
|
|
1809
|
-
if response.status_code == NO_CONTENT:
|
|
1810
|
-
result = True
|
|
1811
|
-
return result
|
|
975
|
+
return response.status_code == NO_CONTENT
|
|
1812
976
|
|
|
1813
977
|
def add_a_user_to_a_team(self, team_id: int, user_id: int) -> bool:
|
|
1814
|
-
""
|
|
1815
|
-
|
|
1816
|
-
Args:
|
|
1817
|
-
team_id (int):
|
|
1818
|
-
user_id (int):
|
|
1819
|
-
|
|
1820
|
-
Returns:
|
|
1821
|
-
bool
|
|
1822
|
-
"""
|
|
1823
|
-
result = False
|
|
1824
|
-
relative_url = self.sast_ac + "/Teams/{teamId}/Users/{userId}".format(
|
|
1825
|
-
teamId=team_id, userId=user_id
|
|
1826
|
-
)
|
|
1827
|
-
response = self.api_client.post_request(relative_url=relative_url, data=None, is_iam=self.is_iam)
|
|
978
|
+
url = self.ac_url + "/Teams/{teamId}/Users/{userId}".format(teamId=team_id, userId=user_id)
|
|
979
|
+
response = self.api_client.call_api("POST", url, data=None)
|
|
1828
980
|
return response.status_code == NO_CONTENT
|
|
1829
981
|
|
|
1830
982
|
def delete_a_member_from_a_team(self, team_id: int, user_id: int) -> bool:
|
|
1831
|
-
""
|
|
1832
|
-
|
|
1833
|
-
Args:
|
|
1834
|
-
team_id (int):
|
|
1835
|
-
user_id (int):
|
|
1836
|
-
|
|
1837
|
-
Returns:
|
|
1838
|
-
bool
|
|
1839
|
-
"""
|
|
1840
|
-
result = False
|
|
1841
|
-
relative_url = self.sast_ac + "/Teams/{teamId}/Users/{userId}".format(
|
|
1842
|
-
teamId=team_id,
|
|
1843
|
-
userId=user_id
|
|
1844
|
-
)
|
|
1845
|
-
response = self.api_client.delete_request(relative_url=relative_url, is_iam=self.is_iam)
|
|
983
|
+
url = self.ac_url + "/Teams/{teamId}/Users/{userId}".format(teamId=team_id, userId=user_id)
|
|
984
|
+
response = self.api_client.call_api("DELETE", url)
|
|
1846
985
|
return response.status_code == NO_CONTENT
|
|
1847
986
|
|
|
1848
987
|
def get_all_teams(self) -> List[Team]:
|
|
1849
|
-
""
|
|
1850
|
-
|
|
1851
|
-
Returns:
|
|
1852
|
-
List[Team]
|
|
1853
|
-
"""
|
|
1854
|
-
result = []
|
|
1855
|
-
relative_url = self.sast_ac + "/Teams"
|
|
1856
|
-
response = self.api_client.get_request(relative_url=relative_url, is_iam=self.is_iam)
|
|
988
|
+
url = self.ac_url + "/Teams"
|
|
989
|
+
response = self.api_client.call_api("GET", url)
|
|
1857
990
|
if response.status_code == OK:
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
team_id=item.get("id"),
|
|
1861
|
-
name=item.get("name"),
|
|
1862
|
-
full_name=item.get("fullName"),
|
|
1863
|
-
parent_id=item.get("parentId")
|
|
1864
|
-
) for item in response.json()
|
|
1865
|
-
]
|
|
1866
|
-
return result
|
|
991
|
+
return [Team.from_dict(item) for item in response.json()]
|
|
992
|
+
return []
|
|
1867
993
|
|
|
1868
994
|
def get_team_id_by_full_name(self, full_name: str) -> int:
|
|
1869
|
-
"""
|
|
1870
|
-
|
|
1871
|
-
Args:
|
|
1872
|
-
full_name (str):
|
|
1873
|
-
|
|
1874
|
-
Returns:
|
|
1875
|
-
int
|
|
1876
|
-
"""
|
|
1877
|
-
team_id = None
|
|
1878
|
-
|
|
1879
995
|
all_teams = self.get_all_teams()
|
|
1880
|
-
|
|
1881
996
|
team = [item for item in all_teams if item.full_name == full_name]
|
|
1882
|
-
if team
|
|
1883
|
-
team_id = team[0].id
|
|
1884
|
-
|
|
1885
|
-
return team_id
|
|
997
|
+
return team[0].id if team else None
|
|
1886
998
|
|
|
1887
999
|
def create_new_team(self, name: str, parent_id: int) -> bool:
|
|
1888
|
-
"""
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
parent_id (int):
|
|
1893
|
-
|
|
1894
|
-
Returns:
|
|
1895
|
-
bool
|
|
1896
|
-
"""
|
|
1897
|
-
result = False
|
|
1898
|
-
post_data = json.dumps(
|
|
1899
|
-
{
|
|
1900
|
-
"name": name,
|
|
1901
|
-
"parentId": parent_id
|
|
1902
|
-
}
|
|
1000
|
+
post_data = json.dumps({"name": name, "parentId": parent_id})
|
|
1001
|
+
url = self.ac_url + "/Teams"
|
|
1002
|
+
response = self.api_client.call_api(
|
|
1003
|
+
"POST", url, data=post_data, headers={"Content-Type": "application/json"}
|
|
1903
1004
|
)
|
|
1904
|
-
relative_url = self.sast_ac + "/Teams"
|
|
1905
|
-
response = self.api_client.post_request(relative_url=relative_url, data=post_data, is_iam=self.is_iam)
|
|
1906
1005
|
return response.status_code == CREATED
|
|
1907
1006
|
|
|
1908
1007
|
def create_teams_recursively(self, team_full_name: str) -> List[int]:
|
|
1909
|
-
"""
|
|
1910
|
-
create new team by team full name recursively. Check the team existence start from root team /CxServer
|
|
1911
|
-
Args:
|
|
1912
|
-
team_full_name (str):
|
|
1913
|
-
|
|
1914
|
-
Returns:
|
|
1915
|
-
List[int]
|
|
1916
|
-
"""
|
|
1917
1008
|
result = []
|
|
1918
1009
|
if isinstance(team_full_name, str) and team_full_name.startswith("/CxServer"):
|
|
1919
1010
|
teams = team_full_name.split("/")
|
|
1920
1011
|
length = len(teams)
|
|
1921
1012
|
parent_team_id = self.get_team_id_by_full_name("/CxServer")
|
|
1922
1013
|
for index in list(range(2, length)):
|
|
1923
|
-
child_team_full_name = "/".join(teams[:index+1])
|
|
1014
|
+
child_team_full_name = "/".join(teams[: index + 1])
|
|
1924
1015
|
child_team_name = teams[index]
|
|
1925
1016
|
team_id = self.get_team_id_by_full_name(child_team_full_name)
|
|
1926
1017
|
if team_id is None:
|
|
@@ -1928,473 +1019,256 @@ class AccessControl:
|
|
|
1928
1019
|
team_id = self.get_team_id_by_full_name(child_team_full_name)
|
|
1929
1020
|
result.append(team_id)
|
|
1930
1021
|
parent_team_id = team_id
|
|
1931
|
-
|
|
1932
1022
|
return result
|
|
1933
1023
|
|
|
1934
1024
|
def get_team_by_id(self, team_id: int) -> Team:
|
|
1935
|
-
""
|
|
1936
|
-
|
|
1937
|
-
Args:
|
|
1938
|
-
team_id(int):
|
|
1939
|
-
|
|
1940
|
-
Returns:
|
|
1941
|
-
Team
|
|
1942
|
-
"""
|
|
1943
|
-
result = None
|
|
1944
|
-
relative_url = self.sast_ac + "/Teams/{id}".format(id=team_id)
|
|
1945
|
-
response = self.api_client.get_request(relative_url=relative_url, is_iam=self.is_iam)
|
|
1025
|
+
url = self.ac_url + "/Teams/{id}".format(id=team_id)
|
|
1026
|
+
response = self.api_client.call_api("GET", url)
|
|
1946
1027
|
if response.status_code == OK:
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
team_id=item.get("id"),
|
|
1950
|
-
name=item.get("name"),
|
|
1951
|
-
full_name=item.get("fullName"),
|
|
1952
|
-
parent_id=item.get("parentId")
|
|
1953
|
-
)
|
|
1954
|
-
return result
|
|
1028
|
+
return Team.from_dict(response.json())
|
|
1029
|
+
return None
|
|
1955
1030
|
|
|
1956
1031
|
def update_a_team(self, team_id: int, name: str, parent_id: int) -> bool:
|
|
1957
|
-
"""
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
name (str):
|
|
1962
|
-
parent_id (int):
|
|
1963
|
-
|
|
1964
|
-
Returns:
|
|
1965
|
-
bool
|
|
1966
|
-
"""
|
|
1967
|
-
result = False
|
|
1968
|
-
put_data = json.dumps(
|
|
1969
|
-
{
|
|
1970
|
-
"name": name,
|
|
1971
|
-
"parentId": parent_id
|
|
1972
|
-
}
|
|
1032
|
+
put_data = json.dumps({"name": name, "parentId": parent_id})
|
|
1033
|
+
url = self.ac_url + "/Teams/{id}".format(id=team_id)
|
|
1034
|
+
response = self.api_client.call_api(
|
|
1035
|
+
"PUT", url, data=put_data, headers={"Content-Type": "application/json"}
|
|
1973
1036
|
)
|
|
1974
|
-
|
|
1975
|
-
response = self.api_client.put_request(relative_url=relative_url, data=put_data, is_iam=self.is_iam)
|
|
1976
|
-
if response.status_code == NO_CONTENT:
|
|
1977
|
-
result = True
|
|
1978
|
-
return result
|
|
1037
|
+
return response.status_code == NO_CONTENT
|
|
1979
1038
|
|
|
1980
1039
|
def delete_a_team(self, team_id: int) -> bool:
|
|
1981
|
-
""
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
team_id (int):
|
|
1985
|
-
|
|
1986
|
-
Returns:
|
|
1987
|
-
bool
|
|
1988
|
-
"""
|
|
1989
|
-
result = False
|
|
1990
|
-
relative_url = self.sast_ac + "/Teams/{id}".format(id=team_id)
|
|
1991
|
-
response = self.api_client.delete_request(relative_url=relative_url, is_iam=self.is_iam)
|
|
1992
|
-
if response.status_code == NO_CONTENT:
|
|
1993
|
-
result = True
|
|
1994
|
-
return result
|
|
1040
|
+
url = self.ac_url + "/Teams/{id}".format(id=team_id)
|
|
1041
|
+
response = self.api_client.call_api("DELETE", url)
|
|
1042
|
+
return response.status_code == NO_CONTENT
|
|
1995
1043
|
|
|
1996
1044
|
def generate_a_new_token_signing_certificate(self) -> bool:
|
|
1997
|
-
""
|
|
1998
|
-
|
|
1999
|
-
Returns:
|
|
2000
|
-
bool
|
|
2001
|
-
"""
|
|
2002
|
-
relative_url = self.sast_ac + "/TokenSigningCertificateGeneration"
|
|
2003
|
-
response = self.api_client.post_request(relative_url=relative_url, is_iam=self.is_iam)
|
|
1045
|
+
url = self.ac_url + "/TokenSigningCertificateGeneration"
|
|
1046
|
+
response = self.api_client.call_api("POST", url)
|
|
2004
1047
|
return response.status_code == CREATED
|
|
2005
1048
|
|
|
2006
|
-
def upload_a_new_token_signing_certificate(
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
certificate_file_path (str):
|
|
2011
|
-
certificate_password (str):
|
|
2012
|
-
|
|
2013
|
-
Returns:
|
|
2014
|
-
bool
|
|
2015
|
-
"""
|
|
2016
|
-
result = False
|
|
2017
|
-
relative_url = self.sast_ac + "/TokenSigningCertificate"
|
|
1049
|
+
def upload_a_new_token_signing_certificate(
|
|
1050
|
+
self, certificate_file_path: str, certificate_password: str
|
|
1051
|
+
) -> bool:
|
|
1052
|
+
url = self.ac_url + "/TokenSigningCertificate"
|
|
2018
1053
|
file_name = os.path.basename(certificate_file_path)
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
|
|
1054
|
+
response = self.api_client.call_api(
|
|
1055
|
+
"POST",
|
|
1056
|
+
url,
|
|
1057
|
+
files={
|
|
1058
|
+
"CertificateFile": (file_name, open(certificate_file_path, "rb"), "application/zip")
|
|
1059
|
+
},
|
|
1060
|
+
data={"CertificatePassword": str(certificate_password)},
|
|
2024
1061
|
)
|
|
2025
|
-
headers = {"Content-Type": m.content_type}
|
|
2026
|
-
response = self.api_client.post_request(relative_url=relative_url, data=m, headers=headers, is_iam=self.is_iam)
|
|
2027
1062
|
return response.status_code == CREATED
|
|
2028
1063
|
|
|
2029
1064
|
def get_all_users(self) -> List[User]:
|
|
2030
|
-
""
|
|
2031
|
-
|
|
2032
|
-
Returns:
|
|
2033
|
-
List[User]
|
|
2034
|
-
"""
|
|
2035
|
-
result = []
|
|
2036
|
-
relative_url = self.sast_ac + "/Users"
|
|
2037
|
-
response = self.api_client.get_request(relative_url=relative_url, is_iam=self.is_iam)
|
|
1065
|
+
url = self.ac_url + "/Users"
|
|
1066
|
+
response = self.api_client.call_api("GET", url)
|
|
2038
1067
|
if response.status_code == OK:
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
]
|
|
2042
|
-
return result
|
|
1068
|
+
return [User.from_dict(item) for item in response.json()]
|
|
1069
|
+
return []
|
|
2043
1070
|
|
|
2044
1071
|
def get_user_id_by_name(self, username: str) -> int:
|
|
2045
|
-
"""
|
|
2046
|
-
|
|
2047
|
-
Args:
|
|
2048
|
-
username (str):
|
|
2049
|
-
|
|
2050
|
-
Returns:
|
|
2051
|
-
int
|
|
2052
|
-
"""
|
|
2053
|
-
user_id = None
|
|
2054
|
-
|
|
2055
1072
|
all_users = self.get_all_users()
|
|
2056
1073
|
user = [item for item in all_users if item.username == username]
|
|
2057
|
-
if user
|
|
2058
|
-
user_id = user[0].id
|
|
2059
|
-
return user_id
|
|
1074
|
+
return user[0].id if user else None
|
|
2060
1075
|
|
|
2061
1076
|
def create_new_user(
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
1077
|
+
self,
|
|
1078
|
+
username: str,
|
|
1079
|
+
password: str,
|
|
1080
|
+
role_ids: List[int],
|
|
1081
|
+
team_ids: List[int],
|
|
1082
|
+
authentication_provider_id: int,
|
|
1083
|
+
first_name: str,
|
|
1084
|
+
last_name: str,
|
|
1085
|
+
email: str,
|
|
1086
|
+
phone_number: str,
|
|
1087
|
+
cell_phone_number: str,
|
|
1088
|
+
job_title: str,
|
|
1089
|
+
other: str,
|
|
1090
|
+
country: str,
|
|
1091
|
+
active: str,
|
|
1092
|
+
expiration_date: str,
|
|
1093
|
+
allowed_ip_list: str,
|
|
1094
|
+
locale_id: int,
|
|
2066
1095
|
) -> bool:
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
"""
|
|
2091
|
-
result = False
|
|
2092
|
-
post_data = json.dumps(
|
|
2093
|
-
{
|
|
2094
|
-
"username": username,
|
|
2095
|
-
"password": password,
|
|
2096
|
-
"roleIds": role_ids,
|
|
2097
|
-
"teamIds": team_ids,
|
|
2098
|
-
"authenticationProviderId": authentication_provider_id,
|
|
2099
|
-
"firstName": first_name,
|
|
2100
|
-
"lastName": last_name,
|
|
2101
|
-
"email": email,
|
|
2102
|
-
"phoneNumber": phone_number,
|
|
2103
|
-
"cellPhoneNumber": cell_phone_number,
|
|
2104
|
-
"jobTitle": job_title,
|
|
2105
|
-
"other": other,
|
|
2106
|
-
"country": country,
|
|
2107
|
-
"active": active,
|
|
2108
|
-
"expirationDate": expiration_date,
|
|
2109
|
-
"allowedIpList": allowed_ip_list,
|
|
2110
|
-
"localeId": locale_id
|
|
2111
|
-
}
|
|
1096
|
+
req = UserRequest(
|
|
1097
|
+
username=username,
|
|
1098
|
+
password=password,
|
|
1099
|
+
roleIds=role_ids,
|
|
1100
|
+
teamIds=team_ids,
|
|
1101
|
+
authenticationProviderId=authentication_provider_id,
|
|
1102
|
+
firstName=first_name,
|
|
1103
|
+
lastName=last_name,
|
|
1104
|
+
email=email,
|
|
1105
|
+
phoneNumber=phone_number,
|
|
1106
|
+
cellPhoneNumber=cell_phone_number,
|
|
1107
|
+
jobTitle=job_title,
|
|
1108
|
+
other=other,
|
|
1109
|
+
country=country,
|
|
1110
|
+
active=active,
|
|
1111
|
+
expirationDate=expiration_date,
|
|
1112
|
+
allowedIpList=allowed_ip_list,
|
|
1113
|
+
localeId=locale_id,
|
|
1114
|
+
)
|
|
1115
|
+
url = self.ac_url + "/Users"
|
|
1116
|
+
response = self.api_client.call_api(
|
|
1117
|
+
"POST", url, data=json.dumps(asdict(req)),
|
|
1118
|
+
headers={"Content-Type": "application/json"},
|
|
2112
1119
|
)
|
|
2113
|
-
relative_url = self.sast_ac + "/Users"
|
|
2114
|
-
response = self.api_client.post_request(relative_url=relative_url, data=post_data, is_iam=self.is_iam)
|
|
2115
1120
|
return response.status_code == CREATED
|
|
2116
1121
|
|
|
2117
1122
|
def get_user_by_id(self, user_id: int) -> User:
|
|
2118
|
-
""
|
|
2119
|
-
|
|
2120
|
-
Args:
|
|
2121
|
-
user_id (int):
|
|
2122
|
-
|
|
2123
|
-
Returns:
|
|
2124
|
-
User
|
|
2125
|
-
"""
|
|
2126
|
-
result = None
|
|
2127
|
-
relative_url = self.sast_ac + "/Users/{id}".format(id=user_id)
|
|
2128
|
-
response = self.api_client.get_request(relative_url=relative_url, is_iam=self.is_iam)
|
|
1123
|
+
url = self.ac_url + "/Users/{id}".format(id=user_id)
|
|
1124
|
+
response = self.api_client.call_api("GET", url)
|
|
2129
1125
|
if response.status_code == OK:
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
return result
|
|
1126
|
+
return User.from_dict(response.json())
|
|
1127
|
+
return None
|
|
2133
1128
|
|
|
2134
1129
|
def update_a_user(
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
1130
|
+
self,
|
|
1131
|
+
user_id: int,
|
|
1132
|
+
role_ids: List[int],
|
|
1133
|
+
team_ids: List[int],
|
|
1134
|
+
first_name: str,
|
|
1135
|
+
last_name: str,
|
|
1136
|
+
email: str,
|
|
1137
|
+
phone_number: str,
|
|
1138
|
+
cell_phone_number: str,
|
|
1139
|
+
job_title: str,
|
|
1140
|
+
other: str,
|
|
1141
|
+
country: str,
|
|
1142
|
+
active: str,
|
|
1143
|
+
expiration_date: str,
|
|
1144
|
+
allowed_ip_list: str,
|
|
1145
|
+
locale_id: int,
|
|
2138
1146
|
) -> bool:
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
expiration_date (str):
|
|
2155
|
-
allowed_ip_list (str, None):
|
|
2156
|
-
locale_id (int):
|
|
2157
|
-
|
|
2158
|
-
Returns:
|
|
2159
|
-
bool
|
|
2160
|
-
"""
|
|
2161
|
-
result = False
|
|
2162
|
-
put_data = json.dumps(
|
|
2163
|
-
{
|
|
2164
|
-
"roleIds": role_ids,
|
|
2165
|
-
"teamIds": team_ids,
|
|
2166
|
-
"firstName": first_name,
|
|
2167
|
-
"lastName": last_name,
|
|
2168
|
-
"email": email,
|
|
2169
|
-
"phoneNumber": phone_number,
|
|
2170
|
-
"cellPhoneNumber": cell_phone_number,
|
|
2171
|
-
"jobTitle": job_title,
|
|
2172
|
-
"other": other,
|
|
2173
|
-
"country": country,
|
|
2174
|
-
"active": active,
|
|
2175
|
-
"expirationDate": expiration_date,
|
|
2176
|
-
"allowedIpList": allowed_ip_list,
|
|
2177
|
-
"localeId": locale_id
|
|
2178
|
-
}
|
|
1147
|
+
req = UserRequest(
|
|
1148
|
+
roleIds=role_ids,
|
|
1149
|
+
teamIds=team_ids,
|
|
1150
|
+
firstName=first_name,
|
|
1151
|
+
lastName=last_name,
|
|
1152
|
+
email=email,
|
|
1153
|
+
phoneNumber=phone_number,
|
|
1154
|
+
cellPhoneNumber=cell_phone_number,
|
|
1155
|
+
jobTitle=job_title,
|
|
1156
|
+
other=other,
|
|
1157
|
+
country=country,
|
|
1158
|
+
active=active,
|
|
1159
|
+
expirationDate=expiration_date,
|
|
1160
|
+
allowedIpList=allowed_ip_list,
|
|
1161
|
+
localeId=locale_id,
|
|
2179
1162
|
)
|
|
2180
|
-
|
|
2181
|
-
response = self.api_client.
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
|
|
1163
|
+
url = self.ac_url + "/Users/{id}".format(id=user_id)
|
|
1164
|
+
response = self.api_client.call_api(
|
|
1165
|
+
"PUT", url, data=json.dumps(asdict(req)),
|
|
1166
|
+
headers={"Content-Type": "application/json"},
|
|
1167
|
+
)
|
|
1168
|
+
return response.status_code == NO_CONTENT
|
|
2185
1169
|
|
|
2186
1170
|
def delete_a_user(self, user_id: int) -> bool:
|
|
2187
|
-
""
|
|
2188
|
-
|
|
2189
|
-
Args:
|
|
2190
|
-
user_id (int):
|
|
2191
|
-
|
|
2192
|
-
Returns:
|
|
2193
|
-
bool
|
|
2194
|
-
"""
|
|
2195
|
-
result = False
|
|
2196
|
-
relative_url = self.sast_ac + "/Users/{id}".format(id=user_id)
|
|
2197
|
-
response = self.api_client.delete_request(relative_url=relative_url, is_iam=self.is_iam)
|
|
1171
|
+
url = self.ac_url + "/Users/{id}".format(id=user_id)
|
|
1172
|
+
response = self.api_client.call_api("DELETE", url)
|
|
2198
1173
|
return response.status_code == NO_CONTENT
|
|
2199
1174
|
|
|
2200
1175
|
def migrate_existing_user(
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
1176
|
+
self,
|
|
1177
|
+
creation_date: str,
|
|
1178
|
+
username: str,
|
|
1179
|
+
password: str,
|
|
1180
|
+
role_ids: List[str],
|
|
1181
|
+
team_ids: List[str],
|
|
1182
|
+
authentication_provider_id: int,
|
|
1183
|
+
first_name: str,
|
|
1184
|
+
last_name: str,
|
|
1185
|
+
email: str,
|
|
1186
|
+
phone_number: str,
|
|
1187
|
+
cell_phone_number: str,
|
|
1188
|
+
job_title: str,
|
|
1189
|
+
other: str,
|
|
1190
|
+
country: str,
|
|
1191
|
+
active: str,
|
|
1192
|
+
expiration_date: str,
|
|
1193
|
+
allowed_ip_list: List[str],
|
|
1194
|
+
locale_id: str,
|
|
2205
1195
|
) -> bool:
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
"""
|
|
2231
|
-
result = False
|
|
2232
|
-
post_data = json.dumps(
|
|
2233
|
-
{
|
|
2234
|
-
"creationDate": creation_date,
|
|
2235
|
-
"username": username,
|
|
2236
|
-
"password": password,
|
|
2237
|
-
"roleIds": role_ids,
|
|
2238
|
-
"teamIds": team_ids,
|
|
2239
|
-
"authenticationProviderId": authentication_provider_id,
|
|
2240
|
-
"firstName": first_name,
|
|
2241
|
-
"lastName": last_name,
|
|
2242
|
-
"email": email,
|
|
2243
|
-
"phoneNumber": phone_number,
|
|
2244
|
-
"cellPhoneNumber": cell_phone_number,
|
|
2245
|
-
"jobTitle": job_title,
|
|
2246
|
-
"other": other,
|
|
2247
|
-
"country": country,
|
|
2248
|
-
"active": active,
|
|
2249
|
-
"expirationDate": expiration_date,
|
|
2250
|
-
"allowedIpList": allowed_ip_list,
|
|
2251
|
-
"localeId": locale_id
|
|
2252
|
-
}
|
|
1196
|
+
req = UserRequest(
|
|
1197
|
+
creationDate=creation_date,
|
|
1198
|
+
username=username,
|
|
1199
|
+
password=password,
|
|
1200
|
+
roleIds=role_ids,
|
|
1201
|
+
teamIds=team_ids,
|
|
1202
|
+
authenticationProviderId=authentication_provider_id,
|
|
1203
|
+
firstName=first_name,
|
|
1204
|
+
lastName=last_name,
|
|
1205
|
+
email=email,
|
|
1206
|
+
phoneNumber=phone_number,
|
|
1207
|
+
cellPhoneNumber=cell_phone_number,
|
|
1208
|
+
jobTitle=job_title,
|
|
1209
|
+
other=other,
|
|
1210
|
+
country=country,
|
|
1211
|
+
active=active,
|
|
1212
|
+
expirationDate=expiration_date,
|
|
1213
|
+
allowedIpList=allowed_ip_list,
|
|
1214
|
+
localeId=locale_id,
|
|
1215
|
+
)
|
|
1216
|
+
url = self.ac_url + "/Users/migration"
|
|
1217
|
+
response = self.api_client.call_api(
|
|
1218
|
+
"POST", url, data=json.dumps(asdict(req)),
|
|
1219
|
+
headers={"Content-Type": "application/json"},
|
|
2253
1220
|
)
|
|
2254
|
-
relative_url = self.sast_ac + "/Users/migration"
|
|
2255
|
-
response = self.api_client.post_request(relative_url=relative_url, data=post_data, is_iam=self.is_iam)
|
|
2256
1221
|
return response.status_code == CREATED
|
|
2257
1222
|
|
|
2258
1223
|
def get_all_windows_domains(self) -> List[WindowsDomain]:
|
|
2259
|
-
""
|
|
2260
|
-
|
|
2261
|
-
Returns:
|
|
2262
|
-
List[WindowsDomain]
|
|
2263
|
-
"""
|
|
2264
|
-
result = []
|
|
2265
|
-
relative_url = self.sast_ac + "/WindowsDomains"
|
|
2266
|
-
response = self.api_client.get_request(relative_url=relative_url, is_iam=self.is_iam)
|
|
1224
|
+
url = self.ac_url + "/WindowsDomains"
|
|
1225
|
+
response = self.api_client.call_api("GET", url)
|
|
2267
1226
|
if response.status_code == OK:
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
windows_domain_id=item.get("id"),
|
|
2271
|
-
name=item.get("name"),
|
|
2272
|
-
full_qualified_name=item.get("fullyQualifiedName")
|
|
2273
|
-
) for item in response.json()
|
|
2274
|
-
]
|
|
2275
|
-
return result
|
|
1227
|
+
return [WindowsDomain.from_dict(item) for item in response.json()]
|
|
1228
|
+
return []
|
|
2276
1229
|
|
|
2277
1230
|
def get_windows_domain_id_by_name(self, name: str) -> int:
|
|
2278
|
-
"""
|
|
2279
|
-
|
|
2280
|
-
Args:
|
|
2281
|
-
name (str):
|
|
2282
|
-
|
|
2283
|
-
Returns:
|
|
2284
|
-
int
|
|
2285
|
-
"""
|
|
2286
|
-
windows_domain_id = None
|
|
2287
|
-
|
|
2288
1231
|
windows_domains = self.get_all_windows_domains()
|
|
2289
1232
|
domains = [item for item in windows_domains if item.name == name]
|
|
2290
|
-
if domains
|
|
2291
|
-
windows_domain_id = domains[0].id
|
|
2292
|
-
return windows_domain_id
|
|
1233
|
+
return domains[0].id if domains else None
|
|
2293
1234
|
|
|
2294
1235
|
def create_a_new_windows_domain(self, name: str, full_qualified_name: str) -> bool:
|
|
2295
|
-
"""
|
|
2296
|
-
|
|
2297
|
-
|
|
2298
|
-
|
|
2299
|
-
full_qualified_name (str):
|
|
2300
|
-
|
|
2301
|
-
Returns:
|
|
2302
|
-
bool
|
|
2303
|
-
"""
|
|
2304
|
-
result = False
|
|
2305
|
-
post_data = json.dumps(
|
|
2306
|
-
{
|
|
2307
|
-
"name": name,
|
|
2308
|
-
"FullyQualifiedName": full_qualified_name
|
|
2309
|
-
}
|
|
1236
|
+
post_data = json.dumps({"name": name, "FullyQualifiedName": full_qualified_name})
|
|
1237
|
+
url = self.ac_url + "/WindowsDomains"
|
|
1238
|
+
response = self.api_client.call_api(
|
|
1239
|
+
"POST", url, data=post_data, headers={"Content-Type": "application/json"}
|
|
2310
1240
|
)
|
|
2311
|
-
|
|
2312
|
-
response = self.api_client.post_request(relative_url=relative_url, data=post_data, is_iam=self.is_iam)
|
|
2313
|
-
if response.status_code == CREATED:
|
|
2314
|
-
result = True
|
|
2315
|
-
return result
|
|
1241
|
+
return response.status_code == CREATED
|
|
2316
1242
|
|
|
2317
1243
|
def get_windows_domain_by_id(self, windows_domain_id: int) -> WindowsDomain:
|
|
2318
|
-
""
|
|
2319
|
-
|
|
2320
|
-
Args:
|
|
2321
|
-
windows_domain_id (int):
|
|
2322
|
-
|
|
2323
|
-
Returns:
|
|
2324
|
-
WindowsDomain
|
|
2325
|
-
"""
|
|
2326
|
-
result = None
|
|
2327
|
-
relative_url = self.sast_ac + "/WindowsDomains/{id}".format(id=windows_domain_id)
|
|
2328
|
-
response = self.api_client.get_request(relative_url=relative_url, is_iam=self.is_iam)
|
|
1244
|
+
url = self.ac_url + "/WindowsDomains/{id}".format(id=windows_domain_id)
|
|
1245
|
+
response = self.api_client.call_api("GET", url)
|
|
2329
1246
|
if response.status_code == OK:
|
|
2330
|
-
|
|
2331
|
-
|
|
2332
|
-
windows_domain_id=item.get("id"),
|
|
2333
|
-
name=item.get("name"),
|
|
2334
|
-
full_qualified_name=item.get("fullyQualifiedName")
|
|
2335
|
-
)
|
|
2336
|
-
return result
|
|
1247
|
+
return WindowsDomain.from_dict(response.json())
|
|
1248
|
+
return None
|
|
2337
1249
|
|
|
2338
|
-
def update_a_windows_domain(
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
Returns:
|
|
2347
|
-
bool
|
|
2348
|
-
"""
|
|
2349
|
-
result = False
|
|
2350
|
-
put_data = json.dumps(
|
|
2351
|
-
{
|
|
2352
|
-
"name": name,
|
|
2353
|
-
"fullyQualifiedName": full_qualified_name
|
|
2354
|
-
}
|
|
1250
|
+
def update_a_windows_domain(
|
|
1251
|
+
self, windows_domain_id: int, name: str, full_qualified_name: str
|
|
1252
|
+
) -> bool:
|
|
1253
|
+
put_data = json.dumps({"name": name, "fullyQualifiedName": full_qualified_name})
|
|
1254
|
+
url = self.ac_url + "/WindowsDomains/{id}".format(id=windows_domain_id)
|
|
1255
|
+
response = self.api_client.call_api(
|
|
1256
|
+
"PUT", url, data=put_data, headers={"Content-Type": "application/json"}
|
|
2355
1257
|
)
|
|
2356
|
-
relative_url = self.sast_ac + "/WindowsDomains/{id}".format(id=windows_domain_id)
|
|
2357
|
-
response = self.api_client.put_request(relative_url=relative_url, data=put_data, is_iam=self.is_iam)
|
|
2358
1258
|
return response.status_code == NO_CONTENT
|
|
2359
1259
|
|
|
2360
1260
|
def delete_a_windows_domain(self, windows_domain_id: int) -> bool:
|
|
2361
|
-
""
|
|
2362
|
-
|
|
2363
|
-
Args:
|
|
2364
|
-
windows_domain_id (int):
|
|
2365
|
-
|
|
2366
|
-
Returns:
|
|
2367
|
-
bool
|
|
2368
|
-
"""
|
|
2369
|
-
result = False
|
|
2370
|
-
relative_url = self.sast_ac + "/WindowsDomains/{id}".format(id=windows_domain_id)
|
|
2371
|
-
response = self.api_client.delete_request(relatvie_url=relative_url, is_iam=self.is_iam)
|
|
1261
|
+
url = self.ac_url + "/WindowsDomains/{id}".format(id=windows_domain_id)
|
|
1262
|
+
response = self.api_client.call_api("DELETE", url)
|
|
2372
1263
|
return response.status_code == NO_CONTENT
|
|
2373
1264
|
|
|
2374
1265
|
def get_windows_domain_user_entries_by_search_criteria(
|
|
2375
|
-
|
|
1266
|
+
self, windows_domain_id: int, contains_pattern: str = None
|
|
2376
1267
|
) -> List[User]:
|
|
2377
|
-
""
|
|
2378
|
-
|
|
2379
|
-
Args:
|
|
2380
|
-
windows_domain_id (int):
|
|
2381
|
-
contains_pattern (str):
|
|
2382
|
-
|
|
2383
|
-
Returns:
|
|
2384
|
-
List[User]
|
|
2385
|
-
"""
|
|
2386
|
-
result = []
|
|
2387
|
-
relative_url = self.sast_ac + "/WindowsDomains/{id}/UserEntries".format(id=windows_domain_id)
|
|
1268
|
+
url = self.ac_url + "/WindowsDomains/{id}/UserEntries".format(id=windows_domain_id)
|
|
2388
1269
|
if contains_pattern:
|
|
2389
|
-
|
|
2390
|
-
response = self.api_client.
|
|
1270
|
+
url += "?containsPattern={}".format(contains_pattern)
|
|
1271
|
+
response = self.api_client.call_api("GET", url)
|
|
2391
1272
|
if response.status_code == OK:
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
username=item.get("username"),
|
|
2395
|
-
first_name=item.get("firstname"),
|
|
2396
|
-
last_name=item.get("lastname"),
|
|
2397
|
-
email=item.get("email")
|
|
2398
|
-
) for item in response.json()
|
|
2399
|
-
]
|
|
2400
|
-
return result
|
|
1273
|
+
return [User.from_dict(item) for item in response.json()]
|
|
1274
|
+
return []
|