KEYCLOAK-302 Ensure that all tables and columns have maximum length 30 characters
This commit is contained in:
parent
97f1bbe1a3
commit
02db44cd96
8 changed files with 25 additions and 38 deletions
|
@ -1,6 +1,5 @@
|
||||||
package org.keycloak.models.jpa;
|
package org.keycloak.models.jpa;
|
||||||
|
|
||||||
import org.bouncycastle.openssl.PEMWriter;
|
|
||||||
import org.keycloak.models.RoleContainerModel;
|
import org.keycloak.models.RoleContainerModel;
|
||||||
import org.keycloak.models.jpa.entities.ApplicationEntity;
|
import org.keycloak.models.jpa.entities.ApplicationEntity;
|
||||||
import org.keycloak.models.jpa.entities.CredentialEntity;
|
import org.keycloak.models.jpa.entities.CredentialEntity;
|
||||||
|
@ -15,7 +14,6 @@ import org.keycloak.models.jpa.entities.UserRoleMappingEntity;
|
||||||
import org.keycloak.models.jpa.entities.UserScopeMappingEntity;
|
import org.keycloak.models.jpa.entities.UserScopeMappingEntity;
|
||||||
import org.keycloak.models.utils.KeycloakModelUtils;
|
import org.keycloak.models.utils.KeycloakModelUtils;
|
||||||
import org.keycloak.models.utils.Pbkdf2PasswordEncoder;
|
import org.keycloak.models.utils.Pbkdf2PasswordEncoder;
|
||||||
import org.keycloak.util.PemUtils;
|
|
||||||
import org.keycloak.models.ApplicationModel;
|
import org.keycloak.models.ApplicationModel;
|
||||||
import org.keycloak.models.OAuthClientModel;
|
import org.keycloak.models.OAuthClientModel;
|
||||||
import org.keycloak.models.PasswordPolicy;
|
import org.keycloak.models.PasswordPolicy;
|
||||||
|
@ -29,8 +27,7 @@ import org.keycloak.models.utils.TimeBasedOTP;
|
||||||
|
|
||||||
import javax.persistence.EntityManager;
|
import javax.persistence.EntityManager;
|
||||||
import javax.persistence.TypedQuery;
|
import javax.persistence.TypedQuery;
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.StringWriter;
|
|
||||||
import java.security.PrivateKey;
|
import java.security.PrivateKey;
|
||||||
import java.security.PublicKey;
|
import java.security.PublicKey;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -285,7 +282,7 @@ public class RealmAdapter implements RealmModel {
|
||||||
@Override
|
@Override
|
||||||
public List<RequiredCredentialModel> getRequiredApplicationCredentials() {
|
public List<RequiredCredentialModel> getRequiredApplicationCredentials() {
|
||||||
List<RequiredCredentialModel> requiredCredentialModels = new ArrayList<RequiredCredentialModel>();
|
List<RequiredCredentialModel> requiredCredentialModels = new ArrayList<RequiredCredentialModel>();
|
||||||
Collection<RequiredCredentialEntity> entities = realm.getRequiredApplicationCredentials();
|
Collection<RequiredCredentialEntity> entities = realm.getRequiredAppCredentials();
|
||||||
if (entities == null) return requiredCredentialModels;
|
if (entities == null) return requiredCredentialModels;
|
||||||
for (RequiredCredentialEntity entity : entities) {
|
for (RequiredCredentialEntity entity : entities) {
|
||||||
RequiredCredentialModel model = new RequiredCredentialModel();
|
RequiredCredentialModel model = new RequiredCredentialModel();
|
||||||
|
@ -301,7 +298,7 @@ public class RealmAdapter implements RealmModel {
|
||||||
@Override
|
@Override
|
||||||
public List<RequiredCredentialModel> getRequiredOAuthClientCredentials() {
|
public List<RequiredCredentialModel> getRequiredOAuthClientCredentials() {
|
||||||
List<RequiredCredentialModel> requiredCredentialModels = new ArrayList<RequiredCredentialModel>();
|
List<RequiredCredentialModel> requiredCredentialModels = new ArrayList<RequiredCredentialModel>();
|
||||||
Collection<RequiredCredentialEntity> entities = realm.getRequiredOAuthClientCredentials();
|
Collection<RequiredCredentialEntity> entities = realm.getRequiredOAuthClCredentials();
|
||||||
if (entities == null) return requiredCredentialModels;
|
if (entities == null) return requiredCredentialModels;
|
||||||
for (RequiredCredentialEntity entity : entities) {
|
for (RequiredCredentialEntity entity : entities) {
|
||||||
RequiredCredentialModel model = new RequiredCredentialModel();
|
RequiredCredentialModel model = new RequiredCredentialModel();
|
||||||
|
@ -321,7 +318,7 @@ public class RealmAdapter implements RealmModel {
|
||||||
entity.setType(model.getType());
|
entity.setType(model.getType());
|
||||||
entity.setFormLabel(model.getFormLabel());
|
entity.setFormLabel(model.getFormLabel());
|
||||||
em.persist(entity);
|
em.persist(entity);
|
||||||
realm.getRequiredOAuthClientCredentials().add(entity);
|
realm.getRequiredOAuthClCredentials().add(entity);
|
||||||
em.flush();
|
em.flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -339,7 +336,7 @@ public class RealmAdapter implements RealmModel {
|
||||||
entity.setType(model.getType());
|
entity.setType(model.getType());
|
||||||
entity.setFormLabel(model.getFormLabel());
|
entity.setFormLabel(model.getFormLabel());
|
||||||
em.persist(entity);
|
em.persist(entity);
|
||||||
realm.getRequiredApplicationCredentials().add(entity);
|
realm.getRequiredAppCredentials().add(entity);
|
||||||
em.flush();
|
em.flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -352,7 +349,7 @@ public class RealmAdapter implements RealmModel {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateRequiredOAuthClientCredentials(Set<String> creds) {
|
public void updateRequiredOAuthClientCredentials(Set<String> creds) {
|
||||||
Collection<RequiredCredentialEntity> relationships = realm.getRequiredOAuthClientCredentials();
|
Collection<RequiredCredentialEntity> relationships = realm.getRequiredOAuthClCredentials();
|
||||||
if (relationships == null) relationships = new ArrayList<RequiredCredentialEntity>();
|
if (relationships == null) relationships = new ArrayList<RequiredCredentialEntity>();
|
||||||
|
|
||||||
Set<String> already = new HashSet<String>();
|
Set<String> already = new HashSet<String>();
|
||||||
|
@ -378,7 +375,7 @@ public class RealmAdapter implements RealmModel {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateRequiredApplicationCredentials(Set<String> creds) {
|
public void updateRequiredApplicationCredentials(Set<String> creds) {
|
||||||
Collection<RequiredCredentialEntity> relationships = realm.getRequiredApplicationCredentials();
|
Collection<RequiredCredentialEntity> relationships = realm.getRequiredAppCredentials();
|
||||||
if (relationships == null) relationships = new ArrayList<RequiredCredentialEntity>();
|
if (relationships == null) relationships = new ArrayList<RequiredCredentialEntity>();
|
||||||
|
|
||||||
Set<String> already = new HashSet<String>();
|
Set<String> already = new HashSet<String>();
|
||||||
|
|
|
@ -37,7 +37,7 @@ public class ApplicationEntity {
|
||||||
Collection<ApplicationRoleEntity> roles = new ArrayList<ApplicationRoleEntity>();
|
Collection<ApplicationRoleEntity> roles = new ArrayList<ApplicationRoleEntity>();
|
||||||
|
|
||||||
@OneToMany(fetch = FetchType.LAZY, cascade ={CascadeType.REMOVE}, orphanRemoval = true)
|
@OneToMany(fetch = FetchType.LAZY, cascade ={CascadeType.REMOVE}, orphanRemoval = true)
|
||||||
@JoinTable(name="APPLICATION_DEFAULT_ROLES")
|
@JoinTable(name="ApplicationDefaultRoles")
|
||||||
Collection<RoleEntity> defaultRoles = new ArrayList<RoleEntity>();
|
Collection<RoleEntity> defaultRoles = new ArrayList<RoleEntity>();
|
||||||
|
|
||||||
public String getId() {
|
public String getId() {
|
||||||
|
|
|
@ -16,7 +16,7 @@ import javax.persistence.NamedQuery;
|
||||||
@Entity
|
@Entity
|
||||||
public class ApplicationRoleEntity extends RoleEntity {
|
public class ApplicationRoleEntity extends RoleEntity {
|
||||||
@ManyToOne
|
@ManyToOne
|
||||||
@JoinTable(name = "APPLICATION_ROLE")
|
@JoinTable(name = "ApplicationRole")
|
||||||
private ApplicationEntity application;
|
private ApplicationEntity application;
|
||||||
|
|
||||||
public ApplicationEntity getApplication() {
|
public ApplicationEntity getApplication() {
|
||||||
|
|
|
@ -38,6 +38,8 @@ public class RealmEntity {
|
||||||
protected boolean verifyEmail;
|
protected boolean verifyEmail;
|
||||||
protected boolean resetPasswordAllowed;
|
protected boolean resetPasswordAllowed;
|
||||||
protected boolean social;
|
protected boolean social;
|
||||||
|
|
||||||
|
@Column(name="updateProfileOnInitSocLogin")
|
||||||
protected boolean updateProfileOnInitialSocialLogin;
|
protected boolean updateProfileOnInitialSocialLogin;
|
||||||
protected String passwordPolicy;
|
protected String passwordPolicy;
|
||||||
|
|
||||||
|
@ -54,16 +56,16 @@ public class RealmEntity {
|
||||||
protected String accountTheme;
|
protected String accountTheme;
|
||||||
|
|
||||||
@OneToMany(cascade ={CascadeType.REMOVE}, orphanRemoval = true)
|
@OneToMany(cascade ={CascadeType.REMOVE}, orphanRemoval = true)
|
||||||
@JoinTable(name="USER_REQUIRED_CREDENTIALS")
|
@JoinTable(name="User_RequiredCreds")
|
||||||
Collection<RequiredCredentialEntity> requiredCredentials = new ArrayList<RequiredCredentialEntity>();
|
Collection<RequiredCredentialEntity> requiredCredentials = new ArrayList<RequiredCredentialEntity>();
|
||||||
|
|
||||||
@OneToMany(cascade ={CascadeType.REMOVE}, orphanRemoval = true)
|
@OneToMany(cascade ={CascadeType.REMOVE}, orphanRemoval = true)
|
||||||
@JoinTable(name="APPLICATION_REQUIRED_CREDENTIALS")
|
@JoinTable(name="App_RequiredCreds")
|
||||||
Collection<RequiredCredentialEntity> requiredApplicationCredentials = new ArrayList<RequiredCredentialEntity>();
|
Collection<RequiredCredentialEntity> requiredAppCredentials = new ArrayList<RequiredCredentialEntity>();
|
||||||
|
|
||||||
@OneToMany(cascade ={CascadeType.REMOVE}, orphanRemoval = true)
|
@OneToMany(cascade ={CascadeType.REMOVE}, orphanRemoval = true)
|
||||||
@JoinTable(name="OAUTH_CLIENT_REQUIRED_CREDENTIALS")
|
@JoinTable(name="OAuthClient_RequiredCreds")
|
||||||
Collection<RequiredCredentialEntity> requiredOAuthClientCredentials = new ArrayList<RequiredCredentialEntity>();
|
Collection<RequiredCredentialEntity> requiredOAuthClCredentials = new ArrayList<RequiredCredentialEntity>();
|
||||||
|
|
||||||
@OneToMany(cascade ={CascadeType.REMOVE}, orphanRemoval = true)
|
@OneToMany(cascade ={CascadeType.REMOVE}, orphanRemoval = true)
|
||||||
Collection<ApplicationEntity> applications = new ArrayList<ApplicationEntity>();
|
Collection<ApplicationEntity> applications = new ArrayList<ApplicationEntity>();
|
||||||
|
@ -84,7 +86,7 @@ public class RealmEntity {
|
||||||
protected Map<String, String> socialConfig = new HashMap<String, String>();
|
protected Map<String, String> socialConfig = new HashMap<String, String>();
|
||||||
|
|
||||||
@OneToMany(fetch = FetchType.LAZY, cascade ={CascadeType.REMOVE}, orphanRemoval = true)
|
@OneToMany(fetch = FetchType.LAZY, cascade ={CascadeType.REMOVE}, orphanRemoval = true)
|
||||||
@JoinTable(name="REALM_DEFAULT_ROLES")
|
@JoinTable(name="RealmDefaultRoles")
|
||||||
Collection<RoleEntity> defaultRoles = new ArrayList<RoleEntity>();
|
Collection<RoleEntity> defaultRoles = new ArrayList<RoleEntity>();
|
||||||
|
|
||||||
public String getId() {
|
public String getId() {
|
||||||
|
@ -207,20 +209,20 @@ public class RealmEntity {
|
||||||
this.requiredCredentials = requiredCredentials;
|
this.requiredCredentials = requiredCredentials;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Collection<RequiredCredentialEntity> getRequiredApplicationCredentials() {
|
public Collection<RequiredCredentialEntity> getRequiredAppCredentials() {
|
||||||
return requiredApplicationCredentials;
|
return requiredAppCredentials;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRequiredApplicationCredentials(Collection<RequiredCredentialEntity> requiredApplicationCredentials) {
|
public void setRequiredAppCredentials(Collection<RequiredCredentialEntity> requiredAppCredentials) {
|
||||||
this.requiredApplicationCredentials = requiredApplicationCredentials;
|
this.requiredAppCredentials = requiredAppCredentials;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Collection<RequiredCredentialEntity> getRequiredOAuthClientCredentials() {
|
public Collection<RequiredCredentialEntity> getRequiredOAuthClCredentials() {
|
||||||
return requiredOAuthClientCredentials;
|
return requiredOAuthClCredentials;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRequiredOAuthClientCredentials(Collection<RequiredCredentialEntity> requiredOAuthClientCredentials) {
|
public void setRequiredOAuthClCredentials(Collection<RequiredCredentialEntity> requiredOAuthClCredentials) {
|
||||||
this.requiredOAuthClientCredentials = requiredOAuthClientCredentials;
|
this.requiredOAuthClCredentials = requiredOAuthClCredentials;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Collection<ApplicationEntity> getApplications() {
|
public Collection<ApplicationEntity> getApplications() {
|
||||||
|
|
|
@ -6,9 +6,7 @@ import javax.persistence.GeneratedValue;
|
||||||
import javax.persistence.Id;
|
import javax.persistence.Id;
|
||||||
import javax.persistence.Inheritance;
|
import javax.persistence.Inheritance;
|
||||||
import javax.persistence.InheritanceType;
|
import javax.persistence.InheritanceType;
|
||||||
import javax.persistence.JoinTable;
|
|
||||||
import javax.persistence.ManyToMany;
|
import javax.persistence.ManyToMany;
|
||||||
import javax.persistence.OneToMany;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
|
||||||
|
|
|
@ -2,14 +2,12 @@ package org.keycloak.models.jpa.entities;
|
||||||
|
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
import javax.persistence.GeneratedValue;
|
import javax.persistence.GeneratedValue;
|
||||||
import javax.persistence.GenerationType;
|
|
||||||
import javax.persistence.Id;
|
import javax.persistence.Id;
|
||||||
import javax.persistence.ManyToOne;
|
import javax.persistence.ManyToOne;
|
||||||
import javax.persistence.NamedQueries;
|
import javax.persistence.NamedQueries;
|
||||||
import javax.persistence.NamedQuery;
|
import javax.persistence.NamedQuery;
|
||||||
|
|
||||||
import org.hibernate.annotations.GenericGenerator;
|
import org.hibernate.annotations.GenericGenerator;
|
||||||
import org.keycloak.models.jpa.utils.JpaIdGenerator;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author <a href="mailto:bill@burkecentral.com">Bill Burke</a>
|
* @author <a href="mailto:bill@burkecentral.com">Bill Burke</a>
|
||||||
|
@ -27,8 +25,6 @@ public class SocialLinkEntity {
|
||||||
@GeneratedValue(generator = "keycloak_generator")
|
@GeneratedValue(generator = "keycloak_generator")
|
||||||
private String id;
|
private String id;
|
||||||
|
|
||||||
private String str = JpaIdGenerator.class.getName();
|
|
||||||
|
|
||||||
@ManyToOne
|
@ManyToOne
|
||||||
private UserEntity user;
|
private UserEntity user;
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,6 @@ import javax.persistence.Column;
|
||||||
import javax.persistence.ElementCollection;
|
import javax.persistence.ElementCollection;
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
import javax.persistence.GeneratedValue;
|
import javax.persistence.GeneratedValue;
|
||||||
import javax.persistence.GenerationType;
|
|
||||||
import javax.persistence.Id;
|
import javax.persistence.Id;
|
||||||
import javax.persistence.ManyToOne;
|
import javax.persistence.ManyToOne;
|
||||||
import javax.persistence.MapKeyColumn;
|
import javax.persistence.MapKeyColumn;
|
||||||
|
|
|
@ -1,11 +1,6 @@
|
||||||
package org.keycloak.models.jpa.entities;
|
package org.keycloak.models.jpa.entities;
|
||||||
|
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
import javax.persistence.GeneratedValue;
|
|
||||||
import javax.persistence.GenerationType;
|
|
||||||
import javax.persistence.Id;
|
|
||||||
import javax.persistence.ManyToOne;
|
|
||||||
import javax.persistence.MappedSuperclass;
|
|
||||||
import javax.persistence.NamedQueries;
|
import javax.persistence.NamedQueries;
|
||||||
import javax.persistence.NamedQuery;
|
import javax.persistence.NamedQuery;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue