diff --git a/model/map-hot-rod/pom.xml b/model/map-hot-rod/pom.xml
index fc80f9126b..5d41fca36a 100644
--- a/model/map-hot-rod/pom.xml
+++ b/model/map-hot-rod/pom.xml
@@ -24,6 +24,10 @@
org.keycloak
keycloak-model-map
+
+ org.infinispan
+ infinispan-api
+
org.infinispan
infinispan-client-hotrod
diff --git a/model/map-hot-rod/src/main/java/org/keycloak/models/map/storage/hotRod/IckleQueryMapModelCriteriaBuilder.java b/model/map-hot-rod/src/main/java/org/keycloak/models/map/storage/hotRod/IckleQueryMapModelCriteriaBuilder.java
index 3e16a19674..577ae2be6e 100644
--- a/model/map-hot-rod/src/main/java/org/keycloak/models/map/storage/hotRod/IckleQueryMapModelCriteriaBuilder.java
+++ b/model/map-hot-rod/src/main/java/org/keycloak/models/map/storage/hotRod/IckleQueryMapModelCriteriaBuilder.java
@@ -19,8 +19,8 @@ package org.keycloak.models.map.storage.hotRod;
import org.keycloak.authorization.model.Policy;
import org.keycloak.authorization.model.Resource;
+import org.keycloak.authorization.model.Scope;
import org.keycloak.events.Event;
-import org.keycloak.models.AuthenticatedClientSessionModel;
import org.keycloak.models.ClientModel;
import org.keycloak.models.GroupModel;
import org.keycloak.models.RealmModel;
@@ -53,11 +53,8 @@ public class IckleQueryMapModelCriteriaBuilder parameters;
private static final Pattern LIKE_PATTERN_DELIMITER = Pattern.compile("%+");
private static final Pattern NON_ANALYZED_FIELD_REGEX = Pattern.compile("[%_\\\\]");
- // private static final Pattern ANALYZED_FIELD_REGEX = Pattern.compile("[+!^\"~*?:\\\\]"); // TODO reevaluate once https://github.com/keycloak/keycloak/issues/9295 is fixed
- private static final Pattern ANALYZED_FIELD_REGEX = Pattern.compile("\\\\"); // escape "\" with extra "\"
public static final Map, String> INFINISPAN_NAME_OVERRIDES = new HashMap<>();
- public static final Set> ANALYZED_MODEL_FIELDS = new HashSet<>();
-
+ public static final Set> LOWERCASE_NORMALIZED_MODEL_FIELDS = new HashSet<>();
static {
INFINISPAN_NAME_OVERRIDES.put(ClientModel.SearchableFields.SCOPE_MAPPING_ROLE, "scopeMappings");
@@ -96,13 +93,19 @@ public class IckleQueryMapModelCriteriaBuilder hotRodEntityClass, StringBuilder whereClauseBuilder, Map parameters) {
@@ -237,14 +240,6 @@ public class IckleQueryMapModelCriteriaBuilder sanitizeSingleUnit, String replacement) {
return LIKE_PATTERN_DELIMITER.splitAsStream(value)
.map(sanitizeSingleUnit)
@@ -256,18 +251,6 @@ public class IckleQueryMapModelCriteriaBuilder modelField) {
- return ANALYZED_MODEL_FIELDS.contains(modelField);
- }
-
/**
*
* @return Ickle query that represents this QueryBuilder
diff --git a/model/map-hot-rod/src/main/java/org/keycloak/models/map/storage/hotRod/IckleQueryOperators.java b/model/map-hot-rod/src/main/java/org/keycloak/models/map/storage/hotRod/IckleQueryOperators.java
index 945df30ce6..096f6d0d5d 100644
--- a/model/map-hot-rod/src/main/java/org/keycloak/models/map/storage/hotRod/IckleQueryOperators.java
+++ b/model/map-hot-rod/src/main/java/org/keycloak/models/map/storage/hotRod/IckleQueryOperators.java
@@ -56,7 +56,7 @@ public class IckleQueryOperators {
OPERATOR_TO_EXPRESSION_COMBINATORS.put(ModelCriteriaBuilder.Operator.IN, IckleQueryOperators::in);
OPERATOR_TO_EXPRESSION_COMBINATORS.put(ModelCriteriaBuilder.Operator.EXISTS, IckleQueryOperators::exists);
OPERATOR_TO_EXPRESSION_COMBINATORS.put(ModelCriteriaBuilder.Operator.NOT_EXISTS, IckleQueryOperators::notExists);
- OPERATOR_TO_EXPRESSION_COMBINATORS.put(ModelCriteriaBuilder.Operator.ILIKE, IckleQueryOperators::iLike);
+ OPERATOR_TO_EXPRESSION_COMBINATORS.put(ModelCriteriaBuilder.Operator.ILIKE, IckleQueryOperators::like);
OPERATOR_TO_EXPRESSION_COMBINATORS.put(ModelCriteriaBuilder.Operator.LIKE, IckleQueryOperators::like);
OPERATOR_TO_STRING.put(ModelCriteriaBuilder.Operator.EQ, "=");
@@ -94,12 +94,6 @@ public class IckleQueryOperators {
return field + " IS NULL OR " + field + " IS EMPTY";
}
- private static String iLike(String modelFieldName, Object[] values, Map parameters) {
- String sanitizedValue = (String) IckleQueryMapModelCriteriaBuilder.sanitizeNonAnalyzed(values[0]);
- return singleValueOperator(ModelCriteriaBuilder.Operator.ILIKE)
- .combine(modelFieldName + "Lowercase", new String[] {sanitizedValue.toLowerCase()}, parameters);
- }
-
private static String like(String modelFieldName, Object[] values, Map parameters) {
String sanitizedValue = (String) IckleQueryMapModelCriteriaBuilder.sanitizeNonAnalyzed(values[0]);
return singleValueOperator(ModelCriteriaBuilder.Operator.LIKE)
diff --git a/model/map-hot-rod/src/main/java/org/keycloak/models/map/storage/hotRod/IckleQueryWhereClauses.java b/model/map-hot-rod/src/main/java/org/keycloak/models/map/storage/hotRod/IckleQueryWhereClauses.java
index 67a59b7bef..53db4e8c44 100644
--- a/model/map-hot-rod/src/main/java/org/keycloak/models/map/storage/hotRod/IckleQueryWhereClauses.java
+++ b/model/map-hot-rod/src/main/java/org/keycloak/models/map/storage/hotRod/IckleQueryWhereClauses.java
@@ -38,9 +38,8 @@ import java.util.Map;
import java.util.stream.Collectors;
import java.util.stream.Stream;
+import static org.keycloak.models.map.storage.hotRod.IckleQueryMapModelCriteriaBuilder.LOWERCASE_NORMALIZED_MODEL_FIELDS;
import static org.keycloak.models.map.storage.hotRod.IckleQueryMapModelCriteriaBuilder.getFieldName;
-import static org.keycloak.models.map.storage.hotRod.IckleQueryMapModelCriteriaBuilder.sanitizeAnalyzed;
-import static org.keycloak.models.map.storage.hotRod.IckleQueryOperators.C;
/**
* This class provides knowledge on how to build Ickle query where clauses for specified {@link SearchableModelField}.
@@ -98,15 +97,12 @@ public class IckleQueryWhereClauses {
Object[] values, Map parameters) {
String fieldName = IckleQueryMapModelCriteriaBuilder.getFieldName(modelField);
- if (IckleQueryMapModelCriteriaBuilder.isAnalyzedModelField(modelField) &&
- (op.equals(ModelCriteriaBuilder.Operator.ILIKE) || op.equals(ModelCriteriaBuilder.Operator.EQ) || op.equals(ModelCriteriaBuilder.Operator.NE))) {
+ if (op == ModelCriteriaBuilder.Operator.ILIKE && !LOWERCASE_NORMALIZED_MODEL_FIELDS.contains(modelField)) {
+ throw new CriterionNotSupportedException(modelField, op, "Attempt to search case-insensitively without lowercase normalizer applied on the field.");
+ }
- String clause = C + "." + fieldName + " : '" + sanitizeAnalyzed(((String)values[0]).toLowerCase()) + "'";
- if (op.equals(ModelCriteriaBuilder.Operator.NE)) {
- return "not(" + clause + ")";
- }
-
- return clause;
+ if (op == ModelCriteriaBuilder.Operator.LIKE && LOWERCASE_NORMALIZED_MODEL_FIELDS.contains(modelField)) {
+ throw new CriterionNotSupportedException(modelField, op, "Attempt to search case-sensitively with lowercase-normalized field.");
}
return whereClauseProducerForModelField(modelField).produceWhereClause(fieldName, op, values, parameters);
diff --git a/model/map-hot-rod/src/main/java/org/keycloak/models/map/storage/hotRod/authSession/HotRodRootAuthenticationSessionEntity.java b/model/map-hot-rod/src/main/java/org/keycloak/models/map/storage/hotRod/authSession/HotRodRootAuthenticationSessionEntity.java
index 8b71c34a7d..4504f91797 100644
--- a/model/map-hot-rod/src/main/java/org/keycloak/models/map/storage/hotRod/authSession/HotRodRootAuthenticationSessionEntity.java
+++ b/model/map-hot-rod/src/main/java/org/keycloak/models/map/storage/hotRod/authSession/HotRodRootAuthenticationSessionEntity.java
@@ -17,6 +17,8 @@
package org.keycloak.models.map.storage.hotRod.authSession;
+import org.infinispan.api.annotations.indexing.Basic;
+import org.infinispan.api.annotations.indexing.Indexed;
import org.infinispan.protostream.GeneratedSchema;
import org.infinispan.protostream.annotations.AutoProtoSchemaBuilder;
import org.infinispan.protostream.annotations.ProtoDoc;
@@ -41,7 +43,7 @@ import java.util.Set;
topLevelEntity = true,
modelClass = "org.keycloak.sessions.RootAuthenticationSessionModel"
)
-@ProtoDoc("@Indexed")
+@Indexed
@ProtoDoc("schema-version: " + HotRodRootAuthenticationSessionEntity.VERSION)
public class HotRodRootAuthenticationSessionEntity extends AbstractHotRodEntity {
@@ -62,21 +64,21 @@ public class HotRodRootAuthenticationSessionEntity extends AbstractHotRodEntity
}
- @ProtoDoc("@Field(index = Index.YES, store = Store.YES)")
+ @Basic(projectable = true)
@ProtoField(number = 1)
public Integer entityVersion = VERSION;
@ProtoField(number = 2)
public String id;
- @ProtoDoc("@Field(index = Index.YES, store = Store.YES)")
+ @Basic(sortable = true)
@ProtoField(number = 3)
public String realmId;
@ProtoField(number = 4)
public Long timestamp;
- @ProtoDoc("@Field(index = Index.YES, store = Store.YES)")
+ @Basic(sortable = true)
@ProtoField(number = 5)
public Long expiration;
diff --git a/model/map-hot-rod/src/main/java/org/keycloak/models/map/storage/hotRod/authorization/HotRodPermissionTicketEntity.java b/model/map-hot-rod/src/main/java/org/keycloak/models/map/storage/hotRod/authorization/HotRodPermissionTicketEntity.java
index 18cc16a09a..5835c6cc46 100644
--- a/model/map-hot-rod/src/main/java/org/keycloak/models/map/storage/hotRod/authorization/HotRodPermissionTicketEntity.java
+++ b/model/map-hot-rod/src/main/java/org/keycloak/models/map/storage/hotRod/authorization/HotRodPermissionTicketEntity.java
@@ -17,6 +17,8 @@
package org.keycloak.models.map.storage.hotRod.authorization;
+import org.infinispan.api.annotations.indexing.Basic;
+import org.infinispan.api.annotations.indexing.Indexed;
import org.infinispan.protostream.GeneratedSchema;
import org.infinispan.protostream.annotations.AutoProtoSchemaBuilder;
import org.infinispan.protostream.annotations.ProtoDoc;
@@ -35,7 +37,7 @@ import org.keycloak.models.map.storage.hotRod.common.UpdatableHotRodEntityDelega
modelClass = "org.keycloak.authorization.model.PermissionTicket",
cacheName = "authz"
)
-@ProtoDoc("@Indexed")
+@Indexed
@ProtoDoc("schema-version: " + HotRodPermissionTicketEntity.VERSION)
public class HotRodPermissionTicketEntity extends AbstractHotRodEntity {
@@ -53,47 +55,47 @@ public class HotRodPermissionTicketEntity extends AbstractHotRodEntity {
}
- @ProtoDoc("@Field(index = Index.YES, store = Store.YES)")
+ @Basic(projectable = true)
@ProtoField(number = 1)
public Integer entityVersion = VERSION;
- @ProtoDoc("@Field(index = Index.YES, store = Store.YES)")
+ @Basic(projectable = true, sortable = true)
@ProtoField(number = 2)
public String id;
- @ProtoDoc("@Field(index = Index.YES, store = Store.YES)")
+ @Basic(sortable = true)
@ProtoField(number = 3)
public String realmId;
+ @Basic(sortable = true)
@ProtoField(number = 4)
- @ProtoDoc("@Field(index = Index.YES, store = Store.YES)")
public String owner;
+ @Basic(sortable = true)
@ProtoField(number = 5)
- @ProtoDoc("@Field(index = Index.YES, store = Store.YES)")
public String requester;
@ProtoField(number = 6)
public Long createdTimestamp;
+ @Basic(sortable = true)
@ProtoField(number = 7)
- @ProtoDoc("@Field(index = Index.YES, store = Store.YES)")
public Long grantedTimestamp;
+ @Basic(sortable = true)
@ProtoField(number = 8)
- @ProtoDoc("@Field(index = Index.YES, store = Store.YES)")
public String resourceId;
+ @Basic(sortable = true)
@ProtoField(number = 9)
- @ProtoDoc("@Field(index = Index.YES, store = Store.YES)")
public String scopeId;
+ @Basic(sortable = true)
@ProtoField(number = 10)
- @ProtoDoc("@Field(index = Index.YES, store = Store.YES)")
public String resourceServerId;
+ @Basic(sortable = true)
@ProtoField(number = 11)
- @ProtoDoc("@Field(index = Index.YES, store = Store.YES)")
public String policyId;
public static abstract class AbstractHotRodPermissionTicketEntity extends UpdatableHotRodEntityDelegateImpl implements MapPermissionTicketEntity {
diff --git a/model/map-hot-rod/src/main/java/org/keycloak/models/map/storage/hotRod/authorization/HotRodPolicyEntity.java b/model/map-hot-rod/src/main/java/org/keycloak/models/map/storage/hotRod/authorization/HotRodPolicyEntity.java
index 6b07905654..617598ba88 100644
--- a/model/map-hot-rod/src/main/java/org/keycloak/models/map/storage/hotRod/authorization/HotRodPolicyEntity.java
+++ b/model/map-hot-rod/src/main/java/org/keycloak/models/map/storage/hotRod/authorization/HotRodPolicyEntity.java
@@ -17,6 +17,9 @@
package org.keycloak.models.map.storage.hotRod.authorization;
+import org.infinispan.api.annotations.indexing.Basic;
+import org.infinispan.api.annotations.indexing.Indexed;
+import org.infinispan.api.annotations.indexing.Keyword;
import org.infinispan.protostream.GeneratedSchema;
import org.infinispan.protostream.annotations.AutoProtoSchemaBuilder;
import org.infinispan.protostream.annotations.ProtoDoc;
@@ -39,7 +42,7 @@ import java.util.Set;
modelClass = "org.keycloak.authorization.model.Policy",
cacheName = "authz"
)
-@ProtoDoc("@Indexed")
+@Indexed
@ProtoDoc("schema-version: " + HotRodPolicyEntity.VERSION)
public class HotRodPolicyEntity extends AbstractHotRodEntity {
@@ -59,61 +62,57 @@ public class HotRodPolicyEntity extends AbstractHotRodEntity {
}
- @ProtoDoc("@Field(index = Index.YES, store = Store.YES)")
+ @Basic(projectable = true)
@ProtoField(number = 1)
public Integer entityVersion = VERSION;
- @ProtoDoc("@Field(index = Index.YES, store = Store.YES)")
+ @Basic(projectable = true, sortable = true)
@ProtoField(number = 2)
public String id;
- @ProtoDoc("@Field(index = Index.YES, store = Store.YES)")
+ @Basic(sortable = true)
@ProtoField(number = 3)
public String realmId;
+ @Keyword(sortable = true, normalizer = "lowercase")
@ProtoField(number = 4)
- @ProtoDoc("@Field(index = Index.YES, store = Store.YES)")
public String name;
@ProtoField(number = 5)
- @ProtoDoc("@Field(index = Index.YES, store = Store.YES)")
- public String nameLowercase;
-
- @ProtoField(number = 6)
public String description;
- @ProtoField(number = 7)
- @ProtoDoc("@Field(index = Index.YES, store = Store.YES, analyze = Analyze.YES, analyzer = @Analyzer(definition = \"filename\"))")
+ @Keyword(sortable = true, normalizer = "lowercase")
+ @ProtoField(number = 6)
public String type;
- @ProtoField(number = 8)
+ @ProtoField(number = 7)
public Integer decisionStrategy;
- @ProtoField(number = 9)
+ @ProtoField(number = 8)
public Integer logic;
- @ProtoField(number = 10)
- @ProtoDoc("@Field(index = Index.YES, store = Store.YES)")
+ @Basic(sortable = true)
+ @ProtoField(number = 9)
public Set configs;
- @ProtoField(number = 11)
- @ProtoDoc("@Field(index = Index.YES, store = Store.YES)")
+ @Basic(sortable = true)
+ @ProtoField(number = 10)
public String resourceServerId;
- @ProtoField(number = 12)
- @ProtoDoc("@Field(index = Index.YES, store = Store.YES)")
+ @Basic(sortable = true)
+ @ProtoField(number = 11)
public Set associatedPolicyIds;
- @ProtoField(number = 13)
- @ProtoDoc("@Field(index = Index.YES, store = Store.YES)")
+ @Basic(sortable = true)
+ @ProtoField(number = 12)
public Set resourceIds;
- @ProtoField(number = 14)
- @ProtoDoc("@Field(index = Index.YES, store = Store.YES)")
+ @Basic(sortable = true)
+ @ProtoField(number = 13)
public Set scopeIds;
- @ProtoField(number = 15)
- @ProtoDoc("@Field(index = Index.YES, store = Store.YES)")
+ @Basic(sortable = true)
+ @ProtoField(number = 14)
public String owner;
public static abstract class AbstractHotRodPolicyEntity extends UpdatableHotRodEntityDelegateImpl implements MapPolicyEntity {
@@ -136,7 +135,6 @@ public class HotRodPolicyEntity extends AbstractHotRodEntity {
HotRodPolicyEntity entity = getHotRodEntity();
entity.updated |= ! Objects.equals(entity.name, name);
entity.name = name;
- entity.nameLowercase = name == null ? null : name.toLowerCase();
}
}
diff --git a/model/map-hot-rod/src/main/java/org/keycloak/models/map/storage/hotRod/authorization/HotRodResourceEntity.java b/model/map-hot-rod/src/main/java/org/keycloak/models/map/storage/hotRod/authorization/HotRodResourceEntity.java
index 1412a5e6c5..90f97fca0b 100644
--- a/model/map-hot-rod/src/main/java/org/keycloak/models/map/storage/hotRod/authorization/HotRodResourceEntity.java
+++ b/model/map-hot-rod/src/main/java/org/keycloak/models/map/storage/hotRod/authorization/HotRodResourceEntity.java
@@ -17,6 +17,9 @@
package org.keycloak.models.map.storage.hotRod.authorization;
+import org.infinispan.api.annotations.indexing.Basic;
+import org.infinispan.api.annotations.indexing.Indexed;
+import org.infinispan.api.annotations.indexing.Keyword;
import org.infinispan.protostream.GeneratedSchema;
import org.infinispan.protostream.annotations.AutoProtoSchemaBuilder;
import org.infinispan.protostream.annotations.ProtoDoc;
@@ -39,7 +42,7 @@ import java.util.Set;
modelClass = "org.keycloak.authorization.model.Resource",
cacheName = "authz"
)
-@ProtoDoc("@Indexed")
+@Indexed
@ProtoDoc("schema-version: " + HotRodResourceEntity.VERSION)
public class HotRodResourceEntity extends AbstractHotRodEntity {
@@ -59,57 +62,53 @@ public class HotRodResourceEntity extends AbstractHotRodEntity {
}
- @ProtoDoc("@Field(index = Index.YES, store = Store.YES)")
+ @Basic(projectable = true)
@ProtoField(number = 1)
public Integer entityVersion = VERSION;
- @ProtoDoc("@Field(index = Index.YES, store = Store.YES)")
+ @Basic(projectable = true, sortable = true)
@ProtoField(number = 2)
public String id;
- @ProtoDoc("@Field(index = Index.YES, store = Store.YES)")
+ @Basic(sortable = true)
@ProtoField(number = 3)
public String realmId;
+ @Keyword(sortable = true, normalizer = "lowercase")
@ProtoField(number = 4)
- @ProtoDoc("@Field(index = Index.YES, store = Store.YES)")
public String name;
@ProtoField(number = 5)
- @ProtoDoc("@Field(index = Index.YES, store = Store.YES)")
- public String nameLowercase;
-
- @ProtoField(number = 6)
public String displayName;
- @ProtoField(number = 7)
- @ProtoDoc("@Field(index = Index.YES, store = Store.YES)")
+ @Basic(sortable = true)
+ @ProtoField(number = 6)
public Set uris;
- @ProtoField(number = 8)
- @ProtoDoc("@Field(index = Index.YES, store = Store.YES, analyze = Analyze.YES, analyzer = @Analyzer(definition = \"filename\"))")
+ @Keyword(sortable = true, normalizer = "lowercase")
+ @ProtoField(number = 7)
public String type;
- @ProtoField(number = 9)
+ @ProtoField(number = 8)
public String iconUri;
- @ProtoField(number = 10)
- @ProtoDoc("@Field(index = Index.YES, store = Store.YES)")
+ @Basic(sortable = true)
+ @ProtoField(number = 9)
public String owner;
- @ProtoField(number = 11)
- @ProtoDoc("@Field(index = Index.YES, store = Store.YES)")
+ @Basic(sortable = true)
+ @ProtoField(number = 10)
public Boolean ownerManagedAccess;
- @ProtoField(number = 12)
- @ProtoDoc("@Field(index = Index.YES, store = Store.YES)")
+ @Basic(sortable = true)
+ @ProtoField(number = 11)
public String resourceServerId;
- @ProtoField(number = 13)
- @ProtoDoc("@Field(index = Index.YES, store = Store.YES)")
+ @Basic(sortable = true)
+ @ProtoField(number = 12)
public Set scopeIds;
- @ProtoField(number = 14)
+ @ProtoField(number = 13)
public Set attributes;
public static abstract class AbstractHotRodResourceEntity extends UpdatableHotRodEntityDelegateImpl implements MapResourceEntity {
@@ -132,7 +131,6 @@ public class HotRodResourceEntity extends AbstractHotRodEntity {
HotRodResourceEntity entity = getHotRodEntity();
entity.updated |= ! Objects.equals(entity.name, name);
entity.name = name;
- entity.nameLowercase = name == null ? null : name.toLowerCase();
}
}
diff --git a/model/map-hot-rod/src/main/java/org/keycloak/models/map/storage/hotRod/authorization/HotRodResourceServerEntity.java b/model/map-hot-rod/src/main/java/org/keycloak/models/map/storage/hotRod/authorization/HotRodResourceServerEntity.java
index aa8ac3a209..bd244c8235 100644
--- a/model/map-hot-rod/src/main/java/org/keycloak/models/map/storage/hotRod/authorization/HotRodResourceServerEntity.java
+++ b/model/map-hot-rod/src/main/java/org/keycloak/models/map/storage/hotRod/authorization/HotRodResourceServerEntity.java
@@ -17,6 +17,8 @@
package org.keycloak.models.map.storage.hotRod.authorization;
+import org.infinispan.api.annotations.indexing.Basic;
+import org.infinispan.api.annotations.indexing.Indexed;
import org.infinispan.protostream.GeneratedSchema;
import org.infinispan.protostream.annotations.AutoProtoSchemaBuilder;
import org.infinispan.protostream.annotations.ProtoDoc;
@@ -37,7 +39,7 @@ import org.keycloak.models.map.storage.hotRod.common.UpdatableHotRodEntityDelega
cacheName = "authz"
)
@ProtoDoc("schema-version: " + HotRodResourceServerEntity.VERSION)
-@ProtoDoc("@Indexed")
+@Indexed
public class HotRodResourceServerEntity extends AbstractHotRodEntity {
@IgnoreForEntityImplementationGenerator
@@ -54,19 +56,19 @@ public class HotRodResourceServerEntity extends AbstractHotRodEntity {
}
- @ProtoDoc("@Field(index = Index.YES, store = Store.YES)")
+ @Basic(projectable = true)
@ProtoField(number = 1)
public Integer entityVersion = VERSION;
- @ProtoDoc("@Field(index = Index.YES, store = Store.YES)")
+ @Basic(projectable = true, sortable = true)
@ProtoField(number = 2)
public String id;
- @ProtoDoc("@Field(index = Index.YES, store = Store.YES)")
+ @Basic(sortable = true)
@ProtoField(number = 3)
public String realmId;
- @ProtoDoc("@Field(index = Index.YES, store = Store.YES)")
+ @Basic(sortable = true)
@ProtoField(number = 4)
public String clientId;
diff --git a/model/map-hot-rod/src/main/java/org/keycloak/models/map/storage/hotRod/authorization/HotRodScopeEntity.java b/model/map-hot-rod/src/main/java/org/keycloak/models/map/storage/hotRod/authorization/HotRodScopeEntity.java
index c00d26b93d..2028d9499f 100644
--- a/model/map-hot-rod/src/main/java/org/keycloak/models/map/storage/hotRod/authorization/HotRodScopeEntity.java
+++ b/model/map-hot-rod/src/main/java/org/keycloak/models/map/storage/hotRod/authorization/HotRodScopeEntity.java
@@ -17,6 +17,9 @@
package org.keycloak.models.map.storage.hotRod.authorization;
+import org.infinispan.api.annotations.indexing.Basic;
+import org.infinispan.api.annotations.indexing.Indexed;
+import org.infinispan.api.annotations.indexing.Keyword;
import org.infinispan.protostream.GeneratedSchema;
import org.infinispan.protostream.annotations.AutoProtoSchemaBuilder;
import org.infinispan.protostream.annotations.ProtoDoc;
@@ -37,7 +40,7 @@ import java.util.Objects;
modelClass = "org.keycloak.authorization.model.Scope",
cacheName = "authz"
)
-@ProtoDoc("@Indexed")
+@Indexed
@ProtoDoc("schema-version: " + HotRodScopeEntity.VERSION)
public class HotRodScopeEntity extends AbstractHotRodEntity {
@@ -55,34 +58,30 @@ public class HotRodScopeEntity extends AbstractHotRodEntity {
}
- @ProtoDoc("@Field(index = Index.YES, store = Store.YES)")
+ @Basic(projectable = true)
@ProtoField(number = 1)
public Integer entityVersion = VERSION;
- @ProtoDoc("@Field(index = Index.YES, store = Store.YES)")
+ @Basic(projectable = true, sortable = true)
@ProtoField(number = 2)
public String id;
- @ProtoDoc("@Field(index = Index.YES, store = Store.YES)")
+ @Basic(sortable = true)
@ProtoField(number = 3)
public String realmId;
+ @Keyword(sortable = true, normalizer = "lowercase")
@ProtoField(number = 4)
- @ProtoDoc("@Field(index = Index.YES, store = Store.YES)")
public String name;
@ProtoField(number = 5)
- @ProtoDoc("@Field(index = Index.YES, store = Store.YES)")
- public String nameLowercase;
-
- @ProtoField(number = 6)
public String displayName;
- @ProtoField(number = 7)
+ @ProtoField(number = 6)
public String iconUri;
- @ProtoField(number = 8)
- @ProtoDoc("@Field(index = Index.YES, store = Store.YES)")
+ @Basic(sortable = true)
+ @ProtoField(number = 7)
public String resourceServerId;
public static abstract class AbstractHotRodScopeEntity extends UpdatableHotRodEntityDelegateImpl implements MapScopeEntity {
@@ -105,7 +104,6 @@ public class HotRodScopeEntity extends AbstractHotRodEntity {
HotRodScopeEntity entity = getHotRodEntity();
entity.updated |= ! Objects.equals(entity.name, name);
entity.name = name;
- entity.nameLowercase = name == null ? null : name.toLowerCase();
}
}
diff --git a/model/map-hot-rod/src/main/java/org/keycloak/models/map/storage/hotRod/client/HotRodClientEntity.java b/model/map-hot-rod/src/main/java/org/keycloak/models/map/storage/hotRod/client/HotRodClientEntity.java
index d0218585c1..8fabea3f12 100644
--- a/model/map-hot-rod/src/main/java/org/keycloak/models/map/storage/hotRod/client/HotRodClientEntity.java
+++ b/model/map-hot-rod/src/main/java/org/keycloak/models/map/storage/hotRod/client/HotRodClientEntity.java
@@ -17,6 +17,9 @@
package org.keycloak.models.map.storage.hotRod.client;
+import org.infinispan.api.annotations.indexing.Basic;
+import org.infinispan.api.annotations.indexing.Indexed;
+import org.infinispan.api.annotations.indexing.Keyword;
import org.infinispan.protostream.GeneratedSchema;
import org.infinispan.protostream.annotations.AutoProtoSchemaBuilder;
import org.infinispan.protostream.annotations.ProtoDoc;
@@ -46,7 +49,7 @@ import java.util.stream.Stream;
topLevelEntity = true,
modelClass = "org.keycloak.models.ClientModel"
)
-@ProtoDoc("@Indexed")
+@Indexed
@ProtoDoc("schema-version: " + HotRodClientEntity.VERSION)
public class HotRodClientEntity extends AbstractHotRodEntity {
@@ -66,123 +69,115 @@ public class HotRodClientEntity extends AbstractHotRodEntity {
HotRodClientEntitySchema INSTANCE = new HotRodClientEntitySchemaImpl();
}
- @ProtoDoc("@Field(index = Index.YES, store = Store.YES)")
+ @Basic(projectable = true)
@ProtoField(number = 1)
public Integer entityVersion = VERSION;
- @ProtoDoc("@Field(index = Index.YES, store = Store.YES)")
+ @Basic(projectable = true, sortable = true)
@ProtoField(number = 2)
public String id;
- @ProtoDoc("@Field(index = Index.YES, store = Store.YES)")
+ @Basic(sortable = true)
@ProtoField(number = 3)
public String realmId;
- @ProtoDoc("@Field(index = Index.YES, store = Store.YES)")
+ @Keyword(sortable = true, normalizer = "lowercase")
@ProtoField(number = 4)
public String clientId;
- /**
- * Lowercase interpretation of {@link #clientId} field. Infinispan doesn't support case-insensitive LIKE for non-analyzed fields.
- * Search on analyzed fields can be case-insensitive (based on used analyzer) but doesn't support ORDER BY analyzed field.
- */
- @ProtoDoc("@Field(index = Index.YES, store = Store.YES)")
@ProtoField(number = 5)
- public String clientIdLowercase;
-
- @ProtoField(number = 6)
public String name;
- @ProtoField(number = 7)
+ @ProtoField(number = 6)
public String description;
- @ProtoField(number = 8)
+ @ProtoField(number = 7)
public Set redirectUris;
- @ProtoField(number = 9)
+ @ProtoField(number = 8)
public Boolean enabled;
- @ProtoField(number = 10)
+ @ProtoField(number = 9)
public Boolean alwaysDisplayInConsole;
- @ProtoField(number = 11)
+ @ProtoField(number = 10)
public String clientAuthenticatorType;
- @ProtoField(number = 12)
+ @ProtoField(number = 11)
public String secret;
- @ProtoField(number = 13)
+ @ProtoField(number = 12)
public String registrationToken;
- @ProtoField(number = 14)
+ @ProtoField(number = 13)
public String protocol;
- @ProtoDoc("@Field(index = Index.YES, store = Store.YES)")
- @ProtoField(number = 15)
+ @Basic(sortable = true)
+ @ProtoField(number = 14)
public Set attributes;
- @ProtoField(number = 16)
+ @ProtoField(number = 15)
public Set> authenticationFlowBindingOverrides;
- @ProtoField(number = 17)
+ @ProtoField(number = 16)
public Boolean publicClient;
- @ProtoField(number = 18)
+ @ProtoField(number = 17)
public Boolean fullScopeAllowed;
- @ProtoField(number = 19)
+ @ProtoField(number = 18)
public Boolean frontchannelLogout;
- @ProtoField(number = 20)
+ @ProtoField(number = 19)
public Long notBefore;
- @ProtoField(number = 21)
+ @ProtoField(number = 20)
public Set scope;
- @ProtoField(number = 22)
+ @ProtoField(number = 21)
public Set webOrigins;
- @ProtoField(number = 23)
+ @ProtoField(number = 22)
public Set protocolMappers;
- @ProtoField(number = 24)
+ @ProtoField(number = 23)
public Set> clientScopes;
- @ProtoDoc("@Field(index = Index.YES, store = Store.YES)")
- @ProtoField(number = 25, collectionImplementation = LinkedList.class)
+ @Basic(sortable = true)
+ @ProtoField(number = 24, collectionImplementation = LinkedList.class)
public Collection scopeMappings;
- @ProtoField(number = 26)
+ @ProtoField(number = 25)
public Boolean surrogateAuthRequired;
- @ProtoField(number = 27)
+ @ProtoField(number = 26)
public String managementUrl;
- @ProtoField(number = 28)
+ @ProtoField(number = 27)
public String baseUrl;
- @ProtoField(number = 29)
+ @ProtoField(number = 28)
public Boolean bearerOnly;
- @ProtoField(number = 30)
+ @ProtoField(number = 29)
public Boolean consentRequired;
- @ProtoField(number = 31)
+ @ProtoField(number = 30)
public String rootUrl;
- @ProtoField(number = 32)
+ @ProtoField(number = 31)
public Boolean standardFlowEnabled;
- @ProtoField(number = 33)
+ @ProtoField(number = 32)
public Boolean implicitFlowEnabled;
- @ProtoField(number = 34)
+ @ProtoField(number = 33)
public Boolean directAccessGrantsEnabled;
- @ProtoField(number = 35)
+ @ProtoField(number = 34)
public Boolean serviceAccountsEnabled;
- @ProtoField(number = 36)
+ @ProtoField(number = 35)
public Integer nodeReRegistrationTimeout;
public static abstract class AbstractHotRodClientEntityDelegate extends UpdatableHotRodEntityDelegateImpl implements MapClientEntity {
@@ -205,7 +200,6 @@ public class HotRodClientEntity extends AbstractHotRodEntity {
HotRodClientEntity entity = getHotRodEntity();
entity.updated |= ! Objects.equals(entity.clientId, clientId);
entity.clientId = clientId;
- entity.clientIdLowercase = clientId == null ? null : clientId.toLowerCase();
}
@Override
diff --git a/model/map-hot-rod/src/main/java/org/keycloak/models/map/storage/hotRod/client/HotRodProtocolMapperEntity.java b/model/map-hot-rod/src/main/java/org/keycloak/models/map/storage/hotRod/client/HotRodProtocolMapperEntity.java
index 7bb4204de9..ceb5b325be 100644
--- a/model/map-hot-rod/src/main/java/org/keycloak/models/map/storage/hotRod/client/HotRodProtocolMapperEntity.java
+++ b/model/map-hot-rod/src/main/java/org/keycloak/models/map/storage/hotRod/client/HotRodProtocolMapperEntity.java
@@ -34,10 +34,6 @@ public class HotRodProtocolMapperEntity extends AbstractHotRodEntity {
public String protocol;
@ProtoField(number = 4)
public String protocolMapper;
-// @ProtoField(number = 5, defaultValue = "false")
-// public boolean consentRequired;
-// @ProtoField(number = 5)
-// public String consentText;
@ProtoField(number = 5)
public Set> config;
diff --git a/model/map-hot-rod/src/main/java/org/keycloak/models/map/storage/hotRod/clientscope/HotRodClientScopeEntity.java b/model/map-hot-rod/src/main/java/org/keycloak/models/map/storage/hotRod/clientscope/HotRodClientScopeEntity.java
index 0fc8e2c079..f7b7bd06b6 100644
--- a/model/map-hot-rod/src/main/java/org/keycloak/models/map/storage/hotRod/clientscope/HotRodClientScopeEntity.java
+++ b/model/map-hot-rod/src/main/java/org/keycloak/models/map/storage/hotRod/clientscope/HotRodClientScopeEntity.java
@@ -17,6 +17,8 @@
package org.keycloak.models.map.storage.hotRod.clientscope;
+import org.infinispan.api.annotations.indexing.Basic;
+import org.infinispan.api.annotations.indexing.Indexed;
import org.infinispan.protostream.GeneratedSchema;
import org.infinispan.protostream.annotations.AutoProtoSchemaBuilder;
import org.infinispan.protostream.annotations.ProtoDoc;
@@ -43,7 +45,7 @@ import java.util.Set;
topLevelEntity = true,
modelClass = "org.keycloak.models.ClientScopeModel"
)
-@ProtoDoc("@Indexed")
+@Indexed
@ProtoDoc("schema-version: " + HotRodClientScopeEntity.VERSION)
public class HotRodClientScopeEntity extends AbstractHotRodEntity {
@@ -63,18 +65,18 @@ public class HotRodClientScopeEntity extends AbstractHotRodEntity {
}
- @ProtoDoc("@Field(index = Index.YES, store = Store.YES)")
+ @Basic(projectable = true)
@ProtoField(number = 1)
public Integer entityVersion = VERSION;
@ProtoField(number = 2)
public String id;
- @ProtoDoc("@Field(index = Index.YES, store = Store.YES)")
+ @Basic(sortable = true)
@ProtoField(number = 3)
public String realmId;
- @ProtoDoc("@Field(index = Index.YES, store = Store.YES)")
+ @Basic(sortable = true)
@ProtoField(number = 4)
public String name;
diff --git a/model/map-hot-rod/src/main/java/org/keycloak/models/map/storage/hotRod/common/HotRodAttributeEntity.java b/model/map-hot-rod/src/main/java/org/keycloak/models/map/storage/hotRod/common/HotRodAttributeEntity.java
index c7fa39fba0..21c662ca72 100644
--- a/model/map-hot-rod/src/main/java/org/keycloak/models/map/storage/hotRod/common/HotRodAttributeEntity.java
+++ b/model/map-hot-rod/src/main/java/org/keycloak/models/map/storage/hotRod/common/HotRodAttributeEntity.java
@@ -17,7 +17,8 @@
package org.keycloak.models.map.storage.hotRod.common;
-import org.infinispan.protostream.annotations.ProtoDoc;
+import org.infinispan.api.annotations.indexing.Basic;
+import org.infinispan.api.annotations.indexing.Indexed;
import org.infinispan.protostream.annotations.ProtoField;
import java.util.List;
@@ -29,13 +30,13 @@ import java.util.Objects;
* If some change is needed please create a new version of this class and solve the migration on top-level entities.
*
*/
-@ProtoDoc("@Indexed")
+@Indexed
public class HotRodAttributeEntity {
- @ProtoDoc("@Field(index = Index.YES, store = Store.YES)")
+ @Basic(sortable = true)
@ProtoField(number = 1)
public String name;
- @ProtoDoc("@Field(index = Index.YES, store = Store.YES)")
+ @Basic(sortable = true)
@ProtoField(number = 2)
public List values;
diff --git a/model/map-hot-rod/src/main/java/org/keycloak/models/map/storage/hotRod/common/HotRodEntityDelegate.java b/model/map-hot-rod/src/main/java/org/keycloak/models/map/storage/hotRod/common/HotRodEntityDelegate.java
index e4214dd989..830d221247 100644
--- a/model/map-hot-rod/src/main/java/org/keycloak/models/map/storage/hotRod/common/HotRodEntityDelegate.java
+++ b/model/map-hot-rod/src/main/java/org/keycloak/models/map/storage/hotRod/common/HotRodEntityDelegate.java
@@ -17,7 +17,6 @@
package org.keycloak.models.map.storage.hotRod.common;
-import org.keycloak.models.map.common.AbstractEntity;
import org.keycloak.models.map.common.UpdatableEntity;
public interface HotRodEntityDelegate extends UpdatableEntity {
diff --git a/model/map-hot-rod/src/main/java/org/keycloak/models/map/storage/hotRod/common/HotRodStringPair.java b/model/map-hot-rod/src/main/java/org/keycloak/models/map/storage/hotRod/common/HotRodStringPair.java
index 02f4426c01..d22ff6f1af 100644
--- a/model/map-hot-rod/src/main/java/org/keycloak/models/map/storage/hotRod/common/HotRodStringPair.java
+++ b/model/map-hot-rod/src/main/java/org/keycloak/models/map/storage/hotRod/common/HotRodStringPair.java
@@ -17,7 +17,8 @@
package org.keycloak.models.map.storage.hotRod.common;
-import org.infinispan.protostream.annotations.ProtoDoc;
+import org.infinispan.api.annotations.indexing.Basic;
+import org.infinispan.api.annotations.indexing.Indexed;
import org.infinispan.protostream.annotations.ProtoField;
import java.util.Objects;
@@ -30,14 +31,14 @@ import java.util.Objects;
* Indexed Hot Rod pair entity where both key and value are {@link String} type. The entity should be used when
* there is a need to search by key or/and value. Otherwise {@link HotRodPair} should be used.
*/
-@ProtoDoc("@Indexed")
+@Indexed
public class HotRodStringPair {
- @ProtoDoc("@Field(index = Index.YES, store = Store.YES)")
+ @Basic(sortable = true)
@ProtoField(number = 1)
public String key;
- @ProtoDoc("@Field(index = Index.YES, store = Store.YES)")
+ @Basic(sortable = true)
@ProtoField(number = 2)
public String value;
diff --git a/model/map-hot-rod/src/main/java/org/keycloak/models/map/storage/hotRod/events/HotRodAdminEventEntity.java b/model/map-hot-rod/src/main/java/org/keycloak/models/map/storage/hotRod/events/HotRodAdminEventEntity.java
index 21bc536205..22da3a9c25 100644
--- a/model/map-hot-rod/src/main/java/org/keycloak/models/map/storage/hotRod/events/HotRodAdminEventEntity.java
+++ b/model/map-hot-rod/src/main/java/org/keycloak/models/map/storage/hotRod/events/HotRodAdminEventEntity.java
@@ -17,6 +17,8 @@
package org.keycloak.models.map.storage.hotRod.events;
+import org.infinispan.api.annotations.indexing.Basic;
+import org.infinispan.api.annotations.indexing.Indexed;
import org.infinispan.protostream.GeneratedSchema;
import org.infinispan.protostream.annotations.AutoProtoSchemaBuilder;
import org.infinispan.protostream.annotations.ProtoDoc;
@@ -34,7 +36,7 @@ import org.keycloak.models.map.storage.hotRod.common.UpdatableHotRodEntityDelega
topLevelEntity = true,
modelClass = "org.keycloak.events.admin.AdminEvent"
)
-@ProtoDoc("@Indexed")
+@Indexed
@ProtoDoc("schema-version: " + HotRodAdminEventEntity.VERSION)
public class HotRodAdminEventEntity extends AbstractHotRodEntity {
@@ -50,56 +52,56 @@ public class HotRodAdminEventEntity extends AbstractHotRodEntity {
public interface HotRodAdminEventEntitySchema extends GeneratedSchema {
HotRodAdminEventEntitySchema INSTANCE = new HotRodAdminEventEntitySchemaImpl();
}
- @ProtoDoc("@Field(index = Index.YES, store = Store.YES)")
+ @Basic(projectable = true)
@ProtoField(number = 1)
public Integer entityVersion = VERSION;
@ProtoField(number = 2)
public String id;
- @ProtoDoc("@Field(index = Index.YES, store = Store.YES)")
+ @Basic(sortable = true)
@ProtoField(number = 3)
public Long expiration;
- @ProtoDoc("@Field(index = Index.YES, store = Store.YES)")
+ @Basic(sortable = true)
@ProtoField(number = 4)
public Long timestamp;
- @ProtoDoc("@Field(index = Index.YES, store = Store.YES)")
+ @Basic(sortable = true)
@ProtoField(number = 5)
public Integer operationType;
- @ProtoDoc("@Field(index = Index.YES, store = Store.YES)")
+ @Basic(sortable = true)
@ProtoField(number = 6)
public String authClientId;
- @ProtoDoc("@Field(index = Index.YES, store = Store.YES)")
+ @Basic(sortable = true)
@ProtoField(number = 7)
public String authIpAddress;
- @ProtoDoc("@Field(index = Index.YES, store = Store.YES)")
+ @Basic(sortable = true)
@ProtoField(number = 8)
public String authRealmId;
- @ProtoDoc("@Field(index = Index.YES, store = Store.YES)")
+ @Basic(sortable = true)
@ProtoField(number = 9)
public String authUserId;
@ProtoField(number = 10)
public String error;
- @ProtoDoc("@Field(index = Index.YES, store = Store.YES)")
+ @Basic(sortable = true)
@ProtoField(number = 11)
public String realmId;
@ProtoField(number = 12)
public String representation;
- @ProtoDoc("@Field(index = Index.YES, store = Store.YES)")
+ @Basic(sortable = true)
@ProtoField(number = 13)
public String resourcePath;
- @ProtoDoc("@Field(index = Index.YES, store = Store.YES)")
+ @Basic(sortable = true)
@ProtoField(number = 14)
public String resourceType;
diff --git a/model/map-hot-rod/src/main/java/org/keycloak/models/map/storage/hotRod/events/HotRodAuthEventEntity.java b/model/map-hot-rod/src/main/java/org/keycloak/models/map/storage/hotRod/events/HotRodAuthEventEntity.java
index 61afcf627b..48ef354e3d 100644
--- a/model/map-hot-rod/src/main/java/org/keycloak/models/map/storage/hotRod/events/HotRodAuthEventEntity.java
+++ b/model/map-hot-rod/src/main/java/org/keycloak/models/map/storage/hotRod/events/HotRodAuthEventEntity.java
@@ -17,6 +17,8 @@
package org.keycloak.models.map.storage.hotRod.events;
+import org.infinispan.api.annotations.indexing.Basic;
+import org.infinispan.api.annotations.indexing.Indexed;
import org.infinispan.protostream.GeneratedSchema;
import org.infinispan.protostream.annotations.AutoProtoSchemaBuilder;
import org.infinispan.protostream.annotations.ProtoDoc;
@@ -36,7 +38,7 @@ import java.util.Set;
topLevelEntity = true,
modelClass = "org.keycloak.events.Event"
)
-@ProtoDoc("@Indexed")
+@Indexed
@ProtoDoc("schema-version: " + HotRodAuthEventEntity.VERSION)
public class HotRodAuthEventEntity extends AbstractHotRodEntity {
@@ -55,44 +57,44 @@ public class HotRodAuthEventEntity extends AbstractHotRodEntity {
HotRodAuthEventEntitySchema INSTANCE = new HotRodAuthEventEntitySchemaImpl();
}
- @ProtoDoc("@Field(index = Index.YES, store = Store.YES)")
+ @Basic(projectable = true)
@ProtoField(number = 1)
public Integer entityVersion = VERSION;
@ProtoField(number = 2)
public String id;
- @ProtoDoc("@Field(index = Index.YES, store = Store.YES)")
+ @Basic(sortable = true)
@ProtoField(number = 3)
public Integer type;
- @ProtoDoc("@Field(index = Index.YES, store = Store.YES)")
+ @Basic(sortable = true)
@ProtoField(number = 4)
public Long expiration;
- @ProtoDoc("@Field(index = Index.YES, store = Store.YES)")
+ @Basic(sortable = true)
@ProtoField(number = 5)
public Long timestamp;
- @ProtoDoc("@Field(index = Index.YES, store = Store.YES)")
+ @Basic(sortable = true)
@ProtoField(number = 6)
public String clientId;
@ProtoField(number = 7)
public String error;
- @ProtoDoc("@Field(index = Index.YES, store = Store.YES)")
+ @Basic(sortable = true)
@ProtoField(number = 8)
public String ipAddress;
- @ProtoDoc("@Field(index = Index.YES, store = Store.YES)")
+ @Basic(sortable = true)
@ProtoField(number = 9)
public String realmId;
@ProtoField(number = 10)
public String sessionId;
- @ProtoDoc("@Field(index = Index.YES, store = Store.YES)")
+ @Basic(sortable = true)
@ProtoField(number = 11)
public String userId;
diff --git a/model/map-hot-rod/src/main/java/org/keycloak/models/map/storage/hotRod/group/HotRodGroupEntity.java b/model/map-hot-rod/src/main/java/org/keycloak/models/map/storage/hotRod/group/HotRodGroupEntity.java
index cca7a36f87..315304f052 100644
--- a/model/map-hot-rod/src/main/java/org/keycloak/models/map/storage/hotRod/group/HotRodGroupEntity.java
+++ b/model/map-hot-rod/src/main/java/org/keycloak/models/map/storage/hotRod/group/HotRodGroupEntity.java
@@ -17,6 +17,9 @@
package org.keycloak.models.map.storage.hotRod.group;
+import org.infinispan.api.annotations.indexing.Basic;
+import org.infinispan.api.annotations.indexing.Indexed;
+import org.infinispan.api.annotations.indexing.Keyword;
import org.infinispan.protostream.GeneratedSchema;
import org.infinispan.protostream.annotations.AutoProtoSchemaBuilder;
import org.infinispan.protostream.annotations.ProtoDoc;
@@ -38,7 +41,7 @@ import java.util.Set;
topLevelEntity = true,
modelClass = "org.keycloak.models.GroupModel"
)
-@ProtoDoc("@Indexed")
+@Indexed
@ProtoDoc("schema-version: " + HotRodGroupEntity.VERSION)
public class HotRodGroupEntity extends AbstractHotRodEntity {
@@ -77,44 +80,35 @@ public class HotRodGroupEntity extends AbstractHotRodEntity {
HotRodGroupEntity entity = getHotRodEntity();
entity.updated |= ! Objects.equals(entity.name, name);
entity.name = name;
- entity.nameLowercase = name == null ? null : name.toLowerCase();
}
}
- @ProtoDoc("@Field(index = Index.YES, store = Store.YES)")
+ @Basic(projectable = true)
@ProtoField(number = 1)
public Integer entityVersion = VERSION;
- @ProtoDoc("@Field(index = Index.YES, store = Store.YES)")
+ @Basic(projectable = true, sortable = true)
@ProtoField(number = 2)
public String id;
- @ProtoDoc("@Field(index = Index.YES, store = Store.YES)")
+ @Basic(sortable = true)
@ProtoField(number = 3)
public String realmId;
- @ProtoDoc("@Field(index = Index.YES, store = Store.YES)")
+ @Keyword(sortable = true, normalizer = "lowercase")
@ProtoField(number = 4)
public String name;
- /**
- * Lowercase interpretation of {@link #name} field. Infinispan doesn't support case-insensitive LIKE for non-analyzed fields.
- * Search on analyzed fields can be case-insensitive (based on used analyzer) but doesn't support ORDER BY analyzed field.
- */
- @ProtoDoc("@Field(index = Index.YES, store = Store.YES)")
+ @Basic(sortable = true)
@ProtoField(number = 5)
- public String nameLowercase;
-
- @ProtoDoc("@Field(index = Index.YES, store = Store.YES)")
- @ProtoField(number = 6)
public String parentId;
- @ProtoDoc("@Field(index = Index.YES, store = Store.YES)")
- @ProtoField(number = 7)
+ @Basic(sortable = true)
+ @ProtoField(number = 6)
public Set attributes;
- @ProtoDoc("@Field(index = Index.YES, store = Store.YES)")
- @ProtoField(number = 8)
+ @Basic(sortable = true)
+ @ProtoField(number = 7)
public Set grantedRoles;
@Override
diff --git a/model/map-hot-rod/src/main/java/org/keycloak/models/map/storage/hotRod/loginFailure/HotRodUserLoginFailureEntity.java b/model/map-hot-rod/src/main/java/org/keycloak/models/map/storage/hotRod/loginFailure/HotRodUserLoginFailureEntity.java
index 46510c7ae6..d2818939d0 100644
--- a/model/map-hot-rod/src/main/java/org/keycloak/models/map/storage/hotRod/loginFailure/HotRodUserLoginFailureEntity.java
+++ b/model/map-hot-rod/src/main/java/org/keycloak/models/map/storage/hotRod/loginFailure/HotRodUserLoginFailureEntity.java
@@ -17,6 +17,8 @@
package org.keycloak.models.map.storage.hotRod.loginFailure;
+import org.infinispan.api.annotations.indexing.Basic;
+import org.infinispan.api.annotations.indexing.Indexed;
import org.infinispan.protostream.GeneratedSchema;
import org.infinispan.protostream.annotations.AutoProtoSchemaBuilder;
import org.infinispan.protostream.annotations.ProtoDoc;
@@ -34,7 +36,7 @@ import org.keycloak.models.map.storage.hotRod.common.UpdatableHotRodEntityDelega
topLevelEntity = true,
modelClass = "org.keycloak.models.UserLoginFailureModel"
)
-@ProtoDoc("@Indexed")
+@Indexed
@ProtoDoc("schema-version: " + HotRodUserLoginFailureEntity.VERSION)
public class HotRodUserLoginFailureEntity extends AbstractHotRodEntity {
@@ -51,18 +53,18 @@ public class HotRodUserLoginFailureEntity extends AbstractHotRodEntity {
HotRodUserLoginFailureEntitySchema INSTANCE = new HotRodUserLoginFailureEntitySchemaImpl();
}
- @ProtoDoc("@Field(index = Index.YES, store = Store.YES)")
+ @Basic(projectable = true)
@ProtoField(number = 1)
public Integer entityVersion = VERSION;
@ProtoField(number = 2)
public String id;
- @ProtoDoc("@Field(index = Index.YES, store = Store.YES)")
+ @Basic(sortable = true)
@ProtoField(number = 3)
public String realmId;
- @ProtoDoc("@Field(index = Index.YES, store = Store.YES)")
+ @Basic(sortable = true)
@ProtoField(number = 4)
public String userId;
diff --git a/model/map-hot-rod/src/main/java/org/keycloak/models/map/storage/hotRod/realm/HotRodRealmEntity.java b/model/map-hot-rod/src/main/java/org/keycloak/models/map/storage/hotRod/realm/HotRodRealmEntity.java
index 32c682c618..7253ede9fc 100644
--- a/model/map-hot-rod/src/main/java/org/keycloak/models/map/storage/hotRod/realm/HotRodRealmEntity.java
+++ b/model/map-hot-rod/src/main/java/org/keycloak/models/map/storage/hotRod/realm/HotRodRealmEntity.java
@@ -17,6 +17,8 @@
package org.keycloak.models.map.storage.hotRod.realm;
+import org.infinispan.api.annotations.indexing.Basic;
+import org.infinispan.api.annotations.indexing.Indexed;
import org.infinispan.protostream.GeneratedSchema;
import org.infinispan.protostream.annotations.AutoProtoSchemaBuilder;
import org.infinispan.protostream.annotations.ProtoDoc;
@@ -75,7 +77,7 @@ import static org.keycloak.models.map.common.ExpirationUtils.isExpired;
topLevelEntity = true,
modelClass = "org.keycloak.models.RealmModel"
)
-@ProtoDoc("@Indexed")
+@Indexed
@ProtoDoc("schema-version: " + HotRodRealmEntity.VERSION)
public class HotRodRealmEntity extends AbstractHotRodEntity {
@@ -106,14 +108,14 @@ public class HotRodRealmEntity extends AbstractHotRodEntity {
HotRodRealmEntitySchema INSTANCE = new HotRodRealmEntitySchemaImpl();
}
- @ProtoDoc("@Field(index = Index.YES, store = Store.YES)")
+ @Basic(projectable = true)
@ProtoField(number = 1)
public Integer entityVersion = VERSION;
@ProtoField(number = 2)
public String id;
- @ProtoDoc("@Field(index = Index.YES, store = Store.YES)")
+ @Basic(sortable = true)
@ProtoField(number = 3)
public String name;
@@ -242,11 +244,11 @@ public class HotRodRealmEntity extends AbstractHotRodEntity {
@ProtoField(number = 65)
public Set authenticatorConfigs;
- @ProtoDoc("@Field(index = Index.YES, store = Store.YES)")
+ @Basic(sortable = true)
@ProtoField(number = 66)
public Set clientInitialAccesses;
- @ProtoDoc("@Field(index = Index.YES, store = Store.YES)")
+ @Basic(sortable = true)
@ProtoField(number = 67)
public Set components;
diff --git a/model/map-hot-rod/src/main/java/org/keycloak/models/map/storage/hotRod/realm/entity/HotRodComponentEntity.java b/model/map-hot-rod/src/main/java/org/keycloak/models/map/storage/hotRod/realm/entity/HotRodComponentEntity.java
index dfb1f62701..cb54fc5f01 100644
--- a/model/map-hot-rod/src/main/java/org/keycloak/models/map/storage/hotRod/realm/entity/HotRodComponentEntity.java
+++ b/model/map-hot-rod/src/main/java/org/keycloak/models/map/storage/hotRod/realm/entity/HotRodComponentEntity.java
@@ -1,6 +1,7 @@
package org.keycloak.models.map.storage.hotRod.realm.entity;
-import org.infinispan.protostream.annotations.ProtoDoc;
+import org.infinispan.api.annotations.indexing.Basic;
+import org.infinispan.api.annotations.indexing.Indexed;
import org.infinispan.protostream.annotations.ProtoField;
import org.keycloak.models.map.annotations.GenerateHotRodEntityImplementation;
import org.keycloak.models.map.storage.hotRod.common.AbstractHotRodEntity;
@@ -11,7 +12,7 @@ import java.util.Set;
@GenerateHotRodEntityImplementation(
implementInterface = "org.keycloak.models.map.realm.entity.MapComponentEntity"
)
-@ProtoDoc("@Indexed")
+@Indexed
public class HotRodComponentEntity extends AbstractHotRodEntity {
@ProtoField(number = 1)
public String id;
@@ -22,7 +23,7 @@ public class HotRodComponentEntity extends AbstractHotRodEntity {
@ProtoField(number = 4)
public String providerId;
- @ProtoDoc("@Field(index = Index.YES, store = Store.YES)")
+ @Basic(sortable = true)
@ProtoField(number = 5)
public String providerType;
diff --git a/model/map-hot-rod/src/main/java/org/keycloak/models/map/storage/hotRod/role/HotRodRoleEntity.java b/model/map-hot-rod/src/main/java/org/keycloak/models/map/storage/hotRod/role/HotRodRoleEntity.java
index 980db74ca2..652f41af51 100644
--- a/model/map-hot-rod/src/main/java/org/keycloak/models/map/storage/hotRod/role/HotRodRoleEntity.java
+++ b/model/map-hot-rod/src/main/java/org/keycloak/models/map/storage/hotRod/role/HotRodRoleEntity.java
@@ -16,6 +16,9 @@
*/
package org.keycloak.models.map.storage.hotRod.role;
+import org.infinispan.api.annotations.indexing.Basic;
+import org.infinispan.api.annotations.indexing.Indexed;
+import org.infinispan.api.annotations.indexing.Keyword;
import org.infinispan.protostream.GeneratedSchema;
import org.infinispan.protostream.annotations.AutoProtoSchemaBuilder;
import org.infinispan.protostream.annotations.ProtoDoc;
@@ -37,7 +40,7 @@ import java.util.Set;
topLevelEntity = true,
modelClass = "org.keycloak.models.RoleModel"
)
-@ProtoDoc("@Indexed")
+@Indexed
@ProtoDoc("schema-version: " + HotRodRoleEntity.VERSION)
public class HotRodRoleEntity extends AbstractHotRodEntity {
@@ -77,51 +80,42 @@ public class HotRodRoleEntity extends AbstractHotRodEntity {
HotRodRoleEntity entity = getHotRodEntity();
entity.updated |= ! Objects.equals(entity.name, name);
entity.name = name;
- entity.nameLowercase = name == null ? null : name.toLowerCase();
}
}
- @ProtoDoc("@Field(index = Index.YES, store = Store.YES)")
+ @Basic(projectable = true)
@ProtoField(number = 1)
public Integer entityVersion = VERSION;
- @ProtoDoc("@Field(index = Index.YES, store = Store.YES)")
+ @Basic(projectable = true, sortable = true)
@ProtoField(number = 2)
public String id;
- @ProtoDoc("@Field(index = Index.YES, store = Store.YES)")
+ @Basic(sortable = true)
@ProtoField(number = 3)
public String realmId;
- @ProtoDoc("@Field(index = Index.YES, store = Store.YES)")
+ @Keyword(sortable = true, normalizer = "lowercase")
@ProtoField(number = 4)
public String name;
- /**
- * Lowercase interpretation of {@link #name} field. Infinispan doesn't support case-insensitive LIKE for non-analyzed fields.
- * Search on analyzed fields can be case-insensitive (based on used analyzer) but doesn't support ORDER BY analyzed field.
- */
- @ProtoDoc("@Field(index = Index.YES, store = Store.YES)")
+ @Keyword(sortable = true, normalizer = "lowercase")
@ProtoField(number = 5)
- public String nameLowercase;
-
- @ProtoDoc("@Field(index = Index.YES, store = Store.YES, analyze = Analyze.YES, analyzer = @Analyzer(definition = \"filename\"))")
- @ProtoField(number = 6)
public String description;
- @ProtoDoc("@Field(index = Index.YES, store = Store.YES)")
- @ProtoField(number = 7)
+ @Basic(sortable = true)
+ @ProtoField(number = 6)
public Boolean clientRole;
- @ProtoDoc("@Field(index = Index.YES, store = Store.YES)")
- @ProtoField(number = 8)
+ @Basic(sortable = true)
+ @ProtoField(number = 7)
public String clientId;
- @ProtoDoc("@Field(index = Index.YES, store = Store.YES)")
- @ProtoField(number = 9)
+ @Basic(sortable = true)
+ @ProtoField(number = 8)
public Set compositeRoles;
- @ProtoField(number = 10)
+ @ProtoField(number = 9)
public Set attributes;
@Override
diff --git a/model/map-hot-rod/src/main/java/org/keycloak/models/map/storage/hotRod/singleUseObject/HotRodSingleUseObjectEntity.java b/model/map-hot-rod/src/main/java/org/keycloak/models/map/storage/hotRod/singleUseObject/HotRodSingleUseObjectEntity.java
index 0ff805ee97..9d62acc2f7 100644
--- a/model/map-hot-rod/src/main/java/org/keycloak/models/map/storage/hotRod/singleUseObject/HotRodSingleUseObjectEntity.java
+++ b/model/map-hot-rod/src/main/java/org/keycloak/models/map/storage/hotRod/singleUseObject/HotRodSingleUseObjectEntity.java
@@ -17,6 +17,8 @@
package org.keycloak.models.map.storage.hotRod.singleUseObject;
+import org.infinispan.api.annotations.indexing.Basic;
+import org.infinispan.api.annotations.indexing.Indexed;
import org.infinispan.protostream.GeneratedSchema;
import org.infinispan.protostream.annotations.AutoProtoSchemaBuilder;
import org.infinispan.protostream.annotations.ProtoDoc;
@@ -37,7 +39,7 @@ import java.util.Set;
topLevelEntity = true,
modelClass = "org.keycloak.models.SingleUseObjectValueModel"
)
-@ProtoDoc("@Indexed")
+@Indexed
@ProtoDoc("schema-version: " + HotRodSingleUseObjectEntity.VERSION)
public class HotRodSingleUseObjectEntity extends AbstractHotRodEntity {
@@ -56,7 +58,7 @@ public class HotRodSingleUseObjectEntity extends AbstractHotRodEntity {
HotRodSingleUseObjectEntitySchema INSTANCE = new HotRodSingleUseObjectEntitySchemaImpl();
}
- @ProtoDoc("@Field(index = Index.YES, store = Store.YES)")
+ @Basic(projectable = true)
@ProtoField(number = 1)
public Integer entityVersion = VERSION;
diff --git a/model/map-hot-rod/src/main/java/org/keycloak/models/map/storage/hotRod/user/HotRodUserConsentEntity.java b/model/map-hot-rod/src/main/java/org/keycloak/models/map/storage/hotRod/user/HotRodUserConsentEntity.java
index 3d77a595e3..750e1a90a4 100644
--- a/model/map-hot-rod/src/main/java/org/keycloak/models/map/storage/hotRod/user/HotRodUserConsentEntity.java
+++ b/model/map-hot-rod/src/main/java/org/keycloak/models/map/storage/hotRod/user/HotRodUserConsentEntity.java
@@ -17,23 +17,23 @@
package org.keycloak.models.map.storage.hotRod.user;
-import org.infinispan.protostream.annotations.ProtoDoc;
+import org.infinispan.api.annotations.indexing.Basic;
+import org.infinispan.api.annotations.indexing.Indexed;
import org.infinispan.protostream.annotations.ProtoField;
import org.keycloak.models.map.annotations.GenerateHotRodEntityImplementation;
-import org.keycloak.models.map.storage.hotRod.client.HotRodProtocolMapperEntityDelegate;
import org.keycloak.models.map.storage.hotRod.common.AbstractHotRodEntity;
import java.util.Set;
@GenerateHotRodEntityImplementation(implementInterface = "org.keycloak.models.map.user.MapUserConsentEntity")
-@ProtoDoc("@Indexed")
+@Indexed
public class HotRodUserConsentEntity extends AbstractHotRodEntity {
+ @Basic(sortable = true)
@ProtoField(number = 1)
- @ProtoDoc("@Field(index = Index.YES, store = Store.YES)")
public String clientId;
-
+
+ @Basic(sortable = true)
@ProtoField(number = 2)
- @ProtoDoc("@Field(index = Index.YES, store = Store.YES)")
public Set grantedClientScopesIds;
@ProtoField(number = 3)
diff --git a/model/map-hot-rod/src/main/java/org/keycloak/models/map/storage/hotRod/user/HotRodUserEntity.java b/model/map-hot-rod/src/main/java/org/keycloak/models/map/storage/hotRod/user/HotRodUserEntity.java
index 0628821bb2..2952c9a9ec 100644
--- a/model/map-hot-rod/src/main/java/org/keycloak/models/map/storage/hotRod/user/HotRodUserEntity.java
+++ b/model/map-hot-rod/src/main/java/org/keycloak/models/map/storage/hotRod/user/HotRodUserEntity.java
@@ -17,6 +17,9 @@
package org.keycloak.models.map.storage.hotRod.user;
+import org.infinispan.api.annotations.indexing.Basic;
+import org.infinispan.api.annotations.indexing.Indexed;
+import org.infinispan.api.annotations.indexing.Keyword;
import org.infinispan.protostream.GeneratedSchema;
import org.infinispan.protostream.annotations.AutoProtoSchemaBuilder;
import org.infinispan.protostream.annotations.ProtoDoc;
@@ -49,7 +52,7 @@ import java.util.Set;
topLevelEntity = true,
modelClass = "org.keycloak.models.UserModel"
)
-@ProtoDoc("@Indexed")
+@Indexed
@ProtoDoc("schema-version: " + HotRodUserEntity.VERSION)
public class HotRodUserEntity extends AbstractHotRodEntity {
@@ -73,42 +76,41 @@ public class HotRodUserEntity extends AbstractHotRodEntity {
@IgnoreForEntityImplementationGenerator
private static final Logger LOG = Logger.getLogger(HotRodUserEntity.class);
- @ProtoDoc("@Field(index = Index.YES, store = Store.YES)")
+ @Basic(projectable = true)
@ProtoField(number = 1)
public Integer entityVersion = VERSION;
- @ProtoDoc("@Field(index = Index.YES, store = Store.YES)")
+ @Basic(projectable = true, sortable = true)
@ProtoField(number = 2)
public String id;
- @ProtoDoc("@Field(index = Index.YES, store = Store.YES)")
+ @Basic(sortable = true)
@ProtoField(number = 3)
public String realmId;
+ @Basic(sortable = true)
@ProtoField(number = 4)
- @ProtoDoc("@Field(index = Index.YES, store = Store.YES)")
public String username;
- @ProtoField(number = 22)
- @ProtoDoc("@Field(index = Index.YES, store = Store.YES)")
+ @Keyword(sortable = true, normalizer = "lowercase")
+ @ProtoField(number = 5)
public String usernameLowercase;
- @ProtoField(number = 5)
- @ProtoDoc("@Field(index = Index.YES, store = Store.YES, analyze = Analyze.YES, analyzer = @Analyzer(definition = \"filename\"))")
+ @Keyword(sortable = true, normalizer = "lowercase")
+ @ProtoField(number = 6)
public String firstName;
- @ProtoField(number = 6)
+ @ProtoField(number = 7)
public Long createdTimestamp;
- @ProtoField(number = 7)
- @ProtoDoc("@Field(index = Index.YES, store = Store.YES, analyze = Analyze.YES, analyzer = @Analyzer(definition = \"filename\"))")
+ @Keyword(sortable = true, normalizer = "lowercase")
+ @ProtoField(number = 8)
public String lastName;
- @ProtoField(number = 8)
- @ProtoDoc("@Field(index = Index.YES, store = Store.YES, analyze = Analyze.YES, analyzer = @Analyzer(definition = \"filename\"))")
+ @Keyword(sortable = true, normalizer = "lowercase")
+ @ProtoField(number = 9)
public String email;
- @ProtoField(number = 9)
/**
* TODO: Workaround for ISPN-8584
*
@@ -121,10 +123,10 @@ public class HotRodUserEntity extends AbstractHotRodEntity {
*
* In other words it is not possible to combine searching for Analyzed field and non-indexed field in one Ickle query
*/
- @ProtoDoc("@Field(index = Index.YES, store = Store.YES)")
+ @Basic(sortable = true)
+ @ProtoField(number = 10)
public Boolean enabled;
- @ProtoField(number = 10)
/**
* TODO: Workaround for ISPN-8584
*
@@ -135,48 +137,49 @@ public class HotRodUserEntity extends AbstractHotRodEntity {
*
* In other words it is not possible to combine searching for Analyzed field and non-indexed field in one Ickle query
*/
- @ProtoDoc("@Field(index = Index.YES, store = Store.YES)")
+ @Basic(sortable = true)
+ @ProtoField(number = 11)
public Boolean emailVerified;
// This is necessary to be able to dynamically switch unique email constraints on and off in the realm settings
- @ProtoField(number = 11)
+ @ProtoField(number = 12)
public String emailConstraint;
- @ProtoField(number = 12)
- @ProtoDoc("@Field(index = Index.YES, store = Store.YES)")
+ @Basic(sortable = true)
+ @ProtoField(number = 13)
public Set attributes;
- @ProtoField(number = 13)
+ @ProtoField(number = 14)
public Set requiredActions;
- @ProtoField(number = 14)
+ @ProtoField(number = 15)
public List credentials;
- @ProtoField(number = 15)
- @ProtoDoc("@Field(index = Index.YES, store = Store.YES)")
+ @Basic(sortable = true)
+ @ProtoField(number = 16)
public Set federatedIdentities;
- @ProtoField(number = 16)
- @ProtoDoc("@Field(index = Index.YES, store = Store.YES)")
+ @Basic(sortable = true)
+ @ProtoField(number = 17)
public Set userConsents;
- @ProtoField(number = 17)
- @ProtoDoc("@Field(index = Index.YES, store = Store.YES)")
+ @Basic(sortable = true)
+ @ProtoField(number = 18)
public Set groupsMembership = new HashSet<>();
- @ProtoField(number = 18)
- @ProtoDoc("@Field(index = Index.YES, store = Store.YES)")
+ @Basic(sortable = true)
+ @ProtoField(number = 19)
public Set rolesMembership = new HashSet<>();
- @ProtoField(number = 19)
- @ProtoDoc("@Field(index = Index.YES, store = Store.YES)")
+ @Basic(sortable = true)
+ @ProtoField(number = 20)
public String federationLink;
- @ProtoField(number = 20)
- @ProtoDoc("@Field(index = Index.YES, store = Store.YES)")
+ @Basic(sortable = true)
+ @ProtoField(number = 21)
public String serviceAccountClientLink;
- @ProtoField(number = 21)
+ @ProtoField(number = 22)
public Long notBefore;
public static abstract class AbstractHotRodUserEntityDelegate extends UpdatableHotRodEntityDelegateImpl implements MapUserEntity {
diff --git a/model/map-hot-rod/src/main/java/org/keycloak/models/map/storage/hotRod/user/HotRodUserFederatedIdentityEntity.java b/model/map-hot-rod/src/main/java/org/keycloak/models/map/storage/hotRod/user/HotRodUserFederatedIdentityEntity.java
index 996f4c60e5..77774ebec1 100644
--- a/model/map-hot-rod/src/main/java/org/keycloak/models/map/storage/hotRod/user/HotRodUserFederatedIdentityEntity.java
+++ b/model/map-hot-rod/src/main/java/org/keycloak/models/map/storage/hotRod/user/HotRodUserFederatedIdentityEntity.java
@@ -17,25 +17,25 @@
package org.keycloak.models.map.storage.hotRod.user;
-import org.infinispan.protostream.annotations.ProtoDoc;
+import org.infinispan.api.annotations.indexing.Basic;
+import org.infinispan.api.annotations.indexing.Indexed;
import org.infinispan.protostream.annotations.ProtoField;
import org.keycloak.models.map.annotations.GenerateHotRodEntityImplementation;
-import org.keycloak.models.map.storage.hotRod.client.HotRodProtocolMapperEntityDelegate;
import org.keycloak.models.map.storage.hotRod.common.AbstractHotRodEntity;
@GenerateHotRodEntityImplementation(implementInterface = "org.keycloak.models.map.user.MapUserFederatedIdentityEntity")
-@ProtoDoc("@Indexed")
+@Indexed
public class HotRodUserFederatedIdentityEntity extends AbstractHotRodEntity {
+ @Basic(sortable = true)
@ProtoField(number = 1)
- @ProtoDoc("@Field(index = Index.YES, store = Store.YES)")
public String identityProvider;
@ProtoField(number = 2)
public String token;
+ @Basic(sortable = true)
@ProtoField(number = 3)
- @ProtoDoc("@Field(index = Index.YES, store = Store.YES)")
public String userId;
@ProtoField(number = 4)
diff --git a/model/map-hot-rod/src/main/java/org/keycloak/models/map/storage/hotRod/userSession/HotRodAuthenticatedClientSessionEntity.java b/model/map-hot-rod/src/main/java/org/keycloak/models/map/storage/hotRod/userSession/HotRodAuthenticatedClientSessionEntity.java
index fe4ddc3eb7..a38ab0e1ac 100644
--- a/model/map-hot-rod/src/main/java/org/keycloak/models/map/storage/hotRod/userSession/HotRodAuthenticatedClientSessionEntity.java
+++ b/model/map-hot-rod/src/main/java/org/keycloak/models/map/storage/hotRod/userSession/HotRodAuthenticatedClientSessionEntity.java
@@ -17,6 +17,8 @@
package org.keycloak.models.map.storage.hotRod.userSession;
+import org.infinispan.api.annotations.indexing.Basic;
+import org.infinispan.api.annotations.indexing.Indexed;
import org.infinispan.protostream.GeneratedSchema;
import org.infinispan.protostream.annotations.AutoProtoSchemaBuilder;
import org.infinispan.protostream.annotations.ProtoDoc;
@@ -42,7 +44,7 @@ import java.util.Set;
cacheName = "org.keycloak.models.map.storage.ModelEntityUtil.getModelName(org.keycloak.models.UserSessionModel.class)" // Use the same cache name as user-sessions
)
@ProtoDoc("schema-version: " + HotRodResourceServerEntity.VERSION)
-@ProtoDoc("@Indexed")
+@Indexed
public class HotRodAuthenticatedClientSessionEntity extends AbstractHotRodEntity {
@IgnoreForEntityImplementationGenerator
@@ -63,10 +65,11 @@ public class HotRodAuthenticatedClientSessionEntity extends AbstractHotRodEntity
HotRodAuthenticatedClientSessionEntitySchema INSTANCE = new HotRodAuthenticatedClientSessionEntitySchemaImpl();
}
+ @Basic(projectable = true)
@ProtoField(number = 1)
public Integer entityVersion = VERSION;
- @ProtoDoc("@Field(index = Index.YES, store = Store.YES)")
+ @Basic(projectable = true, sortable = true)
@ProtoField(number = 2)
public String id;
diff --git a/model/map-hot-rod/src/main/java/org/keycloak/models/map/storage/hotRod/userSession/HotRodAuthenticatedClientSessionEntityReference.java b/model/map-hot-rod/src/main/java/org/keycloak/models/map/storage/hotRod/userSession/HotRodAuthenticatedClientSessionEntityReference.java
index 2bd6bd85f6..660ef98aa9 100644
--- a/model/map-hot-rod/src/main/java/org/keycloak/models/map/storage/hotRod/userSession/HotRodAuthenticatedClientSessionEntityReference.java
+++ b/model/map-hot-rod/src/main/java/org/keycloak/models/map/storage/hotRod/userSession/HotRodAuthenticatedClientSessionEntityReference.java
@@ -17,13 +17,14 @@
package org.keycloak.models.map.storage.hotRod.userSession;
-import org.infinispan.protostream.annotations.ProtoDoc;
+import org.infinispan.api.annotations.indexing.Basic;
+import org.infinispan.api.annotations.indexing.Indexed;
import org.infinispan.protostream.annotations.ProtoField;
-@ProtoDoc("@Indexed")
+@Indexed
public class HotRodAuthenticatedClientSessionEntityReference {
- @ProtoDoc("@Field(index = Index.YES, store = Store.YES)")
+ @Basic(sortable = true)
@ProtoField(number = 1)
public String clientId;
diff --git a/model/map-hot-rod/src/main/java/org/keycloak/models/map/storage/hotRod/userSession/HotRodUserSessionEntity.java b/model/map-hot-rod/src/main/java/org/keycloak/models/map/storage/hotRod/userSession/HotRodUserSessionEntity.java
index 6e855e15dc..919baf4178 100644
--- a/model/map-hot-rod/src/main/java/org/keycloak/models/map/storage/hotRod/userSession/HotRodUserSessionEntity.java
+++ b/model/map-hot-rod/src/main/java/org/keycloak/models/map/storage/hotRod/userSession/HotRodUserSessionEntity.java
@@ -17,6 +17,8 @@
package org.keycloak.models.map.storage.hotRod.userSession;
+import org.infinispan.api.annotations.indexing.Basic;
+import org.infinispan.api.annotations.indexing.Indexed;
import org.infinispan.protostream.GeneratedSchema;
import org.infinispan.protostream.annotations.AutoProtoSchemaBuilder;
import org.infinispan.protostream.annotations.ProtoDoc;
@@ -24,20 +26,15 @@ import org.infinispan.protostream.annotations.ProtoField;
import org.keycloak.models.UserSessionModel;
import org.keycloak.models.map.annotations.GenerateHotRodEntityImplementation;
import org.keycloak.models.map.annotations.IgnoreForEntityImplementationGenerator;
-import org.keycloak.models.map.common.DeepCloner;
-import org.keycloak.models.map.common.delegate.DelegateProvider;
import org.keycloak.models.map.storage.hotRod.authorization.HotRodResourceServerEntity;
import org.keycloak.models.map.common.UpdatableEntity;
-import org.keycloak.models.map.storage.hotRod.client.HotRodClientEntityDelegate;
import org.keycloak.models.map.storage.hotRod.common.AbstractHotRodEntity;
import org.keycloak.models.map.storage.hotRod.common.CommonPrimitivesProtoSchemaInitializer;
-import org.keycloak.models.map.storage.hotRod.common.HotRodEntityDelegate;
import org.keycloak.models.map.storage.hotRod.common.HotRodStringPair;
import org.keycloak.models.map.storage.hotRod.common.HotRodTypesUtils;
import org.keycloak.models.map.storage.hotRod.common.UpdatableHotRodEntityDelegateImpl;
import org.keycloak.models.map.userSession.MapAuthenticatedClientSessionEntity;
import org.keycloak.models.map.userSession.MapUserSessionEntity;
-import org.keycloak.models.map.userSession.MapUserSessionEntityDelegate;
import java.util.Collections;
import java.util.Objects;
@@ -50,7 +47,7 @@ import java.util.Set;
topLevelEntity = true,
modelClass = "org.keycloak.models.UserSessionModel"
)
-@ProtoDoc("@Indexed")
+@Indexed
@ProtoDoc("schema-version: " + HotRodResourceServerEntity.VERSION)
public class HotRodUserSessionEntity extends AbstractHotRodEntity {
@@ -70,26 +67,26 @@ public class HotRodUserSessionEntity extends AbstractHotRodEntity {
HotRodUserSessionEntitySchema INSTANCE = new HotRodUserSessionEntitySchemaImpl();
}
- @ProtoDoc("@Field(index = Index.YES, store = Store.YES)")
+ @Basic(projectable = true)
@ProtoField(number = 1)
public Integer entityVersion = VERSION;
@ProtoField(number = 2)
public String id;
- @ProtoDoc("@Field(index = Index.YES, store = Store.YES)")
+ @Basic(sortable = true)
@ProtoField(number = 3)
public String realmId;
- @ProtoDoc("@Field(index = Index.YES, store = Store.YES)")
+ @Basic(sortable = true)
@ProtoField(number = 4)
public String userId;
- @ProtoDoc("@Field(index = Index.YES, store = Store.YES)")
+ @Basic(sortable = true)
@ProtoField(number = 5)
public String brokerSessionId;
- @ProtoDoc("@Field(index = Index.YES, store = Store.YES)")
+ @Basic(sortable = true)
@ProtoField(number = 6)
public String brokerUserId;
@@ -108,26 +105,26 @@ public class HotRodUserSessionEntity extends AbstractHotRodEntity {
@ProtoField(number = 11)
public Long timestamp;
- @ProtoDoc("@Field(index = Index.YES, store = Store.YES)")
+ @Basic(sortable = true)
@ProtoField(number = 12)
public Long lastSessionRefresh;
- @ProtoDoc("@Field(index = Index.YES, store = Store.YES)")
+ @Basic(sortable = true)
@ProtoField(number = 13)
public Long expiration;
- @ProtoDoc("@Field(index = Index.YES, store = Store.YES)")
+ @Basic(sortable = true)
@ProtoField(number = 14)
public Set notes;
@ProtoField(number = 15)
public Integer state;
- @ProtoDoc("@Field(index = Index.YES, store = Store.YES)")
+ @Basic(sortable = true)
@ProtoField(number = 16)
public Set authenticatedClientSessions;
- @ProtoDoc("@Field(index = Index.YES, store = Store.YES)")
+ @Basic(sortable = true)
@ProtoField(number = 17)
public Boolean offline;
diff --git a/model/map-hot-rod/src/test/java/org/keycloak/models/map/storage/hotRod/IckleQueryMapModelCriteriaBuilderTest.java b/model/map-hot-rod/src/test/java/org/keycloak/models/map/storage/hotRod/IckleQueryMapModelCriteriaBuilderTest.java
index 45b848eec0..3bda7e27b3 100644
--- a/model/map-hot-rod/src/test/java/org/keycloak/models/map/storage/hotRod/IckleQueryMapModelCriteriaBuilderTest.java
+++ b/model/map-hot-rod/src/test/java/org/keycloak/models/map/storage/hotRod/IckleQueryMapModelCriteriaBuilderTest.java
@@ -77,7 +77,7 @@ public class IckleQueryMapModelCriteriaBuilderTest {
DefaultModelCriteria criteria = mcb.compare(UserModel.SearchableFields.REALM_ID, ModelCriteriaBuilder.Operator.EQ, "realm1");
criteria = criteria.compare(UserModel.SearchableFields.SERVICE_ACCOUNT_CLIENT, ModelCriteriaBuilder.Operator.NOT_EXISTS);
criteria = mcb.and(criteria, mcb.or(
- mcb.compare(UserModel.SearchableFields.USERNAME, ModelCriteriaBuilder.Operator.ILIKE, "a"),
+ mcb.compare(UserModel.SearchableFields.USERNAME, ModelCriteriaBuilder.Operator.LIKE, "a"),
mcb.compare(UserModel.SearchableFields.EMAIL, ModelCriteriaBuilder.Operator.ILIKE, "a"),
mcb.compare(UserModel.SearchableFields.FIRST_NAME, ModelCriteriaBuilder.Operator.ILIKE, "a"),
mcb.compare(UserModel.SearchableFields.LAST_NAME, ModelCriteriaBuilder.Operator.ILIKE, "a")
@@ -85,7 +85,17 @@ public class IckleQueryMapModelCriteriaBuilderTest {
IckleQueryMapModelCriteriaBuilder ickle = criteria.flashToModelCriteriaBuilder(new IckleQueryMapModelCriteriaBuilder<>(HotRodUserEntity.class));
- assertThat(ickle.getIckleQuery(), is(equalTo("FROM kc.HotRodUserEntity c WHERE ((c.realmId = :realmId0) AND (c.serviceAccountClientLink IS NULL OR c.serviceAccountClientLink IS EMPTY) AND ((c.usernameLowercase LIKE :usernameLowercase0) OR (c.email : 'a') OR (c.firstName : 'a') OR (c.lastName : 'a')))")));
+ assertThat(ickle.getIckleQuery(), is(equalTo("FROM kc.HotRodUserEntity c WHERE ((c.realmId = :realmId0) AND (c.serviceAccountClientLink IS NULL OR c.serviceAccountClientLink IS EMPTY) AND ((c.username LIKE :username0) OR (c.email LIKE :email0) OR (c.firstName LIKE :firstName0) OR (c.lastName LIKE :lastName0)))")));
+ assertThat(ickle.getParameters().entrySet(), hasSize(5));
+ assertThat(ickle.getParameters(), allOf(hasEntry("realmId0", "realm1"), hasEntry("username0", "a"), hasEntry("email0", "a"), hasEntry("firstName0", "a"), hasEntry("lastName0", "a")));
+
+ final DefaultModelCriteria mcb2 = criteria();
+ criteria = mcb2.compare(UserModel.SearchableFields.REALM_ID, ModelCriteriaBuilder.Operator.EQ, "realm1")
+ .compare(UserModel.SearchableFields.USERNAME_CASE_INSENSITIVE, ModelCriteriaBuilder.Operator.ILIKE, "a");
+
+ ickle = criteria.flashToModelCriteriaBuilder(new IckleQueryMapModelCriteriaBuilder<>(HotRodUserEntity.class));
+
+ assertThat(ickle.getIckleQuery(), is(equalTo("FROM kc.HotRodUserEntity c WHERE ((c.realmId = :realmId0) AND (c.usernameLowercase LIKE :usernameLowercase0))")));
assertThat(ickle.getParameters().entrySet(), hasSize(2));
assertThat(ickle.getParameters(), allOf(hasEntry("realmId0", "realm1"), hasEntry("usernameLowercase0", "a")));
}
diff --git a/pom.xml b/pom.xml
index b4020c0b5a..378621e588 100644
--- a/pom.xml
+++ b/pom.xml
@@ -958,6 +958,11 @@
infinispan-server-rest
${infinispan.version}
+
+ org.infinispan
+ infinispan-api
+ ${infinispan.version}
+
org.infinispan
infinispan-client-hotrod
diff --git a/quarkus/runtime/pom.xml b/quarkus/runtime/pom.xml
index bd3c085fe6..57214f5b9c 100644
--- a/quarkus/runtime/pom.xml
+++ b/quarkus/runtime/pom.xml
@@ -502,6 +502,17 @@
+
+ org.infinispan
+ infinispan-api
+ ${infinispan.version}
+
+
+ *
+ *
+
+
+
com.github.ua-parser
uap-java
diff --git a/testsuite/model/src/test/java/org/keycloak/testsuite/model/UserModelTest.java b/testsuite/model/src/test/java/org/keycloak/testsuite/model/UserModelTest.java
index b91900cbf3..843bc64a8d 100644
--- a/testsuite/model/src/test/java/org/keycloak/testsuite/model/UserModelTest.java
+++ b/testsuite/model/src/test/java/org/keycloak/testsuite/model/UserModelTest.java
@@ -149,6 +149,20 @@ public class UserModelTest extends KeycloakModelTest {
return null;
});
+ // try to query storage in a separate transaction to make sure that storage can handle case-sensitive usernames
+ withRealm(realm1Id, (session, realm) -> {
+ UserModel user1 = session.users().getUserByUsername(realm, "user");
+ UserModel user2 = session.users().getUserByUsername(realm, "USER");
+
+ assertThat(user1, not(nullValue()));
+ assertThat(user2, not(nullValue()));
+
+ assertThat(user1.getUsername(), equalTo("user"));
+ assertThat(user2.getUsername(), equalTo("USER"));
+
+ return null;
+ });
+
realm2Id = inComittedTransaction((Function) session -> {
RealmModel realm = session.realms().createRealm("realm2");
realm.setDefaultRole(session.roles().addRealmRole(realm, Constants.DEFAULT_ROLES_ROLE_PREFIX + "-" + realm.getName()));