Merge pull request #2191 from patriot1burke/master

hashcode/equals on all entities/adapters
This commit is contained in:
Bill Burke 2016-02-08 14:32:37 -05:00
commit 02b9d5ee13
48 changed files with 602 additions and 189 deletions

View file

@ -404,4 +404,21 @@ public class UserAdapter implements UserModel {
return updated.revokeConsentForClient(clientId); return updated.revokeConsentForClient(clientId);
} }
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || !(o instanceof UserModel)) return false;
UserModel that = (UserModel) o;
return that.getId().equals(getId());
}
@Override
public int hashCode() {
return getId().hashCode();
}
} }

View file

@ -142,4 +142,23 @@ public class AuthenticationExecutionEntity {
public void setAuthenticatorConfig(String authenticatorConfig) { public void setAuthenticatorConfig(String authenticatorConfig) {
this.authenticatorConfig = authenticatorConfig; this.authenticatorConfig = authenticatorConfig;
} }
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null) return false;
if (!(o instanceof AuthenticationExecutionEntity)) return false;
AuthenticationExecutionEntity that = (AuthenticationExecutionEntity) o;
if (!id.equals(that.getId())) return false;
return true;
}
@Override
public int hashCode() {
return id.hashCode();
}
} }

View file

@ -131,4 +131,23 @@ public class AuthenticationFlowEntity {
public void setBuiltIn(boolean builtIn) { public void setBuiltIn(boolean builtIn) {
this.builtIn = builtIn; this.builtIn = builtIn;
} }
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null) return false;
if (!(o instanceof AuthenticationFlowEntity)) return false;
AuthenticationFlowEntity that = (AuthenticationFlowEntity) o;
if (!id.equals(that.getId())) return false;
return true;
}
@Override
public int hashCode() {
return id.hashCode();
}
} }

View file

@ -86,4 +86,23 @@ public class AuthenticatorConfigEntity {
public void setConfig(Map<String, String> config) { public void setConfig(Map<String, String> config) {
this.config = config; this.config = config;
} }
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null) return false;
if (!(o instanceof AuthenticatorConfigEntity)) return false;
AuthenticatorConfigEntity that = (AuthenticatorConfigEntity) o;
if (!id.equals(that.getId())) return false;
return true;
}
@Override
public int hashCode() {
return id.hashCode();
}
} }

View file

@ -454,4 +454,23 @@ public class ClientEntity {
public void setUseTemplateMappers(boolean useTemplateMappers) { public void setUseTemplateMappers(boolean useTemplateMappers) {
this.useTemplateMappers = useTemplateMappers; this.useTemplateMappers = useTemplateMappers;
} }
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null) return false;
if (!(o instanceof ClientEntity)) return false;
ClientEntity that = (ClientEntity) o;
if (!id.equals(that.getId())) return false;
return true;
}
@Override
public int hashCode() {
return id.hashCode();
}
} }

View file

@ -118,7 +118,8 @@ public class ClientIdentityProviderMappingEntity {
@Override @Override
public boolean equals(Object o) { public boolean equals(Object o) {
if (this == o) return true; if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false; if (o == null) return false;
if (!(o instanceof ClientIdentityProviderMappingEntity)) return false;
ClientIdentityProviderMappingEntity key = (ClientIdentityProviderMappingEntity) o; ClientIdentityProviderMappingEntity key = (ClientIdentityProviderMappingEntity) o;
@ -135,4 +136,6 @@ public class ClientIdentityProviderMappingEntity {
result = 31 * result + (identityProvider != null ? identityProvider.hashCode() : 0); result = 31 * result + (identityProvider != null ? identityProvider.hashCode() : 0);
return result; return result;
} }
} }

View file

@ -221,4 +221,23 @@ public class ClientTemplateEntity {
public void setBearerOnly(boolean bearerOnly) { public void setBearerOnly(boolean bearerOnly) {
this.bearerOnly = bearerOnly; this.bearerOnly = bearerOnly;
} }
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null) return false;
if (!(o instanceof ClientTemplateEntity)) return false;
ClientTemplateEntity that = (ClientTemplateEntity) o;
if (!id.equals(that.getId())) return false;
return true;
}
@Override
public int hashCode() {
return id.hashCode();
}
} }

View file

@ -167,4 +167,23 @@ public class CredentialEntity {
public void setPeriod(int period) { public void setPeriod(int period) {
this.period = period; this.period = period;
} }
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null) return false;
if (!(o instanceof CredentialEntity)) return false;
CredentialEntity that = (CredentialEntity) o;
if (!id.equals(that.getId())) return false;
return true;
}
@Override
public int hashCode() {
return id.hashCode();
}
} }

View file

@ -157,4 +157,27 @@ public class FederatedIdentityEntity {
} }
} }
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null) return false;
if (!(o instanceof FederatedIdentityEntity)) return false;
FederatedIdentityEntity key = (FederatedIdentityEntity) o;
if (identityProvider != null ? !identityProvider.equals(key.identityProvider) : key.identityProvider != null)
return false;
if (user != null ? !user.getId().equals(key.user != null ? key.user.getId() : null) : key.user != null) return false;
return true;
}
@Override
public int hashCode() {
int result = user != null ? user.getId().hashCode() : 0;
result = 31 * result + (identityProvider != null ? identityProvider.hashCode() : 0);
return result;
}
} }

View file

@ -84,4 +84,23 @@ public class GroupAttributeEntity {
public void setGroup(GroupEntity group) { public void setGroup(GroupEntity group) {
this.group = group; this.group = group;
} }
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null) return false;
if (!(o instanceof GroupAttributeEntity)) return false;
GroupAttributeEntity that = (GroupAttributeEntity) o;
if (!id.equals(that.getId())) return false;
return true;
}
@Override
public int hashCode() {
return id.hashCode();
}
} }

View file

@ -107,6 +107,7 @@ public class GroupEntity {
public boolean equals(Object o) { public boolean equals(Object o) {
if (this == o) return true; if (this == o) return true;
if (o == null) return false; if (o == null) return false;
if (!(o instanceof GroupEntity)) return false;
GroupEntity that = (GroupEntity) o; GroupEntity that = (GroupEntity) o;

View file

@ -114,4 +114,26 @@ public class GroupRoleMappingEntity {
return result; return result;
} }
} }
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null) return false;
if (!(o instanceof GroupRoleMappingEntity)) return false;
GroupRoleMappingEntity key = (GroupRoleMappingEntity) o;
if (!roleId.equals(key.roleId)) return false;
if (!group.equals(key.group)) return false;
return true;
}
@Override
public int hashCode() {
int result = group.hashCode();
result = 31 * result + roleId.hashCode();
return result;
}
} }

View file

@ -178,4 +178,23 @@ public class IdentityProviderEntity {
public void setTrustEmail(boolean trustEmail) { public void setTrustEmail(boolean trustEmail) {
this.trustEmail = trustEmail; this.trustEmail = trustEmail;
} }
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null) return false;
if (!(o instanceof IdentityProviderEntity)) return false;
IdentityProviderEntity that = (IdentityProviderEntity) o;
if (!internalId.equals(that.internalId)) return false;
return true;
}
@Override
public int hashCode() {
return internalId.hashCode();
}
} }

View file

@ -110,7 +110,8 @@ public class IdentityProviderMapperEntity {
@Override @Override
public boolean equals(Object o) { public boolean equals(Object o) {
if (this == o) return true; if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false; if (o == null) return false;
if (!(o instanceof IdentityProviderMapperEntity)) return false;
IdentityProviderMapperEntity that = (IdentityProviderMapperEntity) o; IdentityProviderMapperEntity that = (IdentityProviderMapperEntity) o;

View file

@ -57,4 +57,23 @@ public class MigrationModelEntity {
public void setVersion(String version) { public void setVersion(String version) {
this.version = version; this.version = version;
} }
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null) return false;
if (!(o instanceof MigrationModelEntity)) return false;
MigrationModelEntity that = (MigrationModelEntity) o;
if (!id.equals(that.id)) return false;
return true;
}
@Override
public int hashCode() {
return id.hashCode();
}
} }

View file

@ -142,7 +142,8 @@ public class ProtocolMapperEntity {
@Override @Override
public boolean equals(Object o) { public boolean equals(Object o) {
if (this == o) return true; if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false; if (o == null) return false;
if (!(o instanceof ProtocolMapperEntity)) return false;
ProtocolMapperEntity that = (ProtocolMapperEntity) o; ProtocolMapperEntity that = (ProtocolMapperEntity) o;

View file

@ -119,4 +119,26 @@ public class RealmAttributeEntity {
} }
} }
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null) return false;
if (!(o instanceof RealmAttributeEntity)) return false;
RealmAttributeEntity key = (RealmAttributeEntity) o;
if (name != null ? !name.equals(key.name) : key.name != null) return false;
if (realm != null ? !realm.getId().equals(key.realm != null ? key.realm.getId() : null) : key.realm != null) return false;
return true;
}
@Override
public int hashCode() {
int result = realm != null ? realm.getId().hashCode() : 0;
result = 31 * result + (name != null ? name.hashCode() : 0);
return result;
}
} }

View file

@ -769,5 +769,24 @@ public class RealmEntity {
public void setClientTemplates(Collection<ClientTemplateEntity> clientTemplates) { public void setClientTemplates(Collection<ClientTemplateEntity> clientTemplates) {
this.clientTemplates = clientTemplates; this.clientTemplates = clientTemplates;
} }
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null) return false;
if (!(o instanceof RealmEntity)) return false;
RealmEntity that = (RealmEntity) o;
if (!id.equals(that.getId())) return false;
return true;
}
@Override
public int hashCode() {
return id.hashCode();
}
} }

View file

@ -132,4 +132,23 @@ public class RequiredActionProviderEntity {
public void setName(String name) { public void setName(String name) {
this.name = name; this.name = name;
} }
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null) return false;
if (!(o instanceof RequiredActionProviderEntity)) return false;
RequiredActionProviderEntity that = (RequiredActionProviderEntity) o;
if (!id.equals(that.getId())) return false;
return true;
}
@Override
public int hashCode() {
return id.hashCode();
}
} }

View file

@ -134,4 +134,26 @@ public class RequiredCredentialEntity {
} }
} }
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null) return false;
if (!(o instanceof RequiredCredentialEntity)) return false;
RequiredCredentialEntity key = (RequiredCredentialEntity) o;
if (realm != null ? !realm.getId().equals(key.realm != null ? key.realm.getId() : null) : key.realm != null) return false;
if (type != null ? !type.equals(key.type) : key.type != null) return false;
return true;
}
@Override
public int hashCode() {
int result = realm != null ? realm.getId().hashCode() : 0;
result = 31 * result + (type != null ? type.hashCode() : 0);
return result;
}
} }

View file

@ -167,6 +167,7 @@ public class RoleEntity {
@Override @Override
public boolean equals(Object o) { public boolean equals(Object o) {
if (this == o) return true; if (this == o) return true;
if (o == null) return false;
if (!(o instanceof RoleEntity)) return false; if (!(o instanceof RoleEntity)) return false;
RoleEntity that = (RoleEntity) o; RoleEntity that = (RoleEntity) o;

View file

@ -113,4 +113,26 @@ public class ScopeMappingEntity {
} }
} }
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null) return false;
if (!(o instanceof ScopeMappingEntity)) return false;
ScopeMappingEntity key = (ScopeMappingEntity) o;
if (client != null ? !client.getId().equals(key.client != null ? key.client.getId() : null) : key.client != null) return false;
if (role != null ? !role.getId().equals(key.role != null ? key.role.getId() : null) : key.role != null) return false;
return true;
}
@Override
public int hashCode() {
int result = client != null ? client.getId().hashCode() : 0;
result = 31 * result + (role != null ? role.getId().hashCode() : 0);
return result;
}
} }

View file

@ -113,4 +113,26 @@ public class TemplateScopeMappingEntity {
} }
} }
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
if (!(o instanceof TemplateScopeMappingEntity)) return false;
TemplateScopeMappingEntity key = (TemplateScopeMappingEntity) o;
if (template != null ? !template.getId().equals(key.template != null ? key.template.getId() : null) : key.template != null) return false;
if (role != null ? !role.getId().equals(key.role != null ? key.role.getId() : null) : key.role != null) return false;
return true;
}
@Override
public int hashCode() {
int result = template != null ? template.getId().hashCode() : 0;
result = 31 * result + (role != null ? role.getId().hashCode() : 0);
return result;
}
} }

View file

@ -91,4 +91,23 @@ public class UserAttributeEntity {
this.user = user; this.user = user;
} }
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null) return false;
if (!(o instanceof UserAttributeEntity)) return false;
UserAttributeEntity that = (UserAttributeEntity) o;
if (!id.equals(that.getId())) return false;
return true;
}
@Override
public int hashCode() {
return id.hashCode();
}
} }

View file

@ -105,4 +105,23 @@ public class UserConsentEntity {
public void setGrantedProtocolMappers(Collection<UserConsentProtocolMapperEntity> grantedProtocolMappers) { public void setGrantedProtocolMappers(Collection<UserConsentProtocolMapperEntity> grantedProtocolMappers) {
this.grantedProtocolMappers = grantedProtocolMappers; this.grantedProtocolMappers = grantedProtocolMappers;
} }
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null) return false;
if (!(o instanceof UserConsentEntity)) return false;
UserConsentEntity that = (UserConsentEntity) o;
if (!id.equals(that.getId())) return false;
return true;
}
@Override
public int hashCode() {
return id.hashCode();
}
} }

View file

@ -73,7 +73,8 @@ public class UserConsentProtocolMapperEntity {
@Override @Override
public boolean equals(Object o) { public boolean equals(Object o) {
if (this == o) return true; if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false; if (o == null) return false;
if (!(o instanceof UserConsentProtocolMapperEntity)) return false;
UserConsentProtocolMapperEntity that = (UserConsentProtocolMapperEntity)o; UserConsentProtocolMapperEntity that = (UserConsentProtocolMapperEntity)o;
Key myKey = new Key(this.userConsent, this.protocolMapperId); Key myKey = new Key(this.userConsent, this.protocolMapperId);
@ -129,4 +130,6 @@ public class UserConsentProtocolMapperEntity {
return result; return result;
} }
} }
} }

View file

@ -72,7 +72,8 @@ public class UserConsentRoleEntity {
@Override @Override
public boolean equals(Object o) { public boolean equals(Object o) {
if (this == o) return true; if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false; if (o == null) return false;
if (!(o instanceof UserConsentRoleEntity)) return false;
UserConsentRoleEntity that = (UserConsentRoleEntity)o; UserConsentRoleEntity that = (UserConsentRoleEntity)o;
Key myKey = new Key(this.userConsent, this.roleId); Key myKey = new Key(this.userConsent, this.roleId);

View file

@ -232,7 +232,8 @@ public class UserEntity {
@Override @Override
public boolean equals(Object o) { public boolean equals(Object o) {
if (this == o) return true; if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false; if (o == null) return false;
if (!(o instanceof UserEntity)) return false;
UserEntity that = (UserEntity) o; UserEntity that = (UserEntity) o;

View file

@ -114,7 +114,8 @@ public class UserFederationMapperEntity {
@Override @Override
public boolean equals(Object o) { public boolean equals(Object o) {
if (this == o) return true; if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false; if (o == null ) return false;
if (!(o instanceof UserFederationMapperEntity)) return false;
UserFederationMapperEntity that = (UserFederationMapperEntity) o; UserFederationMapperEntity that = (UserFederationMapperEntity) o;

View file

@ -137,4 +137,23 @@ public class UserFederationProviderEntity {
public void setLastSync(int lastSync) { public void setLastSync(int lastSync) {
this.lastSync = lastSync; this.lastSync = lastSync;
} }
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null) return false;
if (!(o instanceof UserFederationProviderEntity)) return false;
UserFederationProviderEntity that = (UserFederationProviderEntity) o;
if (!id.equals(that.getId())) return false;
return true;
}
@Override
public int hashCode() {
return id.hashCode();
}
} }

View file

@ -116,4 +116,26 @@ public class UserGroupMembershipEntity {
return result; return result;
} }
} }
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null) return false;
if (!(o instanceof UserGroupMembershipEntity)) return false;
UserGroupMembershipEntity key = (UserGroupMembershipEntity) o;
if (!groupId.equals(key.groupId)) return false;
if (!user.equals(key.user)) return false;
return true;
}
@Override
public int hashCode() {
int result = user.hashCode();
result = 31 * result + groupId.hashCode();
return result;
}
} }

View file

@ -110,4 +110,26 @@ public class UserRequiredActionEntity {
} }
} }
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null) return false;
if (!(o instanceof UserRequiredActionEntity)) return false;
UserRequiredActionEntity key = (UserRequiredActionEntity) o;
if (action != key.action) return false;
if (user != null ? !user.getId().equals(key.user != null ? key.user.getId() : null) : key.user != null) return false;
return true;
}
@Override
public int hashCode() {
int result = user != null ? user.getId().hashCode() : 0;
result = 31 * result + (action != null ? action.hashCode() : 0);
return result;
}
} }

View file

@ -117,4 +117,26 @@ public class UserRoleMappingEntity {
return result; return result;
} }
} }
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null) return false;
if (!(o instanceof UserRoleMappingEntity)) return false;
UserRoleMappingEntity key = (UserRoleMappingEntity) o;
if (!roleId.equals(key.roleId)) return false;
if (!user.equals(key.user)) return false;
return true;
}
@Override
public int hashCode() {
int result = user.hashCode();
result = 31 * result + roleId.hashCode();
return result;
}
} }

View file

@ -24,7 +24,7 @@ package org.keycloak.models.entities;
*/ */
public class AbstractIdentifiableEntity { public class AbstractIdentifiableEntity {
private String id; protected String id;
public String getId() { public String getId() {
return id; return id;

View file

@ -24,24 +24,15 @@ import org.keycloak.models.AuthenticationExecutionModel;
* @author <a href="mailto:bill@burkecentral.com">Bill Burke</a> * @author <a href="mailto:bill@burkecentral.com">Bill Burke</a>
* @version $Revision: 1 $ * @version $Revision: 1 $
*/ */
public class AuthenticationExecutionEntity { public class AuthenticationExecutionEntity extends AbstractIdentifiableEntity {
protected String id;
protected String authenticator; protected String authenticator;
private String authenticatorConfig; protected String authenticatorConfig;
protected String flowId; protected String flowId;
protected AuthenticationExecutionModel.Requirement requirement; protected AuthenticationExecutionModel.Requirement requirement;
protected int priority; protected int priority;
private boolean userSetupAllowed; protected boolean userSetupAllowed;
private boolean authenticatorFlow; protected boolean authenticatorFlow;
private String parentFlow; protected String parentFlow;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getAuthenticator() { public String getAuthenticator() {
return authenticator; return authenticator;

View file

@ -24,23 +24,14 @@ import java.util.List;
* @author <a href="mailto:bill@burkecentral.com">Bill Burke</a> * @author <a href="mailto:bill@burkecentral.com">Bill Burke</a>
* @version $Revision: 1 $ * @version $Revision: 1 $
*/ */
public class AuthenticationFlowEntity { public class AuthenticationFlowEntity extends AbstractIdentifiableEntity {
protected String id;
protected String alias; protected String alias;
protected String description; protected String description;
protected String providerId; protected String providerId;
private boolean topLevel; protected boolean topLevel;
private boolean builtIn; protected boolean builtIn;
List<AuthenticationExecutionEntity> executions = new ArrayList<AuthenticationExecutionEntity>(); List<AuthenticationExecutionEntity> executions = new ArrayList<AuthenticationExecutionEntity>();
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getAlias() { public String getAlias() {
return alias; return alias;
} }

View file

@ -23,18 +23,9 @@ import java.util.Map;
* @author <a href="mailto:bill@burkecentral.com">Bill Burke</a> * @author <a href="mailto:bill@burkecentral.com">Bill Burke</a>
* @version $Revision: 1 $ * @version $Revision: 1 $
*/ */
public class AuthenticatorConfigEntity { public class AuthenticatorConfigEntity extends AbstractIdentifiableEntity{
protected String id;
protected String alias; protected String alias;
private Map<String, String> config; protected Map<String, String> config;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getAlias() { public String getAlias() {
return alias; return alias;

View file

@ -27,48 +27,48 @@ import java.util.Map;
*/ */
public class ClientEntity extends AbstractIdentifiableEntity { public class ClientEntity extends AbstractIdentifiableEntity {
private String clientId; protected String clientId;
private String name; protected String name;
private String description; protected String description;
private String realmId; protected String realmId;
private boolean enabled; protected boolean enabled;
private String clientAuthenticatorType; protected String clientAuthenticatorType;
private String secret; protected String secret;
private String registrationToken; protected String registrationToken;
private String protocol; protected String protocol;
private int notBefore; protected int notBefore;
private boolean publicClient; protected boolean publicClient;
private boolean fullScopeAllowed; protected boolean fullScopeAllowed;
private boolean frontchannelLogout; protected boolean frontchannelLogout;
private boolean surrogateAuthRequired; protected boolean surrogateAuthRequired;
private String managementUrl; protected String managementUrl;
private String rootUrl; protected String rootUrl;
private String baseUrl; protected String baseUrl;
private boolean bearerOnly; protected boolean bearerOnly;
private boolean consentRequired; protected boolean consentRequired;
private boolean standardFlowEnabled; protected boolean standardFlowEnabled;
private boolean implicitFlowEnabled; protected boolean implicitFlowEnabled;
private boolean directAccessGrantsEnabled; protected boolean directAccessGrantsEnabled;
private boolean serviceAccountsEnabled; protected boolean serviceAccountsEnabled;
private int nodeReRegistrationTimeout; protected int nodeReRegistrationTimeout;
// We are using names of defaultRoles (not ids) // We are using names of defaultRoles (not ids)
private List<String> defaultRoles = new ArrayList<String>(); protected List<String> defaultRoles = new ArrayList<String>();
private Map<String, Integer> registeredNodes; protected Map<String, Integer> registeredNodes;
private Map<String, String> attributes = new HashMap<String, String>(); protected Map<String, String> attributes = new HashMap<String, String>();
private List<String> webOrigins = new ArrayList<String>(); protected List<String> webOrigins = new ArrayList<String>();
private List<String> redirectUris = new ArrayList<String>(); protected List<String> redirectUris = new ArrayList<String>();
private List<String> scopeIds = new ArrayList<String>(); protected List<String> scopeIds = new ArrayList<String>();
private List<ClientIdentityProviderMappingEntity> identityProviders = new ArrayList<ClientIdentityProviderMappingEntity>(); protected List<ClientIdentityProviderMappingEntity> identityProviders = new ArrayList<ClientIdentityProviderMappingEntity>();
private List<ProtocolMapperEntity> protocolMappers = new ArrayList<ProtocolMapperEntity>(); protected List<ProtocolMapperEntity> protocolMappers = new ArrayList<ProtocolMapperEntity>();
private String clientTemplate; protected String clientTemplate;
private boolean useTemplateConfig; protected boolean useTemplateConfig;
private boolean useTemplateScope; protected boolean useTemplateScope;
private boolean useTemplateMappers; protected boolean useTemplateMappers;
public String getClientId() { public String getClientId() {
return clientId; return clientId;

View file

@ -19,18 +19,9 @@ package org.keycloak.models.entities;
/** /**
* @author pedroigor * @author pedroigor
*/ */
public class ClientIdentityProviderMappingEntity { public class ClientIdentityProviderMappingEntity extends AbstractIdentifiableEntity {
private String id; protected boolean retrieveToken;
private boolean retrieveToken;
public String getId() {
return this.id;
}
public void setId(String id) {
this.id = id;
}
public boolean isRetrieveToken() { public boolean isRetrieveToken() {
return this.retrieveToken; return this.retrieveToken;

View file

@ -27,22 +27,22 @@ import java.util.Map;
*/ */
public class ClientTemplateEntity extends AbstractIdentifiableEntity { public class ClientTemplateEntity extends AbstractIdentifiableEntity {
private String name; protected String name;
private String description; protected String description;
private String realmId; protected String realmId;
private String protocol; protected String protocol;
private boolean fullScopeAllowed; protected boolean fullScopeAllowed;
private boolean bearerOnly; protected boolean bearerOnly;
private boolean consentRequired; protected boolean consentRequired;
private boolean standardFlowEnabled; protected boolean standardFlowEnabled;
private boolean implicitFlowEnabled; protected boolean implicitFlowEnabled;
private boolean directAccessGrantsEnabled; protected boolean directAccessGrantsEnabled;
private boolean serviceAccountsEnabled; protected boolean serviceAccountsEnabled;
private boolean publicClient; protected boolean publicClient;
private boolean frontchannelLogout; protected boolean frontchannelLogout;
private List<String> scopeIds = new ArrayList<>(); protected List<String> scopeIds = new ArrayList<>();
private List<ProtocolMapperEntity> protocolMappers = new ArrayList<>(); protected List<ProtocolMapperEntity> protocolMappers = new ArrayList<>();
private Map<String, String> attributes = new HashMap<>(); protected Map<String, String> attributes = new HashMap<>();
public String getName() { public String getName() {
return name; return name;

View file

@ -20,30 +20,21 @@ package org.keycloak.models.entities;
/** /**
* @author <a href="mailto:mposolda@redhat.com">Marek Posolda</a> * @author <a href="mailto:mposolda@redhat.com">Marek Posolda</a>
*/ */
public class CredentialEntity { public class CredentialEntity extends AbstractIdentifiableEntity {
private String id; protected String type;
private String type; protected String value;
private String value; protected String device;
private String device; protected byte[] salt;
private byte[] salt; protected int hashIterations;
private int hashIterations; protected Long createdDate;
private Long createdDate; protected UserEntity user;
private UserEntity user; protected int counter;
private int counter; protected String algorithm;
private String algorithm; protected int digits;
private int digits; protected int period;
private int period;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getType() { public String getType() {
return type; return type;
} }

View file

@ -133,4 +133,21 @@ public class IdentityProviderEntity {
public void setTrustEmail(boolean trustEmail) { public void setTrustEmail(boolean trustEmail) {
this.trustEmail = trustEmail; this.trustEmail = trustEmail;
} }
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof IdentityProviderEntity)) return false;
IdentityProviderEntity that = (IdentityProviderEntity) o;
if (!internalId.equals(that.internalId)) return false;
return true;
}
@Override
public int hashCode() {
return internalId.hashCode();
}
} }

View file

@ -23,21 +23,12 @@ import java.util.Map;
* @author <a href="mailto:bill@burkecentral.com">Bill Burke</a> * @author <a href="mailto:bill@burkecentral.com">Bill Burke</a>
* @version $Revision: 1 $ * @version $Revision: 1 $
*/ */
public class IdentityProviderMapperEntity { public class IdentityProviderMapperEntity extends AbstractIdentifiableEntity {
protected String id;
protected String name; protected String name;
protected String identityProviderAlias; protected String identityProviderAlias;
protected String identityProviderMapper; protected String identityProviderMapper;
protected Map<String, String> config; protected Map<String, String> config;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getName() { public String getName() {
return name; return name;
} }

View file

@ -22,23 +22,14 @@ import java.util.List;
/** /**
* @author <a href="mailto:mposolda@redhat.com">Marek Posolda</a> * @author <a href="mailto:mposolda@redhat.com">Marek Posolda</a>
*/ */
public class PersistentUserSessionEntity { public class PersistentUserSessionEntity extends AbstractIdentifiableEntity {
private String id;
private String realmId; private String realmId;
private String userId; private String userId;
private int lastSessionRefresh; private int lastSessionRefresh;
private String data; private String data;
private List<PersistentClientSessionEntity> clientSessions; private List<PersistentClientSessionEntity> clientSessions;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getRealmId() { public String getRealmId() {
return realmId; return realmId;
} }

View file

@ -23,8 +23,7 @@ import java.util.Map;
* @author <a href="mailto:bill@burkecentral.com">Bill Burke</a> * @author <a href="mailto:bill@burkecentral.com">Bill Burke</a>
* @version $Revision: 1 $ * @version $Revision: 1 $
*/ */
public class ProtocolMapperEntity { public class ProtocolMapperEntity extends AbstractIdentifiableEntity {
protected String id;
protected String name; protected String name;
protected String protocol; protected String protocol;
protected String protocolMapper; protected String protocolMapper;
@ -32,14 +31,6 @@ public class ProtocolMapperEntity {
protected String consentText; protected String consentText;
protected Map<String, String> config; protected Map<String, String> config;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getName() { public String getName() {
return name; return name;
} }

View file

@ -23,8 +23,7 @@ import java.util.Map;
* @author <a href="mailto:bill@burkecentral.com">Bill Burke</a> * @author <a href="mailto:bill@burkecentral.com">Bill Burke</a>
* @version $Revision: 1 $ * @version $Revision: 1 $
*/ */
public class RequiredActionProviderEntity { public class RequiredActionProviderEntity extends AbstractIdentifiableEntity {
protected String id;
protected String alias; protected String alias;
protected String name; protected String name;
protected String providerId; protected String providerId;
@ -32,14 +31,6 @@ public class RequiredActionProviderEntity {
protected boolean defaultAction; protected boolean defaultAction;
private Map<String, String> config; private Map<String, String> config;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getAlias() { public String getAlias() {
return alias; return alias;
} }

View file

@ -22,22 +22,13 @@ import java.util.Map;
/** /**
* @author <a href="mailto:mposolda@redhat.com">Marek Posolda</a> * @author <a href="mailto:mposolda@redhat.com">Marek Posolda</a>
*/ */
public class UserFederationMapperEntity { public class UserFederationMapperEntity extends AbstractIdentifiableEntity {
protected String id;
protected String name; protected String name;
protected String federationProviderId; protected String federationProviderId;
protected String federationMapperType; protected String federationMapperType;
protected Map<String, String> config; protected Map<String, String> config;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getName() { public String getName() {
return name; return name;
} }

View file

@ -23,8 +23,7 @@ import java.util.Map;
* @author <a href="mailto:bill@burkecentral.com">Bill Burke</a> * @author <a href="mailto:bill@burkecentral.com">Bill Burke</a>
* @version $Revision: 1 $ * @version $Revision: 1 $
*/ */
public class UserFederationProviderEntity { public class UserFederationProviderEntity extends AbstractIdentifiableEntity {
protected String id;
protected String providerName; protected String providerName;
protected Map<String, String> config; protected Map<String, String> config;
protected int priority; protected int priority;
@ -34,14 +33,6 @@ public class UserFederationProviderEntity {
private int lastSync; private int lastSync;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getProviderName() { public String getProviderName() {
return providerName; return providerName;
} }