Source:
protected BasicAttributes getAddUserBasicAttributes(String userName) { BasicAttributes basicAttributes = new BasicAttributes(true); String userEntryObjectClassProperty = realmConfig .getUserStoreProperty(LDAPConstants.USER_ENTRY_OBJECT_CLASS); BasicAttribute objectClass = new BasicAttribute(LDAPConstants.OBJECT_CLASS_NAME); String[] objectClassHierarchy = userEntryObjectClassProperty.split("/"); for (String userObjectClass : objectClassHierarchy) { if (userObjectClass != null && !userObjectClass.trim().equals("")) { objectClass.add(userObjectClass.trim()); } } if (kdcEnabled) { objectClass.add("krb5principal"); objectClass.add("krb5kdcentry"); objectClass.add("subschema"); } basicAttributes.put(objectClass); if(isSaveUserNameAsAnAttribute()) { BasicAttribute userNameAttribute = new BasicAttribute(realmConfig. getUserStoreProperty(LDAPConstants.USER_NAME_ATTRIBUTE)); userNameAttribute.add(userName); basicAttributes.put(userNameAttribute); } if (kdcEnabled) { CarbonContext cc = CarbonContext.getThreadLocalCarbonContext(); if (cc != null) { String tenantDomainName = cc.getTenantDomain(); if (!MultitenantConstants.SUPER_TENANT_DOMAIN_NAME.equals(tenantDomainName)) { userName = userName + UserCoreConstants.PRINCIPAL_USERNAME_SEPARATOR + tenantDomainName; } else { userName = userName + UserCoreConstants.PRINCIPAL_USERNAME_SEPARATOR + MultitenantConstants.SUPER_TENANT_DOMAIN_NAME; } } String principal = userName + "@" + this.getRealmName(); BasicAttribute principalAttribute = new BasicAttribute(KRB5_PRINCIPAL_NAME_ATTRIBUTE); principalAttribute.add(principal); basicAttributes.put(principalAttribute); BasicAttribute versionNumberAttribute = new BasicAttribute( KRB5_KEY_VERSION_NUMBER_ATTRIBUTE); versionNumberAttribute.add("0"); basicAttributes.put(versionNumberAttribute); } return basicAttributes; }

Target:
protected BasicAttributes getAddUserBasicAttributes(String userName) { BasicAttributes basicAttributes = new BasicAttributes(true); String userEntryObjectClassProperty = realmConfig .getUserStoreProperty(LDAPConstants.USER_ENTRY_OBJECT_CLASS); BasicAttribute objectClass = new BasicAttribute(LDAPConstants.OBJECT_CLASS_NAME); String[] objectClassHierarchy = userEntryObjectClassProperty.split("/"); for (String userObjectClass : objectClassHierarchy) { if (userObjectClass != null && !userObjectClass.trim().equals("")) { objectClass.add(userObjectClass.trim()); } } if (kdcEnabled) { objectClass.add("krb5principal"); objectClass.add("krb5kdcentry"); objectClass.add("subschema"); } basicAttributes.put(objectClass); if (shouldSaveUserNameAsAnAttribute()) { BasicAttribute userNameAttribute = new BasicAttribute(realmConfig. getUserStoreProperty(LDAPConstants.USER_NAME_ATTRIBUTE)); userNameAttribute.add(userName); basicAttributes.put(userNameAttribute); } if (kdcEnabled) { CarbonContext cc = CarbonContext.getThreadLocalCarbonContext(); if (cc != null) { String tenantDomainName = cc.getTenantDomain(); if (!MultitenantConstants.SUPER_TENANT_DOMAIN_NAME.equals(tenantDomainName)) { userName = userName + UserCoreConstants.PRINCIPAL_USERNAME_SEPARATOR + tenantDomainName; } else { userName = userName + UserCoreConstants.PRINCIPAL_USERNAME_SEPARATOR + MultitenantConstants.SUPER_TENANT_DOMAIN_NAME; } } String principal = userName + "@" + this.getRealmName(); BasicAttribute principalAttribute = new BasicAttribute(KRB5_PRINCIPAL_NAME_ATTRIBUTE); principalAttribute.add(principal); basicAttributes.put(principalAttribute); BasicAttribute versionNumberAttribute = new BasicAttribute( KRB5_KEY_VERSION_NUMBER_ATTRIBUTE); versionNumberAttribute.add("0"); basicAttributes.put(versionNumberAttribute); } return basicAttributes; }