Add capabilty to ignore case sensitivity based hashing.
@@ -37,6 +37,15 @@ public class User implements Serializable {
protected String tenantDomain;
protected String userStoreDomain;
protected String userName;
+ private static boolean ignoreCaseSensitivityBasedHashing = false;
+
+ static {
+
+ if (StringUtils.isNotBlank(System.getProperty("ignoreCaseSensitivityBasedHashing"))) {
+ ignoreCaseSensitivityBasedHashing = Boolean
+ .parseBoolean(System.getProperty("ignoreCaseSensitivityBasedHashing"));
+ }
+ }
/**
* Returns a User instance populated from the given OMElement
@@ -211,11 +220,16 @@ public class User implements Serializable {
public int hashCode() {
int result = tenantDomain.hashCode();
result = 31 * result + userStoreDomain.hashCode();
+
+ if (ignoreCaseSensitivityBasedHashing) {
+ result = 31 * result + userName.toLowerCase().hashCode();
+ } else {
if (IdentityUtil.isUserStoreCaseSensitive(userStoreDomain, IdentityTenantUtil.getTenantId(tenantDomain))) {
result = 31 * result + userName.hashCode();
} else {
result = 31 * result + userName.toLowerCase().hashCode();
}
+ }
return result;
}
