diff --git a/server-spi-private/src/main/java/org/keycloak/authorization/model/PermissionTicket.java b/server-spi-private/src/main/java/org/keycloak/authorization/model/PermissionTicket.java index 814e0e161f..42846a4998 100644 --- a/server-spi-private/src/main/java/org/keycloak/authorization/model/PermissionTicket.java +++ b/server-spi-private/src/main/java/org/keycloak/authorization/model/PermissionTicket.java @@ -16,55 +16,34 @@ */ package org.keycloak.authorization.model; -import org.keycloak.storage.SearchableModelField; - /** * @author Pedro Igor */ public interface PermissionTicket { - public static class SearchableFields { - public static final SearchableModelField ID = new SearchableModelField<>("id", String.class); - public static final SearchableModelField RESOURCE_ID = new SearchableModelField<>("resourceId", String.class); - public static final SearchableModelField RESOURCE_SERVER_ID = new SearchableModelField<>("resourceServerId", String.class); - public static final SearchableModelField OWNER = new SearchableModelField<>("owner", String.class); - public static final SearchableModelField REQUESTER = new SearchableModelField<>("requester", String.class); - public static final SearchableModelField SCOPE_ID = new SearchableModelField<>("scopeId", String.class); - public static final SearchableModelField POLICY_ID = new SearchableModelField<>("policyId", String.class); - public static final SearchableModelField GRANTED_TIMESTAMP = new SearchableModelField<>("grantedTimestamp", String.class); - public static final SearchableModelField REALM_ID = new SearchableModelField<>("realmId", String.class); - } - public static enum FilterOption { - ID("id", SearchableFields.ID), - RESOURCE_ID("resource.id", SearchableFields.RESOURCE_ID), - RESOURCE_NAME("resource.name", SearchableFields.RESOURCE_ID), - SCOPE_ID("scope.id", SearchableFields.SCOPE_ID), - SCOPE_IS_NULL("scope_is_null", SearchableFields.SCOPE_ID), - OWNER("owner", SearchableFields.OWNER), - GRANTED("granted", SearchableFields.GRANTED_TIMESTAMP), - REQUESTER("requester", SearchableFields.REQUESTER), - REQUESTER_IS_NULL("requester_is_null", SearchableFields.REQUESTER), - POLICY_IS_NOT_NULL("policy_is_not_null", SearchableFields.POLICY_ID), - POLICY_ID("policy.id", SearchableFields.POLICY_ID) + ID("id"), + RESOURCE_ID("resource.id"), + RESOURCE_NAME("resource.name"), + SCOPE_ID("scope.id"), + SCOPE_IS_NULL("scope_is_null"), + OWNER("owner"), + GRANTED("granted"), + REQUESTER("requester"), + REQUESTER_IS_NULL("requester_is_null"), + POLICY_IS_NOT_NULL("policy_is_not_null"), + POLICY_ID("policy.id") ; private final String name; - private final SearchableModelField searchableModelField; - FilterOption(String name, SearchableModelField searchableModelField) { + FilterOption(String name) { this.name = name; - this.searchableModelField = searchableModelField; } - public String getName() { return name; } - - public SearchableModelField getSearchableModelField() { - return searchableModelField; - } } /** diff --git a/server-spi-private/src/main/java/org/keycloak/authorization/model/Policy.java b/server-spi-private/src/main/java/org/keycloak/authorization/model/Policy.java index 4945223e7b..26040ac0b2 100644 --- a/server-spi-private/src/main/java/org/keycloak/authorization/model/Policy.java +++ b/server-spi-private/src/main/java/org/keycloak/authorization/model/Policy.java @@ -20,7 +20,6 @@ package org.keycloak.authorization.model; import org.keycloak.representations.idm.authorization.DecisionStrategy; import org.keycloak.representations.idm.authorization.Logic; -import org.keycloak.storage.SearchableModelField; import java.util.Map; import java.util.Set; @@ -32,47 +31,27 @@ import java.util.Set; */ public interface Policy { - public static class SearchableFields { - public static final SearchableModelField ID = new SearchableModelField<>("id", String.class); - public static final SearchableModelField NAME = new SearchableModelField<>("name", String.class); - public static final SearchableModelField RESOURCE_SERVER_ID = new SearchableModelField<>("resourceServerId", String.class); - public static final SearchableModelField RESOURCE_ID = new SearchableModelField<>("resourceId", String.class); - public static final SearchableModelField SCOPE_ID = new SearchableModelField<>("scopeId", String.class); - public static final SearchableModelField TYPE = new SearchableModelField<>("type", String.class); - public static final SearchableModelField OWNER = new SearchableModelField<>("owner", String.class); - public static final SearchableModelField CONFIG = new SearchableModelField<>("config", String.class); - public static final SearchableModelField ASSOCIATED_POLICY_ID = new SearchableModelField<>("associatedPolicyId", String.class); - public static final SearchableModelField REALM_ID = new SearchableModelField<>("realmId", String.class); - } - public static enum FilterOption { - ID("id", SearchableFields.ID), - PERMISSION("permission", SearchableFields.TYPE), - OWNER("owner", SearchableFields.OWNER), - ANY_OWNER("owner.any", SearchableFields.OWNER), - RESOURCE_ID("resources.id", SearchableFields.RESOURCE_ID), - SCOPE_ID("scopes.id", SearchableFields.SCOPE_ID), - CONFIG("config", SearchableFields.CONFIG), - TYPE("type", SearchableFields.TYPE), - NAME("name", SearchableFields.NAME); + ID("id"), + PERMISSION("permission"), + OWNER("owner"), + ANY_OWNER("owner.any"), + RESOURCE_ID("resources.id"), + SCOPE_ID("scopes.id"), + CONFIG("config"), + TYPE("type"), + NAME("name"); public static final String[] EMPTY_FILTER = new String[0]; private final String name; - private final SearchableModelField searchableModelField; - FilterOption(String name, SearchableModelField searchableModelField) { + FilterOption(String name) { this.name = name; - this.searchableModelField = searchableModelField; } - public String getName() { return name; } - - public SearchableModelField getSearchableModelField() { - return searchableModelField; - } } public static final String CONFIG_SEPARATOR = "##"; diff --git a/server-spi-private/src/main/java/org/keycloak/authorization/model/Resource.java b/server-spi-private/src/main/java/org/keycloak/authorization/model/Resource.java index 5f5d2c7aae..514cf3f52a 100644 --- a/server-spi-private/src/main/java/org/keycloak/authorization/model/Resource.java +++ b/server-spi-private/src/main/java/org/keycloak/authorization/model/Resource.java @@ -18,8 +18,6 @@ package org.keycloak.authorization.model; -import org.keycloak.storage.SearchableModelField; - import java.util.List; import java.util.Map; import java.util.Set; @@ -31,46 +29,26 @@ import java.util.Set; */ public interface Resource { - public static class SearchableFields { - public static final SearchableModelField ID = new SearchableModelField<>("id", String.class); - public static final SearchableModelField NAME = new SearchableModelField<>("name", String.class); - public static final SearchableModelField RESOURCE_SERVER_ID = new SearchableModelField<>("resourceServerId", String.class); - public static final SearchableModelField OWNER = new SearchableModelField<>("owner", String.class); - public static final SearchableModelField TYPE = new SearchableModelField<>("type", String.class); - public static final SearchableModelField REALM_ID = new SearchableModelField<>("realmId", String.class); - - public static final SearchableModelField URI = new SearchableModelField<>("uris", String.class); - public static final SearchableModelField SCOPE_ID = new SearchableModelField<>("scope", String.class); - public static final SearchableModelField OWNER_MANAGED_ACCESS = new SearchableModelField<>("ownerManagedAccess", Boolean.class); - } - public static enum FilterOption { - ID("id", SearchableFields.ID), - NAME("name", SearchableFields.NAME), - EXACT_NAME("name", SearchableFields.NAME), - OWNER("owner", SearchableFields.OWNER), - TYPE("type", SearchableFields.TYPE), - URI("uri", SearchableFields.URI), - URI_NOT_NULL("uri_not_null", SearchableFields.URI), - OWNER_MANAGED_ACCESS("ownerManagedAccess", SearchableFields.OWNER_MANAGED_ACCESS), - SCOPE_ID("scopes.id", SearchableFields.SCOPE_ID); + ID("id"), + NAME("name"), + EXACT_NAME("name"), + OWNER("owner"), + TYPE("type"), + URI("uri"), + URI_NOT_NULL("uri_not_null"), + OWNER_MANAGED_ACCESS("ownerManagedAccess"), + SCOPE_ID("scopes.id"); private final String name; - private final SearchableModelField searchableModelField; - FilterOption(String name, SearchableModelField searchableModelField) { + FilterOption(String name) { this.name = name; - this.searchableModelField = searchableModelField; } - public String getName() { return name; } - - public SearchableModelField getSearchableModelField() { - return searchableModelField; - } } diff --git a/server-spi-private/src/main/java/org/keycloak/authorization/model/ResourceServer.java b/server-spi-private/src/main/java/org/keycloak/authorization/model/ResourceServer.java index 0a5a02987f..3468e00317 100644 --- a/server-spi-private/src/main/java/org/keycloak/authorization/model/ResourceServer.java +++ b/server-spi-private/src/main/java/org/keycloak/authorization/model/ResourceServer.java @@ -21,8 +21,6 @@ package org.keycloak.authorization.model; import org.keycloak.models.RealmModel; import org.keycloak.representations.idm.authorization.DecisionStrategy; import org.keycloak.representations.idm.authorization.PolicyEnforcementMode; -import org.keycloak.storage.SearchableModelField; - /** * Represents a resource server, whose resources are managed and protected. A resource server is basically an existing @@ -32,13 +30,6 @@ import org.keycloak.storage.SearchableModelField; */ public interface ResourceServer { - public static class SearchableFields { - public static final SearchableModelField ID = new SearchableModelField<>("id", String.class); - /** ID of the client (not the clientId) associated with resource server*/ - public static final SearchableModelField CLIENT_ID = new SearchableModelField<>("clientId", String.class); - public static final SearchableModelField REALM_ID = new SearchableModelField<>("realmId", String.class); - } - /** * Returns the unique identifier for this instance. * diff --git a/server-spi-private/src/main/java/org/keycloak/authorization/model/Scope.java b/server-spi-private/src/main/java/org/keycloak/authorization/model/Scope.java index b8821e767c..8c9c2ebe4b 100644 --- a/server-spi-private/src/main/java/org/keycloak/authorization/model/Scope.java +++ b/server-spi-private/src/main/java/org/keycloak/authorization/model/Scope.java @@ -18,8 +18,6 @@ package org.keycloak.authorization.model; -import org.keycloak.storage.SearchableModelField; - /** * Represents a scope, which is usually associated with one or more resources in order to define the actions that can be performed * or a specific access context. @@ -28,33 +26,19 @@ import org.keycloak.storage.SearchableModelField; */ public interface Scope { - public static class SearchableFields { - public static final SearchableModelField ID = new SearchableModelField<>("id", String.class); - public static final SearchableModelField NAME = new SearchableModelField<>("name", String.class); - public static final SearchableModelField RESOURCE_SERVER_ID = new SearchableModelField<>("resourceServerId", String.class); - public static final SearchableModelField REALM_ID = new SearchableModelField<>("realmId", String.class); - } - public static enum FilterOption { - ID("id", SearchableFields.ID), - NAME("name", SearchableFields.NAME); + ID("id"), + NAME("name"); private final String name; - private final SearchableModelField searchableModelField; - FilterOption(String name, SearchableModelField searchableModelField) { + FilterOption(String name) { this.name = name; - this.searchableModelField = searchableModelField; } - public String getName() { return name; } - - public SearchableModelField getSearchableModelField() { - return searchableModelField; - } } /** diff --git a/server-spi-private/src/main/java/org/keycloak/events/Event.java b/server-spi-private/src/main/java/org/keycloak/events/Event.java index c4b0d34379..5da17d138d 100644 --- a/server-spi-private/src/main/java/org/keycloak/events/Event.java +++ b/server-spi-private/src/main/java/org/keycloak/events/Event.java @@ -17,8 +17,6 @@ package org.keycloak.events; -import org.keycloak.storage.SearchableModelField; - import java.util.HashMap; import java.util.Map; @@ -27,16 +25,6 @@ import java.util.Map; */ public class Event { - public static class SearchableFields { - public static final SearchableModelField ID = new SearchableModelField<>("id", String.class); - public static final SearchableModelField REALM_ID = new SearchableModelField<>("realmId", String.class); - public static final SearchableModelField CLIENT_ID = new SearchableModelField<>("clientId", String.class); - public static final SearchableModelField USER_ID = new SearchableModelField<>("userId", String.class); - public static final SearchableModelField TIMESTAMP = new SearchableModelField<>("timestamp", Long.class); - public static final SearchableModelField IP_ADDRESS = new SearchableModelField<>("ipAddress", String.class); - public static final SearchableModelField EVENT_TYPE = new SearchableModelField<>("eventType", EventType.class); - } - private String id; private long time; diff --git a/server-spi-private/src/main/java/org/keycloak/events/admin/AdminEvent.java b/server-spi-private/src/main/java/org/keycloak/events/admin/AdminEvent.java index 5240d37963..6c6fb3aff7 100644 --- a/server-spi-private/src/main/java/org/keycloak/events/admin/AdminEvent.java +++ b/server-spi-private/src/main/java/org/keycloak/events/admin/AdminEvent.java @@ -17,26 +17,11 @@ package org.keycloak.events.admin; -import org.keycloak.storage.SearchableModelField; - /** * @author Stian Thorgersen */ public class AdminEvent { - public static class SearchableFields { - public static final SearchableModelField ID = new SearchableModelField<>("id", String.class); - public static final SearchableModelField REALM_ID = new SearchableModelField<>("realmId", String.class); - public static final SearchableModelField TIMESTAMP = new SearchableModelField<>("timestamp", Long.class); - public static final SearchableModelField AUTH_REALM_ID = new SearchableModelField<>("authRealmId", String.class); - public static final SearchableModelField AUTH_CLIENT_ID = new SearchableModelField<>("authClientId", String.class); - public static final SearchableModelField AUTH_USER_ID = new SearchableModelField<>("authUserId", String.class); - public static final SearchableModelField AUTH_IP_ADDRESS = new SearchableModelField<>("authIpAddress", String.class); - public static final SearchableModelField OPERATION_TYPE = new SearchableModelField<>("operationType", OperationType.class); - public static final SearchableModelField RESOURCE_TYPE = new SearchableModelField<>("resourceType", String.class); - public static final SearchableModelField RESOURCE_PATH = new SearchableModelField<>("resourcePath", String.class); - } - private String id; private long time; diff --git a/server-spi/src/main/java/org/keycloak/models/ClientModel.java b/server-spi/src/main/java/org/keycloak/models/ClientModel.java index b4c9a19cde..7dab1d442d 100755 --- a/server-spi/src/main/java/org/keycloak/models/ClientModel.java +++ b/server-spi/src/main/java/org/keycloak/models/ClientModel.java @@ -24,7 +24,6 @@ import java.util.Set; import org.keycloak.common.util.ObjectUtil; import org.keycloak.provider.ProviderEvent; import org.keycloak.provider.ProviderEventManager; -import org.keycloak.storage.SearchableModelField; /** * @author Bill Burke @@ -41,23 +40,6 @@ public interface ClientModel extends ClientScopeModel, RoleContainerModel, Prot String POLICY_URI ="policyUri"; String TOS_URI ="tosUri"; - public static class SearchableFields { - public static final SearchableModelField ID = new SearchableModelField<>("id", String.class); - public static final SearchableModelField REALM_ID = new SearchableModelField<>("realmId", String.class); - public static final SearchableModelField CLIENT_ID = new SearchableModelField<>("clientId", String.class); - public static final SearchableModelField ENABLED = new SearchableModelField<>("enabled", Boolean.class); - public static final SearchableModelField SCOPE_MAPPING_ROLE = new SearchableModelField<>("scopeMappingRole", String.class); - public static final SearchableModelField ALWAYS_DISPLAY_IN_CONSOLE = new SearchableModelField<>("alwaysDisplayInConsole", Boolean.class); - - /** - * Search for attribute value. The parameters is a pair {@code (attribute_name, value)} where {@code attribute_name} - * is always checked for equality, and the value is checked per the operator. - */ - public static final SearchableModelField ATTRIBUTE = new SearchableModelField<>("attribute", String[].class); - - public static final SearchableModelField AUTHENTICATION_FLOW_BINDING_OVERRIDE = new SearchableModelField<>("authenticationFlowBindingOverrides", String[].class); - } - interface ClientCreationEvent extends ProviderEvent { ClientModel getCreatedClient(); } diff --git a/server-spi/src/main/java/org/keycloak/models/ClientScopeModel.java b/server-spi/src/main/java/org/keycloak/models/ClientScopeModel.java index 8424c1a3ee..4a7e89ee6f 100755 --- a/server-spi/src/main/java/org/keycloak/models/ClientScopeModel.java +++ b/server-spi/src/main/java/org/keycloak/models/ClientScopeModel.java @@ -18,11 +18,9 @@ package org.keycloak.models; import java.util.Map; -import java.util.Optional; import org.keycloak.common.util.ObjectUtil; import org.keycloak.provider.ProviderEvent; -import org.keycloak.storage.SearchableModelField; /** * @author Bill Burke @@ -30,12 +28,6 @@ import org.keycloak.storage.SearchableModelField; */ public interface ClientScopeModel extends ProtocolMapperContainerModel, ScopeContainerModel, OrderedModel { - public static class SearchableFields { - public static final SearchableModelField ID = new SearchableModelField<>("id", String.class); - public static final SearchableModelField REALM_ID = new SearchableModelField<>("realmId", String.class); - public static final SearchableModelField NAME = new SearchableModelField<>("name", String.class); - } - interface ClientScopeRemovedEvent extends ProviderEvent { ClientScopeModel getClientScope(); diff --git a/server-spi/src/main/java/org/keycloak/models/GroupModel.java b/server-spi/src/main/java/org/keycloak/models/GroupModel.java index 09930a8ab5..1c90192025 100755 --- a/server-spi/src/main/java/org/keycloak/models/GroupModel.java +++ b/server-spi/src/main/java/org/keycloak/models/GroupModel.java @@ -19,7 +19,6 @@ package org.keycloak.models; import org.keycloak.provider.ProviderEvent; -import org.keycloak.storage.SearchableModelField; import java.util.Comparator; import java.util.List; import java.util.Map; @@ -31,25 +30,6 @@ import java.util.stream.Stream; */ public interface GroupModel extends RoleMapperModel { - public static class SearchableFields { - public static final SearchableModelField ID = new SearchableModelField<>("id", String.class); - public static final SearchableModelField REALM_ID = new SearchableModelField<>("realmId", String.class); - /** Parent group ID */ - public static final SearchableModelField PARENT_ID = new SearchableModelField<>("parentGroupId", String.class); - public static final SearchableModelField NAME = new SearchableModelField<>("name", String.class); - /** - * Field for comparison with roles granted to this group. - * A role can be checked for belonging only via EQ operator. Role is referred by their ID - */ - public static final SearchableModelField ASSIGNED_ROLE = new SearchableModelField<>("assignedRole", String.class); - - /** - * Search for attribute value. The parameters is a pair {@code (attribute_name, values...)} where {@code attribute_name} - * is always checked for equality, and the value is checked per the operator. - */ - public static final SearchableModelField ATTRIBUTE = new SearchableModelField<>("attribute", String[].class); - } - interface GroupRemovedEvent extends ProviderEvent { RealmModel getRealm(); GroupModel getGroup(); diff --git a/server-spi/src/main/java/org/keycloak/models/RealmModel.java b/server-spi/src/main/java/org/keycloak/models/RealmModel.java index 9abd8964c8..9d1e91a3f8 100755 --- a/server-spi/src/main/java/org/keycloak/models/RealmModel.java +++ b/server-spi/src/main/java/org/keycloak/models/RealmModel.java @@ -22,7 +22,6 @@ import org.keycloak.common.enums.SslRequired; import org.keycloak.component.ComponentModel; import org.keycloak.provider.Provider; import org.keycloak.provider.ProviderEvent; -import org.keycloak.storage.SearchableModelField; import java.util.Map; import java.util.Set; @@ -36,19 +35,6 @@ public interface RealmModel extends RoleContainerModel { Comparator COMPARE_BY_NAME = Comparator.comparing(RealmModel::getName); - public static class SearchableFields { - public static final SearchableModelField ID = new SearchableModelField<>("id", String.class); - public static final SearchableModelField NAME = new SearchableModelField<>("name", String.class); - /** - * Search for realms that have some client initial access set. - */ - public static final SearchableModelField CLIENT_INITIAL_ACCESS = new SearchableModelField<>("clientInitialAccess", Boolean.class); - /** - * Search for realms that have some component with - */ - public static final SearchableModelField COMPONENT_PROVIDER_TYPE = new SearchableModelField<>("componentProviderType", String.class); - } - interface RealmCreationEvent extends ProviderEvent { RealmModel getCreatedRealm(); KeycloakSession getKeycloakSession(); diff --git a/server-spi/src/main/java/org/keycloak/models/RoleModel.java b/server-spi/src/main/java/org/keycloak/models/RoleModel.java index 83ebba97f7..b0e91c5bdf 100755 --- a/server-spi/src/main/java/org/keycloak/models/RoleModel.java +++ b/server-spi/src/main/java/org/keycloak/models/RoleModel.java @@ -18,7 +18,6 @@ package org.keycloak.models; import org.keycloak.provider.ProviderEvent; -import org.keycloak.storage.SearchableModelField; import java.util.List; import java.util.Map; import java.util.stream.Stream; @@ -29,16 +28,6 @@ import java.util.stream.Stream; */ public interface RoleModel { - public static class SearchableFields { - public static final SearchableModelField ID = new SearchableModelField<>("id", String.class); - public static final SearchableModelField REALM_ID = new SearchableModelField<>("realmId", String.class); - /** If client role, ID of the client (not the clientId) */ - public static final SearchableModelField CLIENT_ID = new SearchableModelField<>("clientId", String.class); - public static final SearchableModelField NAME = new SearchableModelField<>("name", String.class); - public static final SearchableModelField DESCRIPTION = new SearchableModelField<>("description", String.class); - public static final SearchableModelField COMPOSITE_ROLE = new SearchableModelField<>("compositeRoles", Boolean.class); - } - interface RoleNameChangeEvent extends ProviderEvent { RealmModel getRealm(); String getNewName(); diff --git a/server-spi/src/main/java/org/keycloak/models/SingleUseObjectValueModel.java b/server-spi/src/main/java/org/keycloak/models/SingleUseObjectValueModel.java index d452c72750..8c6a39e74a 100644 --- a/server-spi/src/main/java/org/keycloak/models/SingleUseObjectValueModel.java +++ b/server-spi/src/main/java/org/keycloak/models/SingleUseObjectValueModel.java @@ -16,8 +16,6 @@ */ package org.keycloak.models; -import org.keycloak.storage.SearchableModelField; - import java.util.Map; /** @@ -26,11 +24,6 @@ import java.util.Map; */ public interface SingleUseObjectValueModel { - class SearchableFields { - public static final SearchableModelField ID = new SearchableModelField<>("id", String.class); - public static final SearchableModelField OBJECT_KEY = new SearchableModelField<>("objectKey", String.class); - } - /** * Returns unmodifiable map of all notes. * @return see description. Returns empty map if no note is set, never returns {@code null}. diff --git a/server-spi/src/main/java/org/keycloak/models/UserLoginFailureModel.java b/server-spi/src/main/java/org/keycloak/models/UserLoginFailureModel.java index 8192f2cde7..52ec097391 100755 --- a/server-spi/src/main/java/org/keycloak/models/UserLoginFailureModel.java +++ b/server-spi/src/main/java/org/keycloak/models/UserLoginFailureModel.java @@ -17,20 +17,12 @@ package org.keycloak.models; -import org.keycloak.storage.SearchableModelField; - /** * @author Bill Burke * @version $Revision: 1 $ */ public interface UserLoginFailureModel { - class SearchableFields { - public static final SearchableModelField ID = new SearchableModelField<>("id", String.class); - public static final SearchableModelField REALM_ID = new SearchableModelField<>("realmId", String.class); - public static final SearchableModelField USER_ID = new SearchableModelField<>("userId", String.class); - } - String getId(); String getUserId(); int getFailedLoginNotBefore(); diff --git a/server-spi/src/main/java/org/keycloak/models/UserModel.java b/server-spi/src/main/java/org/keycloak/models/UserModel.java index 475228b54d..60366542f8 100755 --- a/server-spi/src/main/java/org/keycloak/models/UserModel.java +++ b/server-spi/src/main/java/org/keycloak/models/UserModel.java @@ -18,7 +18,6 @@ package org.keycloak.models; import org.keycloak.provider.ProviderEvent; -import org.keycloak.storage.SearchableModelField; import java.util.Comparator; import java.util.List; @@ -47,58 +46,6 @@ public interface UserModel extends RoleMapperModel { Comparator COMPARE_BY_USERNAME = Comparator.comparing(UserModel::getUsername, String.CASE_INSENSITIVE_ORDER); - public static class SearchableFields { - public static final SearchableModelField ID = new SearchableModelField<>("id", String.class); - public static final SearchableModelField REALM_ID = new SearchableModelField<>("realmId", String.class); - public static final SearchableModelField FIRST_NAME = new SearchableModelField<>("firstName", String.class); - public static final SearchableModelField LAST_NAME = new SearchableModelField<>("lastName", String.class); - public static final SearchableModelField EMAIL = new SearchableModelField<>("email", String.class); - public static final SearchableModelField ENABLED = new SearchableModelField<>("enabled", Boolean.class); - public static final SearchableModelField EMAIL_VERIFIED = new SearchableModelField<>("emailVerified", Boolean.class); - public static final SearchableModelField FEDERATION_LINK = new SearchableModelField<>("federationLink", String.class); - - /** - * Search for user's username in case sensitive mode. - */ - public static final SearchableModelField USERNAME = new SearchableModelField<>("username", String.class); - /** - * Search for user's username in case insensitive mode. - */ - public static final SearchableModelField USERNAME_CASE_INSENSITIVE = new SearchableModelField<>("usernameCaseInsensitive", String.class); - - /** - * This field can only searched either for users coming from an IDP, then the operand is (idp_alias), - * or as user coming from a particular IDP with given username there, then the operand is a pair (idp_alias, idp_user_id). - * It is also possible to search regardless of {@code idp_alias}, then the pair is {@code (null, idp_user_id)}. - */ - public static final SearchableModelField IDP_AND_USER = new SearchableModelField<>("idpAlias:idpUserId", String.class); - - public static final SearchableModelField ASSIGNED_ROLE = new SearchableModelField<>("assignedRole", String.class); - public static final SearchableModelField ASSIGNED_GROUP = new SearchableModelField<>("assignedGroup", String.class); - /** - * Search for users that have consent set for a particular client. - */ - public static final SearchableModelField CONSENT_FOR_CLIENT = new SearchableModelField<>("clientConsent", String.class); - /** - * Search for users that have consent set for a particular client that originates in the given client provider. - */ - public static final SearchableModelField CONSENT_CLIENT_FEDERATION_LINK = new SearchableModelField<>("clientConsentFederationLink", String.class); - /** - * Search for users that have consent that has given client scope. - */ - public static final SearchableModelField CONSENT_WITH_CLIENT_SCOPE = new SearchableModelField<>("consentWithClientScope", String.class); - /** - * ID of the client corresponding to the service account - */ - public static final SearchableModelField SERVICE_ACCOUNT_CLIENT = new SearchableModelField<>("serviceAccountClientId", String.class); - /** - * Search for attribute value. The parameters is a pair {@code (attribute_name, values...)} where {@code attribute_name} - * is always checked for equality, and the value (which can be any numbert of values, none for operators like EXISTS - * or potentially many for e.g. IN) is checked per the operator. - */ - public static final SearchableModelField ATTRIBUTE = new SearchableModelField<>("attribute", String[].class); - } - interface UserRemovedEvent extends ProviderEvent { RealmModel getRealm(); UserModel getUser(); diff --git a/server-spi/src/main/java/org/keycloak/models/UserSessionModel.java b/server-spi/src/main/java/org/keycloak/models/UserSessionModel.java index 15070dd95b..5962e4ae11 100755 --- a/server-spi/src/main/java/org/keycloak/models/UserSessionModel.java +++ b/server-spi/src/main/java/org/keycloak/models/UserSessionModel.java @@ -17,8 +17,6 @@ package org.keycloak.models; -import org.keycloak.storage.SearchableModelField; - import java.util.Collection; import java.util.Map; import java.util.Objects; @@ -29,23 +27,6 @@ import org.keycloak.util.EnumWithStableIndex; */ public interface UserSessionModel { - class SearchableFields { - public static final SearchableModelField ID = new SearchableModelField<>("id", String.class); - - /** - * Represents the corresponding offline user session for the online user session. - * null if there is no corresponding offline user session. - */ - public static final SearchableModelField CORRESPONDING_SESSION_ID = new SearchableModelField<>("correspondingSessionId", String.class); - public static final SearchableModelField REALM_ID = new SearchableModelField<>("realmId", String.class); - public static final SearchableModelField USER_ID = new SearchableModelField<>("userId", String.class); - public static final SearchableModelField CLIENT_ID = new SearchableModelField<>("clientId", String.class); - public static final SearchableModelField BROKER_SESSION_ID = new SearchableModelField<>("brokerSessionId", String.class); - public static final SearchableModelField BROKER_USER_ID = new SearchableModelField<>("brokerUserId", String.class); - public static final SearchableModelField IS_OFFLINE = new SearchableModelField<>("isOffline", Boolean.class); - public static final SearchableModelField LAST_SESSION_REFRESH = new SearchableModelField<>("lastSessionRefresh", Long.class); - } - /** * Represents the corresponding online/offline user session. */ diff --git a/server-spi/src/main/java/org/keycloak/sessions/RootAuthenticationSessionModel.java b/server-spi/src/main/java/org/keycloak/sessions/RootAuthenticationSessionModel.java index be3334545f..391edc1317 100644 --- a/server-spi/src/main/java/org/keycloak/sessions/RootAuthenticationSessionModel.java +++ b/server-spi/src/main/java/org/keycloak/sessions/RootAuthenticationSessionModel.java @@ -21,7 +21,6 @@ import java.util.Map; import org.keycloak.models.ClientModel; import org.keycloak.models.RealmModel; -import org.keycloak.storage.SearchableModelField; /** * Represents usually one browser session with potentially many browser tabs. Every browser tab is represented by @@ -31,11 +30,6 @@ import org.keycloak.storage.SearchableModelField; */ public interface RootAuthenticationSessionModel { - public static class SearchableFields { - public static final SearchableModelField ID = new SearchableModelField<>("id", String.class); - public static final SearchableModelField REALM_ID = new SearchableModelField<>("realmId", String.class); - } - /** * Returns id of the root authentication session. * @return {@code String} diff --git a/server-spi/src/main/java/org/keycloak/storage/SearchableModelField.java b/server-spi/src/main/java/org/keycloak/storage/SearchableModelField.java deleted file mode 100644 index 1b075e71f4..0000000000 --- a/server-spi/src/main/java/org/keycloak/storage/SearchableModelField.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright 2021 Red Hat, Inc. and/or its affiliates - * and other contributors as indicated by the @author tags. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.keycloak.storage; - -/** - * - * @author hmlnarik - */ -public class SearchableModelField { - - private final String name; - private final Class fieldClass; - - public SearchableModelField(String name, Class fieldClass) { - this.name = name; - this.fieldClass = fieldClass; - } - - public String getName() { - return this.name; - } - - public Class getFieldType() { - return fieldClass; - } - - @Override - public String toString() { - return "SearchableModelField " + name + " @ " + getClass().getTypeParameters()[0].getTypeName(); - } -}