From 0b0b101184567aa16ba83494c61c3cdbacb3f87d Mon Sep 17 00:00:00 2001 From: Marko Strukelj Date: Wed, 17 Jun 2015 17:55:58 +0200 Subject: [PATCH 1/2] KEYCLOAK-1476 NotSerializableException: org.keycloak.models.cache.entities.CachedClientRole Conflicts: model/api/src/main/java/org/keycloak/models/AuthenticationExecutionModel.java --- core/src/main/java/org/keycloak/enums/SslRequired.java | 2 ++ .../org/keycloak/models/AuthenticationExecutionModel.java | 5 ++++- .../java/org/keycloak/models/AuthenticationFlowModel.java | 6 +++++- .../main/java/org/keycloak/models/AuthenticatorModel.java | 4 +++- .../org/keycloak/models/IdentityProviderMapperModel.java | 5 ++++- .../java/org/keycloak/models/IdentityProviderModel.java | 4 +++- .../src/main/java/org/keycloak/models/PasswordPolicy.java | 6 ++++-- .../main/java/org/keycloak/models/ProtocolMapperModel.java | 5 ++++- .../java/org/keycloak/models/RequiredCredentialModel.java | 5 ++++- .../java/org/keycloak/models/UserFederationMapperModel.java | 4 +++- .../org/keycloak/models/UserFederationProviderModel.java | 4 +++- .../org/keycloak/models/cache/entities/CachedClient.java | 5 ++++- .../keycloak/models/cache/entities/CachedClientRole.java | 3 +++ .../org/keycloak/models/cache/entities/CachedRealm.java | 4 +++- .../java/org/keycloak/models/cache/entities/CachedRole.java | 6 +++++- 15 files changed, 54 insertions(+), 14 deletions(-) diff --git a/core/src/main/java/org/keycloak/enums/SslRequired.java b/core/src/main/java/org/keycloak/enums/SslRequired.java index 0dd34ab52b..af6a41987b 100644 --- a/core/src/main/java/org/keycloak/enums/SslRequired.java +++ b/core/src/main/java/org/keycloak/enums/SslRequired.java @@ -14,6 +14,8 @@ public enum SslRequired { EXTERNAL, NONE; + private static final long serialVersionUID = 1L; + public boolean isRequired(ClientConnection connection) { return isRequired(connection.getRemoteAddr()); } diff --git a/model/api/src/main/java/org/keycloak/models/AuthenticationExecutionModel.java b/model/api/src/main/java/org/keycloak/models/AuthenticationExecutionModel.java index 12cb4fde09..11dfadfe67 100755 --- a/model/api/src/main/java/org/keycloak/models/AuthenticationExecutionModel.java +++ b/model/api/src/main/java/org/keycloak/models/AuthenticationExecutionModel.java @@ -1,12 +1,15 @@ package org.keycloak.models; import java.util.Comparator; +import java.io.Serializable; /** * @author Bill Burke * @version $Revision: 1 $ */ -public class AuthenticationExecutionModel { +public class AuthenticationExecutionModel implements Serializable { + private static final long serialVersionUID = 1L; + public static class ExecutionComparator implements Comparator { public static final ExecutionComparator SINGLETON = new ExecutionComparator(); diff --git a/model/api/src/main/java/org/keycloak/models/AuthenticationFlowModel.java b/model/api/src/main/java/org/keycloak/models/AuthenticationFlowModel.java index b9e53223f7..194a6b39d0 100755 --- a/model/api/src/main/java/org/keycloak/models/AuthenticationFlowModel.java +++ b/model/api/src/main/java/org/keycloak/models/AuthenticationFlowModel.java @@ -1,10 +1,14 @@ package org.keycloak.models; +import java.io.Serializable; + /** * @author Bill Burke * @version $Revision: 1 $ */ -public class AuthenticationFlowModel { +public class AuthenticationFlowModel implements Serializable { + private static final long serialVersionUID = 1L; + private String id; private String alias; private String description; diff --git a/model/api/src/main/java/org/keycloak/models/AuthenticatorModel.java b/model/api/src/main/java/org/keycloak/models/AuthenticatorModel.java index 0a6cacd90a..127487b7e2 100755 --- a/model/api/src/main/java/org/keycloak/models/AuthenticatorModel.java +++ b/model/api/src/main/java/org/keycloak/models/AuthenticatorModel.java @@ -1,5 +1,6 @@ package org.keycloak.models; +import java.io.Serializable; import java.util.HashMap; import java.util.Map; @@ -7,7 +8,8 @@ import java.util.Map; * @author Bill Burke * @version $Revision: 1 $ */ -public class AuthenticatorModel { +public class AuthenticatorModel implements Serializable { + private static final long serialVersionUID = 1L; private String id; private String alias; diff --git a/model/api/src/main/java/org/keycloak/models/IdentityProviderMapperModel.java b/model/api/src/main/java/org/keycloak/models/IdentityProviderMapperModel.java index 982f102a97..2071323003 100755 --- a/model/api/src/main/java/org/keycloak/models/IdentityProviderMapperModel.java +++ b/model/api/src/main/java/org/keycloak/models/IdentityProviderMapperModel.java @@ -1,5 +1,6 @@ package org.keycloak.models; +import java.io.Serializable; import java.util.Map; /** @@ -8,7 +9,9 @@ import java.util.Map; * @author Bill Burke * @version $Revision: 1 $ */ -public class IdentityProviderMapperModel { +public class IdentityProviderMapperModel implements Serializable { + private static final long serialVersionUID = 1L; + protected String id; protected String name; protected String identityProviderAlias; diff --git a/model/api/src/main/java/org/keycloak/models/IdentityProviderModel.java b/model/api/src/main/java/org/keycloak/models/IdentityProviderModel.java index 0c34e4be2d..363ae520ef 100755 --- a/model/api/src/main/java/org/keycloak/models/IdentityProviderModel.java +++ b/model/api/src/main/java/org/keycloak/models/IdentityProviderModel.java @@ -17,6 +17,7 @@ */ package org.keycloak.models; +import java.io.Serializable; import java.util.HashMap; import java.util.Map; @@ -28,7 +29,8 @@ import org.keycloak.representations.idm.IdentityProviderRepresentation; * * @author Pedro Igor */ -public class IdentityProviderModel { +public class IdentityProviderModel implements Serializable { + private static final long serialVersionUID = 1L; private String internalId; diff --git a/model/api/src/main/java/org/keycloak/models/PasswordPolicy.java b/model/api/src/main/java/org/keycloak/models/PasswordPolicy.java index 26ff18eb39..b7f2267a1e 100755 --- a/model/api/src/main/java/org/keycloak/models/PasswordPolicy.java +++ b/model/api/src/main/java/org/keycloak/models/PasswordPolicy.java @@ -2,6 +2,7 @@ package org.keycloak.models; import org.keycloak.models.utils.Pbkdf2PasswordEncoder; +import java.io.Serializable; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; @@ -13,7 +14,8 @@ import java.util.regex.Pattern; /** * @author Stian Thorgersen */ -public class PasswordPolicy { +public class PasswordPolicy implements Serializable { + private static final long serialVersionUID = 1L; public static final String INVALID_PASSWORD_MIN_LENGTH_MESSAGE = "invalidPasswordMinLengthMessage"; public static final String INVALID_PASSWORD_MIN_DIGITS_MESSAGE = "invalidPasswordMinDigitsMessage"; @@ -153,7 +155,7 @@ public class PasswordPolicy { return null; } - private static interface Policy { + private static interface Policy extends Serializable { public Error validate(UserModel user, String password); public Error validate(String user, String password); } diff --git a/model/api/src/main/java/org/keycloak/models/ProtocolMapperModel.java b/model/api/src/main/java/org/keycloak/models/ProtocolMapperModel.java index c72d5e10e0..34fba7ed56 100755 --- a/model/api/src/main/java/org/keycloak/models/ProtocolMapperModel.java +++ b/model/api/src/main/java/org/keycloak/models/ProtocolMapperModel.java @@ -1,5 +1,6 @@ package org.keycloak.models; +import java.io.Serializable; import java.util.Map; /** @@ -8,7 +9,9 @@ import java.util.Map; * @author Bill Burke * @version $Revision: 1 $ */ -public class ProtocolMapperModel { +public class ProtocolMapperModel implements Serializable { + private static final long serialVersionUID = 1L; + protected String id; protected String name; protected String protocol; diff --git a/model/api/src/main/java/org/keycloak/models/RequiredCredentialModel.java b/model/api/src/main/java/org/keycloak/models/RequiredCredentialModel.java index 0840b04f39..ec82abd51c 100755 --- a/model/api/src/main/java/org/keycloak/models/RequiredCredentialModel.java +++ b/model/api/src/main/java/org/keycloak/models/RequiredCredentialModel.java @@ -1,5 +1,6 @@ package org.keycloak.models; +import java.io.Serializable; import java.util.Collections; import java.util.HashMap; import java.util.Map; @@ -8,7 +9,9 @@ import java.util.Map; * @author Bill Burke * @version $Revision: 1 $ */ -public class RequiredCredentialModel { +public class RequiredCredentialModel implements Serializable { + private static final long serialVersionUID = 1L; + protected String type; protected boolean input; protected boolean secret; diff --git a/model/api/src/main/java/org/keycloak/models/UserFederationMapperModel.java b/model/api/src/main/java/org/keycloak/models/UserFederationMapperModel.java index 54a347bdfb..80f22be9e5 100644 --- a/model/api/src/main/java/org/keycloak/models/UserFederationMapperModel.java +++ b/model/api/src/main/java/org/keycloak/models/UserFederationMapperModel.java @@ -1,11 +1,13 @@ package org.keycloak.models; +import java.io.Serializable; import java.util.Map; /** * @author Marek Posolda */ -public class UserFederationMapperModel { +public class UserFederationMapperModel implements Serializable { + private static final long serialVersionUID = 1L; protected String id; protected String name; diff --git a/model/api/src/main/java/org/keycloak/models/UserFederationProviderModel.java b/model/api/src/main/java/org/keycloak/models/UserFederationProviderModel.java index 494670d9ae..4f5feda857 100755 --- a/model/api/src/main/java/org/keycloak/models/UserFederationProviderModel.java +++ b/model/api/src/main/java/org/keycloak/models/UserFederationProviderModel.java @@ -1,5 +1,6 @@ package org.keycloak.models; +import java.io.Serializable; import java.util.HashMap; import java.util.Map; @@ -9,7 +10,8 @@ import java.util.Map; * @author Marek Posolda * @author Bill Burke */ -public class UserFederationProviderModel { +public class UserFederationProviderModel implements Serializable { + private static final long serialVersionUID = 1L; private String id; private String providerName; diff --git a/model/invalidation-cache/model-adapters/src/main/java/org/keycloak/models/cache/entities/CachedClient.java b/model/invalidation-cache/model-adapters/src/main/java/org/keycloak/models/cache/entities/CachedClient.java index 8b8c045e07..15bc15199b 100755 --- a/model/invalidation-cache/model-adapters/src/main/java/org/keycloak/models/cache/entities/CachedClient.java +++ b/model/invalidation-cache/model-adapters/src/main/java/org/keycloak/models/cache/entities/CachedClient.java @@ -7,6 +7,7 @@ import org.keycloak.models.RealmProvider; import org.keycloak.models.RoleModel; import org.keycloak.models.cache.RealmCache; +import java.io.Serializable; import java.util.HashMap; import java.util.HashSet; import java.util.LinkedList; @@ -19,7 +20,9 @@ import java.util.TreeMap; * @author Bill Burke * @version $Revision: 1 $ */ -public class CachedClient { +public class CachedClient implements Serializable { + private static final long serialVersionUID = 1L; + private String id; private String clientId; private String name; diff --git a/model/invalidation-cache/model-adapters/src/main/java/org/keycloak/models/cache/entities/CachedClientRole.java b/model/invalidation-cache/model-adapters/src/main/java/org/keycloak/models/cache/entities/CachedClientRole.java index dd270a55c6..1d2ad72b04 100755 --- a/model/invalidation-cache/model-adapters/src/main/java/org/keycloak/models/cache/entities/CachedClientRole.java +++ b/model/invalidation-cache/model-adapters/src/main/java/org/keycloak/models/cache/entities/CachedClientRole.java @@ -8,6 +8,9 @@ import org.keycloak.models.RoleModel; * @version $Revision: 1 $ */ public class CachedClientRole extends CachedRole { + + private static final long serialVersionUID = 1L; + private final String idClient; public CachedClientRole(String idClient, RoleModel model, RealmModel realm) { diff --git a/model/invalidation-cache/model-adapters/src/main/java/org/keycloak/models/cache/entities/CachedRealm.java b/model/invalidation-cache/model-adapters/src/main/java/org/keycloak/models/cache/entities/CachedRealm.java index 904081edc2..3ee785281d 100755 --- a/model/invalidation-cache/model-adapters/src/main/java/org/keycloak/models/cache/entities/CachedRealm.java +++ b/model/invalidation-cache/model-adapters/src/main/java/org/keycloak/models/cache/entities/CachedRealm.java @@ -17,6 +17,7 @@ import org.keycloak.models.UserFederationProviderModel; import org.keycloak.models.cache.RealmCache; import org.keycloak.util.MultivaluedHashMap; +import java.io.Serializable; import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; @@ -29,7 +30,8 @@ import java.util.Set; * @author Bill Burke * @version $Revision: 1 $ */ -public class CachedRealm { +public class CachedRealm implements Serializable { + private static final long serialVersionUID = 1L; private String id; private String name; diff --git a/model/invalidation-cache/model-adapters/src/main/java/org/keycloak/models/cache/entities/CachedRole.java b/model/invalidation-cache/model-adapters/src/main/java/org/keycloak/models/cache/entities/CachedRole.java index d52d0ffb97..407b9fe777 100755 --- a/model/invalidation-cache/model-adapters/src/main/java/org/keycloak/models/cache/entities/CachedRole.java +++ b/model/invalidation-cache/model-adapters/src/main/java/org/keycloak/models/cache/entities/CachedRole.java @@ -3,6 +3,7 @@ package org.keycloak.models.cache.entities; import org.keycloak.models.RealmModel; import org.keycloak.models.RoleModel; +import java.io.Serializable; import java.util.HashSet; import java.util.Set; @@ -10,7 +11,10 @@ import java.util.Set; * @author Bill Burke * @version $Revision: 1 $ */ -public class CachedRole { +public class CachedRole implements Serializable { + + private static final long serialVersionUID = 1L; + final protected String id; final protected String name; final protected String realm; From caeb7104442e46b819320d5cffb6df4face6d8db Mon Sep 17 00:00:00 2001 From: Stian Thorgersen Date: Wed, 17 Jun 2015 19:28:58 +0200 Subject: [PATCH 2/2] KEYCLOAK-1476 --- .../java/org/keycloak/models/UserCredentialValueModel.java | 4 +++- .../java/org/keycloak/models/cache/entities/CachedUser.java | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/model/api/src/main/java/org/keycloak/models/UserCredentialValueModel.java b/model/api/src/main/java/org/keycloak/models/UserCredentialValueModel.java index 4654ba5b60..988f6a62f7 100755 --- a/model/api/src/main/java/org/keycloak/models/UserCredentialValueModel.java +++ b/model/api/src/main/java/org/keycloak/models/UserCredentialValueModel.java @@ -1,11 +1,13 @@ package org.keycloak.models; +import java.io.Serializable; + /** * Used just in cases when we want to "directly" update or retrieve the hash or salt of user credential (For example during export/import) * * @author Marek Posolda */ -public class UserCredentialValueModel { +public class UserCredentialValueModel implements Serializable { private String type; private String value; diff --git a/model/invalidation-cache/model-adapters/src/main/java/org/keycloak/models/cache/entities/CachedUser.java b/model/invalidation-cache/model-adapters/src/main/java/org/keycloak/models/cache/entities/CachedUser.java index eb9d418cb7..bbef81b759 100755 --- a/model/invalidation-cache/model-adapters/src/main/java/org/keycloak/models/cache/entities/CachedUser.java +++ b/model/invalidation-cache/model-adapters/src/main/java/org/keycloak/models/cache/entities/CachedUser.java @@ -5,6 +5,7 @@ import org.keycloak.models.RoleModel; import org.keycloak.models.UserCredentialValueModel; import org.keycloak.models.UserModel; +import java.io.Serializable; import java.util.HashMap; import java.util.HashSet; import java.util.LinkedList; @@ -16,7 +17,7 @@ import java.util.Set; * @author Bill Burke * @version $Revision: 1 $ */ -public class CachedUser { +public class CachedUser implements Serializable { private String id; private String realm; private String username;