Skip to content

Commit

Permalink
Remove setting properties of new alias explicitly to null in ScimAlia…
Browse files Browse the repository at this point in the history
…sHandler
  • Loading branch information
adrianhoelzl-sap committed Jun 3, 2024
1 parent e78e1fd commit 5699f43
Showing 1 changed file with 8 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ protected void setZoneId(final ScimUser entity, final String zoneId) {
protected ScimUser cloneEntity(final ScimUser originalEntity) {
final ScimUser aliasUser = new ScimUser();

aliasUser.setId(null);
aliasUser.setExternalId(originalEntity.getExternalId());

/* we only allow alias users to be created if their origin IdP has an alias to the same zone, therefore, an IdP
Expand All @@ -104,18 +103,6 @@ protected ScimUser cloneEntity(final ScimUser originalEntity) {
aliasUser.setActive(originalEntity.isActive());
aliasUser.setVerified(originalEntity.isVerified());

// idzId and alias properties will be set later
aliasUser.setZoneId(null);
aliasUser.setAliasId(null);
aliasUser.setAliasZid(null);

/* these timestamps will be overwritten:
* - creation: with current timestamp during persistence (JdbcScimUserProvisioning)
* - update: with values from existing alias entity */
aliasUser.setPasswordLastModified(null);
aliasUser.setLastLogonTime(null);
aliasUser.setPreviousLogonTime(null);

/* password: empty string
* - alias users are only allowed for IdPs that also have an alias
* - IdPs can only have an alias if they are of type SAML, OIDC or OAuth 2.0
Expand All @@ -124,6 +111,14 @@ protected ScimUser cloneEntity(final ScimUser originalEntity) {
aliasUser.setPassword(EMPTY_STRING);
aliasUser.setSalt(null);

/* The following fields will be overwritten later and are therefore not set here:
* - id and identityZoneId
* - aliasId and aliasZid
* - timestamp fields (password last modified, last logon, previous logon):
* - creation: with current timestamp during persistence (JdbcScimUserProvisioning)
* - update: with values from existing alias entity
*/

return aliasUser;
}

Expand Down

0 comments on commit 5699f43

Please sign in to comment.