Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Alias ID and Alias ZID for Users (#2663)
* Checkout DB migrations for alias properties of Identity Provider table * Add DB migrations for alias properties of users table * Add alias properties to ScimUser class * Add alias properties to create operations in JdbcScimUserProvisioning * Add alias properties to update query in JdbcScimUserProvisioning * Add alias properties to deactivate and delete user operations in JdbcScimUserProvisioning * Add alias properties to change password query in JdbcScimUserProvisioning * Add alias properties to update password change required query in JdbcScimUserProvisioning * Fix unit tests * Add hasMirroredUser method to ScimUser * Improve check for number of updated records in change password handler * Add tests for alias property handling in JdbcScimUserProvisioning * Fix unit tests * Add check whether the password change required flag was also updated for the mirrored user * Move validity check of alias properties to separate class * Move mirroring handling to separate reusable class * Fix unit tests * Add javadoc to EntityMirroringHandler * Add mirroring handler for ScimUser class * Add missing override annotations to JdbcScimUserProvisioning * Fix wrong getter call in EntityMirroringHandler * Fix access token cache in IdentityProviderEndpointsAliasMockMvcTests * Make access token cache in IdentityProviderEndpointsAliasMockMvcTests non-static * Add factory method for cloning Approval * Add EntityMirroringResult class * Add additional validation checks to EntityMirroringHandler * Add mirrored entity to return value of EntityMirroringHandler.ensureConsistencyOfMirroredEntity * Add mirroring handling to ScimUser create endpoint * Add missing constructor parameters to ScimUserEndpoints * Make ScimUser.getAliasZid return aliasZid instead of null * Change wording from "mirrored" to "alias" * Add tests for IdentityProviderAliasHandler * Move unit tests for alias handling to separate class * Add further MockMvc tests for Creation/Update of IdPs with alias properties * Add tests for read operations * Fix IdentityProviderEndpointsTest * Fix Flyway migration * Remove obsolete IdentityProviderEndpointsAliasTest * Fix IdentityProviderAliasHandlerEnsureConsistencyTest * Remove obsolete IdentityProviderAliasHandlerTest * Add JsonIgnore annotation to EntityWithAlias#getAliasDescription * Fix JdbcScimUserProvisioningTests * Refactor * Remove obsolete IdentityProviderEndpointsTestBase * Revert changes to JdbcScimUserProvisioning * Add skeleton of ScimUserEndpointsAliasMockMvcTests * Introduce superclass for MockMvcTests of endpoints for entities with alias * Add alias properties to ScimUser JSON deserialization * Add MockMvc tests for ScimUser GET with disabled alias feature * Fix JdbcScimUserProvisioningTests * Add MockMvc tests for SCIM user create with alias * Add more detailed comparison of original and alias user to ScimUserEndpointsAliasMockMvcTests * Add 'aliasEntitiesEnabled' flag to ScimUserEndpoints * Add alias logic to deletion of SCIM users * Add MockMvc test about ignoring dangling reference during deletion * Add MockMvc test about also deleting alias user if original is deleted * Add MockMvc test about breaking reference to original user in alias user if original is deleted * Add MockMvc tests for SCIM user PUT with alias * Add MockMvc tests for SCIM User PUT with disabled alias feature * Refactor * Add MockMvc tests for SCIM user patch * Fix assignment of groups and approvals of alias SCIM users * Remove obsolete Approval.clone method * Add check if alias user only has default groups of alias zone to ScimUserEndpointsAliasMockMvcTests * Revert EntityAliasResult * Fix missing import * Fix unit tests * Revert adding retrievePasswordForUser method to ScimUserProvisioning * Revert making ScimUSer getters public * Remove usages of no longer accessible ScimUser getters * Reject user deletion if alias exists and alias feature is disabled * Adjust MockMvc tests to new deletion behavior * Adjust MockMvc test Update -> AliasFeatureDisabled -> ExistingAlias -> shouldAccept_OnlyAliasPropsSetToNull to new update behavior * Adjust MockMvc test Update -> AliasFeatureDisabled -> ExistingAlias -> shouldAccept_AliasPropsSetToNullAndOtherPropsChanged to new update behavior * Adjust MockMvc test Update -> AliasFeatureDisabled -> ExistingAlias -> shouldAccept_ShouldIgnoreAliasIdMissingInExistingUser to new update behavior * Adjust MockMvc test Update -> AliasFeatureDisabled -> ExistingAlias -> shouldAccept_ShouldIgnoreDanglingRef to new update behavior * Improve test case names * Remove unused method * Remove obsolete tests checking whether alias properties are ignored in SCIM user endpoints * Use 400 status code instead of 422 for rejected deletions of SCIM users with alias * Adjust endpoint docs for new alias fields * Remove obsolete test cases for JdbcScimUserProvisioning * Refactor alias handling in ScimUser create endpoint * Adjust SCIM operation counters to not count operations performed on alias users * Adjust ScimUserEndpointsAliasMockMvcTests.assertIsCorrectAliasPair to ScimUserAliasHandler.cloneEntity method * Fix endpoint docs for users delete endpoint * Add unit test for ScimUserEndpoints: should throw during creation if alias properties are invalid * Add unit test for ScimUserEndpoints: should throw during deletion if user has alias and alias feature disabled * Fix integration tests for postgresql * Fix unit tests * Remove unnecessary sync of approvals and groups from update endpoint * Revert "Remove unnecessary sync of approvals and groups from update endpoint" This reverts commit e75cff9. * Add separate class for unit tests related to user alias fields * Fix unit tests * Move ScimUserEndpointsAliasTests from uaa to server bundle * Add unit tests for ScimUser delete with alias * Add unit tests for ScimUser update with alias * Add unit tests for ScimUser update with alias: alias handler throws exception * Add unit tests for ScimUser delete with alias: should ignore dangling reference * Add unit tests for ScimUser update with alias: should throw ScimException if aliasHandler.ensureConsistency fails * Use EntityAliasFailedException as cause if thrown by alias handler during ScimUser update * Adjust endpoint docs for ScimUser create/update: 422 status code if alias creation/update fails * Remove deletion of alias IdP from JdbcIdentityProviderProvisioning.deleteByIdentityZone * Reject deletion of identity zone if an IdP with alias exists in the zone * Add new status code to identity zone deletion documentation * Fix ScimUser create: ensure zone ID is set before alias validity check * Fix Sonar: remove unnecessary clause in if statement * Remove changes from PR#2850 * Replace value annotation with aliasEntitiesEnabled bean in ScimUserEndpoints constructor * Refactor * Rework: use transaction and alias handling only when alias flag is enabled * Rework: inject transaction template instead of creating it in the constructor of ScimUserEndpoints * Fix Sonar: change collect(toList()) to toList() * Import statement order as before --------- Co-authored-by: d036670 <markus.strehle@sap.com>
- Loading branch information