diff --git a/model/api/src/main/java/org/keycloak/models/utils/KeycloakSessionUtils.java b/model/api/src/main/java/org/keycloak/models/utils/KeycloakSessionUtils.java
new file mode 100644
index 0000000000..9119282b4f
--- /dev/null
+++ b/model/api/src/main/java/org/keycloak/models/utils/KeycloakSessionUtils.java
@@ -0,0 +1,15 @@
+package org.keycloak.models.utils;
+
+import java.util.concurrent.atomic.AtomicLong;
+
+/**
+ * @author Marek Posolda
+ */
+public class KeycloakSessionUtils {
+
+ private static AtomicLong counter = new AtomicLong(1);
+
+ public static String generateId() {
+ return counter.getAndIncrement() + "-" + System.currentTimeMillis();
+ }
+}
diff --git a/model/jpa/pom.xml b/model/jpa/pom.xml
index 8f6edf9cc9..243e43801b 100755
--- a/model/jpa/pom.xml
+++ b/model/jpa/pom.xml
@@ -4,7 +4,7 @@
keycloak-parent
org.keycloak
1.0-alpha-1
- ../pom.xml
+ ../../pom.xml
4.0.0
diff --git a/model/mongo/pom.xml b/model/mongo/pom.xml
new file mode 100644
index 0000000000..537112a618
--- /dev/null
+++ b/model/mongo/pom.xml
@@ -0,0 +1,77 @@
+
+
+
+ keycloak-parent
+ org.keycloak
+ 1.0-alpha-1
+ ../../pom.xml
+
+ 4.0.0
+
+ keycloak-model-mongo
+ Keycloak Model Mongo
+
+
+
+
+ org.bouncycastle
+ bcprov-jdk16
+ provided
+
+
+ org.keycloak
+ keycloak-core
+ ${project.version}
+ provided
+
+
+ org.keycloak
+ keycloak-model-api
+ ${project.version}
+
+
+ org.jboss.logging
+ jboss-logging
+ provided
+
+
+ org.picketlink
+ picketlink-common
+ provided
+
+
+ org.picketlink
+ picketlink-idm-api
+ provided
+
+
+ org.mongodb
+ mongo-java-driver
+ provided
+
+
+ de.flapdoodle.embed
+ de.flapdoodle.embed.mongo
+ test
+
+
+ junit
+ junit
+ test
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+
+
+ 1.6
+
+
+
+
+
\ No newline at end of file
diff --git a/services/src/main/java/org/keycloak/services/models/nosql/api/AbstractAttributedNoSQLObject.java b/model/mongo/src/main/java/org/keycloak/models/mongo/api/AbstractAttributedNoSQLObject.java
similarity index 95%
rename from services/src/main/java/org/keycloak/services/models/nosql/api/AbstractAttributedNoSQLObject.java
rename to model/mongo/src/main/java/org/keycloak/models/mongo/api/AbstractAttributedNoSQLObject.java
index a3a6ddb1bf..81546ba469 100644
--- a/services/src/main/java/org/keycloak/services/models/nosql/api/AbstractAttributedNoSQLObject.java
+++ b/model/mongo/src/main/java/org/keycloak/models/mongo/api/AbstractAttributedNoSQLObject.java
@@ -1,4 +1,4 @@
-package org.keycloak.services.models.nosql.api;
+package org.keycloak.models.mongo.api;
import java.util.Collections;
import java.util.HashMap;
diff --git a/services/src/main/java/org/keycloak/services/models/nosql/api/AbstractNoSQLObject.java b/model/mongo/src/main/java/org/keycloak/models/mongo/api/AbstractNoSQLObject.java
similarity index 83%
rename from services/src/main/java/org/keycloak/services/models/nosql/api/AbstractNoSQLObject.java
rename to model/mongo/src/main/java/org/keycloak/models/mongo/api/AbstractNoSQLObject.java
index 692839bc00..837e5e4644 100644
--- a/services/src/main/java/org/keycloak/services/models/nosql/api/AbstractNoSQLObject.java
+++ b/model/mongo/src/main/java/org/keycloak/models/mongo/api/AbstractNoSQLObject.java
@@ -1,4 +1,4 @@
-package org.keycloak.services.models.nosql.api;
+package org.keycloak.models.mongo.api;
/**
* @author Marek Posolda
diff --git a/services/src/main/java/org/keycloak/services/models/nosql/api/AttributedNoSQLObject.java b/model/mongo/src/main/java/org/keycloak/models/mongo/api/AttributedNoSQLObject.java
similarity index 87%
rename from services/src/main/java/org/keycloak/services/models/nosql/api/AttributedNoSQLObject.java
rename to model/mongo/src/main/java/org/keycloak/models/mongo/api/AttributedNoSQLObject.java
index f750e82a8c..45accd1c1c 100644
--- a/services/src/main/java/org/keycloak/services/models/nosql/api/AttributedNoSQLObject.java
+++ b/model/mongo/src/main/java/org/keycloak/models/mongo/api/AttributedNoSQLObject.java
@@ -1,4 +1,4 @@
-package org.keycloak.services.models.nosql.api;
+package org.keycloak.models.mongo.api;
import java.util.Map;
diff --git a/services/src/main/java/org/keycloak/services/models/nosql/api/NoSQL.java b/model/mongo/src/main/java/org/keycloak/models/mongo/api/NoSQL.java
similarity index 84%
rename from services/src/main/java/org/keycloak/services/models/nosql/api/NoSQL.java
rename to model/mongo/src/main/java/org/keycloak/models/mongo/api/NoSQL.java
index f30256756c..3bc62a590f 100644
--- a/services/src/main/java/org/keycloak/services/models/nosql/api/NoSQL.java
+++ b/model/mongo/src/main/java/org/keycloak/models/mongo/api/NoSQL.java
@@ -1,9 +1,9 @@
-package org.keycloak.services.models.nosql.api;
+package org.keycloak.models.mongo.api;
import java.util.List;
-import org.keycloak.services.models.nosql.api.query.NoSQLQuery;
-import org.keycloak.services.models.nosql.api.query.NoSQLQueryBuilder;
+import org.keycloak.models.mongo.api.query.NoSQLQuery;
+import org.keycloak.models.mongo.api.query.NoSQLQueryBuilder;
import org.picketlink.common.properties.Property;
/**
diff --git a/services/src/main/java/org/keycloak/services/models/nosql/api/NoSQLCollection.java b/model/mongo/src/main/java/org/keycloak/models/mongo/api/NoSQLCollection.java
similarity index 90%
rename from services/src/main/java/org/keycloak/services/models/nosql/api/NoSQLCollection.java
rename to model/mongo/src/main/java/org/keycloak/models/mongo/api/NoSQLCollection.java
index ff41188736..80b63326f0 100644
--- a/services/src/main/java/org/keycloak/services/models/nosql/api/NoSQLCollection.java
+++ b/model/mongo/src/main/java/org/keycloak/models/mongo/api/NoSQLCollection.java
@@ -1,4 +1,4 @@
-package org.keycloak.services.models.nosql.api;
+package org.keycloak.models.mongo.api;
import java.lang.annotation.Documented;
import java.lang.annotation.Inherited;
diff --git a/services/src/main/java/org/keycloak/services/models/nosql/api/NoSQLField.java b/model/mongo/src/main/java/org/keycloak/models/mongo/api/NoSQLField.java
similarity index 91%
rename from services/src/main/java/org/keycloak/services/models/nosql/api/NoSQLField.java
rename to model/mongo/src/main/java/org/keycloak/models/mongo/api/NoSQLField.java
index 8c5d2a2940..3af69a7135 100644
--- a/services/src/main/java/org/keycloak/services/models/nosql/api/NoSQLField.java
+++ b/model/mongo/src/main/java/org/keycloak/models/mongo/api/NoSQLField.java
@@ -1,4 +1,4 @@
-package org.keycloak.services.models.nosql.api;
+package org.keycloak.models.mongo.api;
import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
diff --git a/services/src/main/java/org/keycloak/services/models/nosql/api/NoSQLId.java b/model/mongo/src/main/java/org/keycloak/models/mongo/api/NoSQLId.java
similarity index 90%
rename from services/src/main/java/org/keycloak/services/models/nosql/api/NoSQLId.java
rename to model/mongo/src/main/java/org/keycloak/models/mongo/api/NoSQLId.java
index 0cbca8542f..06ed01e655 100644
--- a/services/src/main/java/org/keycloak/services/models/nosql/api/NoSQLId.java
+++ b/model/mongo/src/main/java/org/keycloak/models/mongo/api/NoSQLId.java
@@ -1,4 +1,4 @@
-package org.keycloak.services.models.nosql.api;
+package org.keycloak.models.mongo.api;
import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
diff --git a/services/src/main/java/org/keycloak/services/models/nosql/api/NoSQLObject.java b/model/mongo/src/main/java/org/keycloak/models/mongo/api/NoSQLObject.java
similarity index 89%
rename from services/src/main/java/org/keycloak/services/models/nosql/api/NoSQLObject.java
rename to model/mongo/src/main/java/org/keycloak/models/mongo/api/NoSQLObject.java
index 7d31b68700..0242243936 100644
--- a/services/src/main/java/org/keycloak/services/models/nosql/api/NoSQLObject.java
+++ b/model/mongo/src/main/java/org/keycloak/models/mongo/api/NoSQLObject.java
@@ -1,4 +1,4 @@
-package org.keycloak.services.models.nosql.api;
+package org.keycloak.models.mongo.api;
/**
* Base interface for object, which is persisted in NoSQL database
diff --git a/services/src/main/java/org/keycloak/services/models/nosql/api/query/NoSQLQuery.java b/model/mongo/src/main/java/org/keycloak/models/mongo/api/query/NoSQLQuery.java
similarity index 87%
rename from services/src/main/java/org/keycloak/services/models/nosql/api/query/NoSQLQuery.java
rename to model/mongo/src/main/java/org/keycloak/models/mongo/api/query/NoSQLQuery.java
index 90be201420..29cc0f31ab 100644
--- a/services/src/main/java/org/keycloak/services/models/nosql/api/query/NoSQLQuery.java
+++ b/model/mongo/src/main/java/org/keycloak/models/mongo/api/query/NoSQLQuery.java
@@ -1,7 +1,6 @@
-package org.keycloak.services.models.nosql.api.query;
+package org.keycloak.models.mongo.api.query;
import java.util.Collections;
-import java.util.HashMap;
import java.util.Map;
/**
diff --git a/services/src/main/java/org/keycloak/services/models/nosql/api/query/NoSQLQueryBuilder.java b/model/mongo/src/main/java/org/keycloak/models/mongo/api/query/NoSQLQueryBuilder.java
similarity index 92%
rename from services/src/main/java/org/keycloak/services/models/nosql/api/query/NoSQLQueryBuilder.java
rename to model/mongo/src/main/java/org/keycloak/models/mongo/api/query/NoSQLQueryBuilder.java
index 9f2c38303d..dcdb5752a3 100644
--- a/services/src/main/java/org/keycloak/services/models/nosql/api/query/NoSQLQueryBuilder.java
+++ b/model/mongo/src/main/java/org/keycloak/models/mongo/api/query/NoSQLQueryBuilder.java
@@ -1,4 +1,4 @@
-package org.keycloak.services.models.nosql.api.query;
+package org.keycloak.models.mongo.api.query;
import java.util.HashMap;
import java.util.List;
diff --git a/services/src/main/java/org/keycloak/services/models/nosql/api/types/Converter.java b/model/mongo/src/main/java/org/keycloak/models/mongo/api/types/Converter.java
similarity index 90%
rename from services/src/main/java/org/keycloak/services/models/nosql/api/types/Converter.java
rename to model/mongo/src/main/java/org/keycloak/models/mongo/api/types/Converter.java
index 37402015c1..a6b6c869e6 100644
--- a/services/src/main/java/org/keycloak/services/models/nosql/api/types/Converter.java
+++ b/model/mongo/src/main/java/org/keycloak/models/mongo/api/types/Converter.java
@@ -1,4 +1,4 @@
-package org.keycloak.services.models.nosql.api.types;
+package org.keycloak.models.mongo.api.types;
/**
* SPI object to convert object from application type to database type and vice versa. Shouldn't be directly used by application.
diff --git a/services/src/main/java/org/keycloak/services/models/nosql/api/types/TypeConverter.java b/model/mongo/src/main/java/org/keycloak/models/mongo/api/types/TypeConverter.java
similarity index 98%
rename from services/src/main/java/org/keycloak/services/models/nosql/api/types/TypeConverter.java
rename to model/mongo/src/main/java/org/keycloak/models/mongo/api/types/TypeConverter.java
index 00c8e5e01a..a7c12c0cfb 100644
--- a/services/src/main/java/org/keycloak/services/models/nosql/api/types/TypeConverter.java
+++ b/model/mongo/src/main/java/org/keycloak/models/mongo/api/types/TypeConverter.java
@@ -1,4 +1,4 @@
-package org.keycloak.services.models.nosql.api.types;
+package org.keycloak.models.mongo.api.types;
import java.util.HashMap;
import java.util.Map;
diff --git a/services/src/main/java/org/keycloak/services/models/nosql/impl/MongoDBImpl.java b/model/mongo/src/main/java/org/keycloak/models/mongo/impl/MongoDBImpl.java
similarity index 91%
rename from services/src/main/java/org/keycloak/services/models/nosql/impl/MongoDBImpl.java
rename to model/mongo/src/main/java/org/keycloak/models/mongo/impl/MongoDBImpl.java
index a6b49300b3..6273ba2eb8 100644
--- a/services/src/main/java/org/keycloak/services/models/nosql/impl/MongoDBImpl.java
+++ b/model/mongo/src/main/java/org/keycloak/models/mongo/impl/MongoDBImpl.java
@@ -1,4 +1,4 @@
-package org.keycloak.services.models.nosql.impl;
+package org.keycloak.models.mongo.impl;
import java.util.ArrayList;
import java.util.Date;
@@ -14,23 +14,23 @@ import com.mongodb.DBCollection;
import com.mongodb.DBCursor;
import com.mongodb.DBObject;
import org.bson.types.ObjectId;
-import org.jboss.resteasy.logging.Logger;
-import org.keycloak.services.models.nosql.api.NoSQL;
-import org.keycloak.services.models.nosql.api.NoSQLCollection;
-import org.keycloak.services.models.nosql.api.NoSQLField;
-import org.keycloak.services.models.nosql.api.NoSQLId;
-import org.keycloak.services.models.nosql.api.NoSQLObject;
-import org.keycloak.services.models.nosql.api.query.NoSQLQuery;
-import org.keycloak.services.models.nosql.api.query.NoSQLQueryBuilder;
-import org.keycloak.services.models.nosql.api.types.Converter;
-import org.keycloak.services.models.nosql.api.types.TypeConverter;
-import org.keycloak.services.models.nosql.impl.types.EnumToStringConverter;
-import org.keycloak.services.models.nosql.impl.types.ListConverter;
-import org.keycloak.services.models.nosql.impl.types.BasicDBListConverter;
-import org.keycloak.services.models.nosql.impl.types.BasicDBObjectConverter;
-import org.keycloak.services.models.nosql.impl.types.NoSQLObjectConverter;
-import org.keycloak.services.models.nosql.impl.types.SimpleConverter;
-import org.keycloak.services.models.nosql.impl.types.StringToEnumConverter;
+import org.jboss.logging.Logger;
+import org.keycloak.models.mongo.api.NoSQL;
+import org.keycloak.models.mongo.api.NoSQLCollection;
+import org.keycloak.models.mongo.api.NoSQLField;
+import org.keycloak.models.mongo.api.NoSQLId;
+import org.keycloak.models.mongo.api.NoSQLObject;
+import org.keycloak.models.mongo.api.query.NoSQLQuery;
+import org.keycloak.models.mongo.api.query.NoSQLQueryBuilder;
+import org.keycloak.models.mongo.api.types.Converter;
+import org.keycloak.models.mongo.api.types.TypeConverter;
+import org.keycloak.models.mongo.impl.types.EnumToStringConverter;
+import org.keycloak.models.mongo.impl.types.ListConverter;
+import org.keycloak.models.mongo.impl.types.BasicDBListConverter;
+import org.keycloak.models.mongo.impl.types.BasicDBObjectConverter;
+import org.keycloak.models.mongo.impl.types.NoSQLObjectConverter;
+import org.keycloak.models.mongo.impl.types.SimpleConverter;
+import org.keycloak.models.mongo.impl.types.StringToEnumConverter;
import org.picketlink.common.properties.Property;
import org.picketlink.common.properties.query.AnnotatedPropertyCriteria;
import org.picketlink.common.properties.query.PropertyQueries;
diff --git a/services/src/main/java/org/keycloak/services/models/nosql/impl/MongoDBQueryBuilder.java b/model/mongo/src/main/java/org/keycloak/models/mongo/impl/MongoDBQueryBuilder.java
similarity index 89%
rename from services/src/main/java/org/keycloak/services/models/nosql/impl/MongoDBQueryBuilder.java
rename to model/mongo/src/main/java/org/keycloak/models/mongo/impl/MongoDBQueryBuilder.java
index 80f5efba59..f56c799aea 100644
--- a/services/src/main/java/org/keycloak/services/models/nosql/impl/MongoDBQueryBuilder.java
+++ b/model/mongo/src/main/java/org/keycloak/models/mongo/impl/MongoDBQueryBuilder.java
@@ -1,4 +1,4 @@
-package org.keycloak.services.models.nosql.impl;
+package org.keycloak.models.mongo.impl;
import java.util.ArrayList;
import java.util.LinkedList;
@@ -6,7 +6,7 @@ import java.util.List;
import com.mongodb.BasicDBObject;
import org.bson.types.ObjectId;
-import org.keycloak.services.models.nosql.api.query.NoSQLQueryBuilder;
+import org.keycloak.models.mongo.api.query.NoSQLQueryBuilder;
/**
* @author Marek Posolda
diff --git a/services/src/main/java/org/keycloak/services/models/nosql/impl/ObjectInfo.java b/model/mongo/src/main/java/org/keycloak/models/mongo/impl/ObjectInfo.java
similarity index 93%
rename from services/src/main/java/org/keycloak/services/models/nosql/impl/ObjectInfo.java
rename to model/mongo/src/main/java/org/keycloak/models/mongo/impl/ObjectInfo.java
index da9d27937c..ae548a607a 100644
--- a/services/src/main/java/org/keycloak/services/models/nosql/impl/ObjectInfo.java
+++ b/model/mongo/src/main/java/org/keycloak/models/mongo/impl/ObjectInfo.java
@@ -1,4 +1,4 @@
-package org.keycloak.services.models.nosql.impl;
+package org.keycloak.models.mongo.impl;
import java.util.Collection;
import java.util.Collections;
@@ -6,7 +6,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import org.keycloak.services.models.nosql.api.NoSQLObject;
+import org.keycloak.models.mongo.api.NoSQLObject;
import org.picketlink.common.properties.Property;
/**
diff --git a/services/src/main/java/org/keycloak/services/models/nosql/impl/types/BasicDBListConverter.java b/model/mongo/src/main/java/org/keycloak/models/mongo/impl/types/BasicDBListConverter.java
similarity index 92%
rename from services/src/main/java/org/keycloak/services/models/nosql/impl/types/BasicDBListConverter.java
rename to model/mongo/src/main/java/org/keycloak/models/mongo/impl/types/BasicDBListConverter.java
index 75dae75259..896257fa8b 100644
--- a/services/src/main/java/org/keycloak/services/models/nosql/impl/types/BasicDBListConverter.java
+++ b/model/mongo/src/main/java/org/keycloak/models/mongo/impl/types/BasicDBListConverter.java
@@ -1,11 +1,11 @@
-package org.keycloak.services.models.nosql.impl.types;
+package org.keycloak.models.mongo.impl.types;
import java.util.ArrayList;
import com.mongodb.BasicDBList;
import com.mongodb.BasicDBObject;
-import org.keycloak.services.models.nosql.api.types.Converter;
-import org.keycloak.services.models.nosql.api.types.TypeConverter;
+import org.keycloak.models.mongo.api.types.Converter;
+import org.keycloak.models.mongo.api.types.TypeConverter;
/**
* @author Marek Posolda
diff --git a/services/src/main/java/org/keycloak/services/models/nosql/impl/types/BasicDBObjectConverter.java b/model/mongo/src/main/java/org/keycloak/models/mongo/impl/types/BasicDBObjectConverter.java
similarity index 87%
rename from services/src/main/java/org/keycloak/services/models/nosql/impl/types/BasicDBObjectConverter.java
rename to model/mongo/src/main/java/org/keycloak/models/mongo/impl/types/BasicDBObjectConverter.java
index 4257fb4f50..a423652b38 100644
--- a/services/src/main/java/org/keycloak/services/models/nosql/impl/types/BasicDBObjectConverter.java
+++ b/model/mongo/src/main/java/org/keycloak/models/mongo/impl/types/BasicDBObjectConverter.java
@@ -1,13 +1,13 @@
-package org.keycloak.services.models.nosql.impl.types;
+package org.keycloak.models.mongo.impl.types;
import com.mongodb.BasicDBObject;
-import org.jboss.resteasy.logging.Logger;
-import org.keycloak.services.models.nosql.api.AttributedNoSQLObject;
-import org.keycloak.services.models.nosql.api.NoSQLObject;
-import org.keycloak.services.models.nosql.api.types.Converter;
-import org.keycloak.services.models.nosql.api.types.TypeConverter;
-import org.keycloak.services.models.nosql.impl.MongoDBImpl;
-import org.keycloak.services.models.nosql.impl.ObjectInfo;
+import org.jboss.logging.Logger;
+import org.keycloak.models.mongo.api.AttributedNoSQLObject;
+import org.keycloak.models.mongo.api.NoSQLObject;
+import org.keycloak.models.mongo.api.types.Converter;
+import org.keycloak.models.mongo.api.types.TypeConverter;
+import org.keycloak.models.mongo.impl.MongoDBImpl;
+import org.keycloak.models.mongo.impl.ObjectInfo;
import org.picketlink.common.properties.Property;
import org.picketlink.common.reflection.Types;
diff --git a/services/src/main/java/org/keycloak/services/models/nosql/impl/types/ClassCache.java b/model/mongo/src/main/java/org/keycloak/models/mongo/impl/types/ClassCache.java
similarity index 94%
rename from services/src/main/java/org/keycloak/services/models/nosql/impl/types/ClassCache.java
rename to model/mongo/src/main/java/org/keycloak/models/mongo/impl/types/ClassCache.java
index cf4372b561..891ccdd0e5 100644
--- a/services/src/main/java/org/keycloak/services/models/nosql/impl/types/ClassCache.java
+++ b/model/mongo/src/main/java/org/keycloak/models/mongo/impl/types/ClassCache.java
@@ -1,4 +1,4 @@
-package org.keycloak.services.models.nosql.impl.types;
+package org.keycloak.models.mongo.impl.types;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
diff --git a/services/src/main/java/org/keycloak/services/models/nosql/impl/types/EnumToStringConverter.java b/model/mongo/src/main/java/org/keycloak/models/mongo/impl/types/EnumToStringConverter.java
similarity index 85%
rename from services/src/main/java/org/keycloak/services/models/nosql/impl/types/EnumToStringConverter.java
rename to model/mongo/src/main/java/org/keycloak/models/mongo/impl/types/EnumToStringConverter.java
index fd32db51ac..2a800df46b 100644
--- a/services/src/main/java/org/keycloak/services/models/nosql/impl/types/EnumToStringConverter.java
+++ b/model/mongo/src/main/java/org/keycloak/models/mongo/impl/types/EnumToStringConverter.java
@@ -1,6 +1,6 @@
-package org.keycloak.services.models.nosql.impl.types;
+package org.keycloak.models.mongo.impl.types;
-import org.keycloak.services.models.nosql.api.types.Converter;
+import org.keycloak.models.mongo.api.types.Converter;
/**
* @author Marek Posolda
diff --git a/services/src/main/java/org/keycloak/services/models/nosql/impl/types/ListConverter.java b/model/mongo/src/main/java/org/keycloak/models/mongo/impl/types/ListConverter.java
similarity index 89%
rename from services/src/main/java/org/keycloak/services/models/nosql/impl/types/ListConverter.java
rename to model/mongo/src/main/java/org/keycloak/models/mongo/impl/types/ListConverter.java
index a9685abad0..8b72ca223c 100644
--- a/services/src/main/java/org/keycloak/services/models/nosql/impl/types/ListConverter.java
+++ b/model/mongo/src/main/java/org/keycloak/models/mongo/impl/types/ListConverter.java
@@ -1,11 +1,11 @@
-package org.keycloak.services.models.nosql.impl.types;
+package org.keycloak.models.mongo.impl.types;
import java.util.List;
import com.mongodb.BasicDBList;
import com.mongodb.BasicDBObject;
-import org.keycloak.services.models.nosql.api.types.Converter;
-import org.keycloak.services.models.nosql.api.types.TypeConverter;
+import org.keycloak.models.mongo.api.types.Converter;
+import org.keycloak.models.mongo.api.types.TypeConverter;
/**
* @author Marek Posolda
diff --git a/services/src/main/java/org/keycloak/services/models/nosql/impl/types/NoSQLObjectConverter.java b/model/mongo/src/main/java/org/keycloak/models/mongo/impl/types/NoSQLObjectConverter.java
similarity index 81%
rename from services/src/main/java/org/keycloak/services/models/nosql/impl/types/NoSQLObjectConverter.java
rename to model/mongo/src/main/java/org/keycloak/models/mongo/impl/types/NoSQLObjectConverter.java
index cd783672c3..f7be7aea33 100644
--- a/services/src/main/java/org/keycloak/services/models/nosql/impl/types/NoSQLObjectConverter.java
+++ b/model/mongo/src/main/java/org/keycloak/models/mongo/impl/types/NoSQLObjectConverter.java
@@ -1,18 +1,16 @@
-package org.keycloak.services.models.nosql.impl.types;
+package org.keycloak.models.mongo.impl.types;
import java.util.Collection;
-import java.util.List;
import java.util.Map;
import com.mongodb.BasicDBObject;
-import org.keycloak.services.models.nosql.api.AttributedNoSQLObject;
-import org.keycloak.services.models.nosql.api.NoSQLObject;
-import org.keycloak.services.models.nosql.api.types.Converter;
-import org.keycloak.services.models.nosql.api.types.TypeConverter;
-import org.keycloak.services.models.nosql.impl.MongoDBImpl;
-import org.keycloak.services.models.nosql.impl.ObjectInfo;
+import org.keycloak.models.mongo.api.AttributedNoSQLObject;
+import org.keycloak.models.mongo.api.NoSQLObject;
+import org.keycloak.models.mongo.api.types.Converter;
+import org.keycloak.models.mongo.api.types.TypeConverter;
+import org.keycloak.models.mongo.impl.MongoDBImpl;
+import org.keycloak.models.mongo.impl.ObjectInfo;
import org.picketlink.common.properties.Property;
-import org.picketlink.common.reflection.Types;
/**
* @author Marek Posolda
diff --git a/services/src/main/java/org/keycloak/services/models/nosql/impl/types/SimpleConverter.java b/model/mongo/src/main/java/org/keycloak/models/mongo/impl/types/SimpleConverter.java
similarity index 83%
rename from services/src/main/java/org/keycloak/services/models/nosql/impl/types/SimpleConverter.java
rename to model/mongo/src/main/java/org/keycloak/models/mongo/impl/types/SimpleConverter.java
index 8dc1b62ba8..5ba1de5498 100644
--- a/services/src/main/java/org/keycloak/services/models/nosql/impl/types/SimpleConverter.java
+++ b/model/mongo/src/main/java/org/keycloak/models/mongo/impl/types/SimpleConverter.java
@@ -1,6 +1,6 @@
-package org.keycloak.services.models.nosql.impl.types;
+package org.keycloak.models.mongo.impl.types;
-import org.keycloak.services.models.nosql.api.types.Converter;
+import org.keycloak.models.mongo.api.types.Converter;
/**
* @author Marek Posolda
diff --git a/services/src/main/java/org/keycloak/services/models/nosql/impl/types/StringToEnumConverter.java b/model/mongo/src/main/java/org/keycloak/models/mongo/impl/types/StringToEnumConverter.java
similarity index 88%
rename from services/src/main/java/org/keycloak/services/models/nosql/impl/types/StringToEnumConverter.java
rename to model/mongo/src/main/java/org/keycloak/models/mongo/impl/types/StringToEnumConverter.java
index d40594384a..0c948eccb4 100644
--- a/services/src/main/java/org/keycloak/services/models/nosql/impl/types/StringToEnumConverter.java
+++ b/model/mongo/src/main/java/org/keycloak/models/mongo/impl/types/StringToEnumConverter.java
@@ -1,6 +1,6 @@
-package org.keycloak.services.models.nosql.impl.types;
+package org.keycloak.models.mongo.impl.types;
-import org.keycloak.services.models.nosql.api.types.Converter;
+import org.keycloak.models.mongo.api.types.Converter;
/**
* @author Marek Posolda
diff --git a/services/src/main/java/org/keycloak/services/models/nosql/keycloak/adapters/ApplicationAdapter.java b/model/mongo/src/main/java/org/keycloak/models/mongo/keycloak/adapters/ApplicationAdapter.java
similarity index 66%
rename from services/src/main/java/org/keycloak/services/models/nosql/keycloak/adapters/ApplicationAdapter.java
rename to model/mongo/src/main/java/org/keycloak/models/mongo/keycloak/adapters/ApplicationAdapter.java
index 4d7a564425..72dd3d672c 100644
--- a/services/src/main/java/org/keycloak/services/models/nosql/keycloak/adapters/ApplicationAdapter.java
+++ b/model/mongo/src/main/java/org/keycloak/models/mongo/keycloak/adapters/ApplicationAdapter.java
@@ -1,18 +1,18 @@
-package org.keycloak.services.models.nosql.keycloak.adapters;
+package org.keycloak.models.mongo.keycloak.adapters;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
-import org.keycloak.services.models.ApplicationModel;
-import org.keycloak.services.models.RoleModel;
-import org.keycloak.services.models.UserModel;
-import org.keycloak.services.models.nosql.api.NoSQL;
-import org.keycloak.services.models.nosql.api.query.NoSQLQuery;
-import org.keycloak.services.models.nosql.keycloak.data.ApplicationData;
-import org.keycloak.services.models.nosql.keycloak.data.RoleData;
-import org.keycloak.services.models.nosql.keycloak.data.UserData;
+import org.keycloak.models.ApplicationModel;
+import org.keycloak.models.RoleModel;
+import org.keycloak.models.UserModel;
+import org.keycloak.models.mongo.api.NoSQL;
+import org.keycloak.models.mongo.api.query.NoSQLQuery;
+import org.keycloak.models.mongo.keycloak.data.ApplicationData;
+import org.keycloak.models.mongo.keycloak.data.RoleData;
+import org.keycloak.models.mongo.keycloak.data.UserData;
/**
* @author Marek Posolda
@@ -30,12 +30,12 @@ public class ApplicationAdapter implements ApplicationModel {
}
@Override
- public void updateResource() {
+ public void updateApplication() {
noSQL.saveObject(application);
}
@Override
- public UserModel getResourceUser() {
+ public UserModel getApplicationUser() {
// This is not thread-safe. Assumption is that ApplicationAdapter instance is per-client object
if (resourceUser == null) {
resourceUser = noSQL.loadObject(UserData.class, application.getResourceUserId());
@@ -89,6 +89,16 @@ public class ApplicationAdapter implements ApplicationModel {
application.setManagementUrl(url);
}
+ @Override
+ public void setBaseUrl(String url) {
+ application.setBaseUrl(url);
+ }
+
+ @Override
+ public String getBaseUrl() {
+ return application.getBaseUrl();
+ }
+
@Override
public RoleAdapter getRole(String name) {
NoSQLQuery query = noSQL.createQueryBuilder()
@@ -103,6 +113,22 @@ public class ApplicationAdapter implements ApplicationModel {
}
}
+ @Override
+ public RoleModel getRoleById(String id) {
+ RoleData role = noSQL.loadObject(RoleData.class, id);
+ if (role == null) {
+ return null;
+ } else {
+ return new RoleAdapter(role, noSQL);
+ }
+ }
+
+ @Override
+ public void grantRole(UserModel user, RoleModel role) {
+ UserData userData = ((UserAdapter)user).getUser();
+ noSQL.pushItemToList(userData, "roleIds", role.getId());
+ }
+
@Override
public RoleAdapter addRole(String name) {
if (getRole(name) != null) {
@@ -132,17 +158,21 @@ public class ApplicationAdapter implements ApplicationModel {
return result;
}
- @Override
- public Set getRoleMappings(UserModel user) {
+ // Static so that it can be used from RealmAdapter as well
+ static List getAllRolesOfUser(UserModel user, NoSQL noSQL) {
UserData userData = ((UserAdapter)user).getUser();
List roleIds = userData.getRoleIds();
- Set result = new HashSet();
-
NoSQLQuery query = noSQL.createQueryBuilder()
.inCondition("_id", roleIds)
.build();
- List roles = noSQL.loadObjects(RoleData.class, query);
+ return noSQL.loadObjects(RoleData.class, query);
+ }
+
+ @Override
+ public Set getRoleMappingValues(UserModel user) {
+ Set result = new HashSet();
+ List roles = getAllRolesOfUser(user, noSQL);
// TODO: Maybe improve as currently we need to obtain all roles and then filter programmatically...
for (RoleData role : roles) {
if (getId().equals(role.getApplicationId())) {
@@ -153,23 +183,42 @@ public class ApplicationAdapter implements ApplicationModel {
}
@Override
- public void addScope(UserModel agent, String roleName) {
+ public List getRoleMappings(UserModel user) {
+ List result = new ArrayList();
+ List roles = getAllRolesOfUser(user, noSQL);
+ // TODO: Maybe improve as currently we need to obtain all roles and then filter programmatically...
+ for (RoleData role : roles) {
+ if (getId().equals(role.getApplicationId())) {
+ result.add(new RoleAdapter(role, noSQL));
+ }
+ }
+ return result;
+ }
+
+ @Override
+ public void deleteRoleMapping(UserModel user, RoleModel role) {
+ UserData userData = ((UserAdapter)user).getUser();
+ noSQL.pullItemFromList(userData, "roleIds", role.getId());
+ }
+
+ @Override
+ public void addScopeMapping(UserModel agent, String roleName) {
RoleAdapter role = getRole(roleName);
if (role == null) {
throw new RuntimeException("Role not found");
}
- addScope(agent, role);
+ addScopeMapping(agent, role);
}
@Override
- public void addScope(UserModel agent, RoleModel role) {
+ public void addScopeMapping(UserModel agent, RoleModel role) {
UserData userData = ((UserAdapter)agent).getUser();
noSQL.pushItemToList(userData, "scopeIds", role.getId());
}
@Override
- public Set getScope(UserModel agent) {
+ public Set getScopeMapping(UserModel agent) {
UserData userData = ((UserAdapter)agent).getUser();
List scopeIds = userData.getScopeIds();
diff --git a/services/src/main/java/org/keycloak/services/models/nosql/keycloak/adapters/MongoDBSessionFactory.java b/model/mongo/src/main/java/org/keycloak/models/mongo/keycloak/adapters/MongoDBSessionFactory.java
similarity index 57%
rename from services/src/main/java/org/keycloak/services/models/nosql/keycloak/adapters/MongoDBSessionFactory.java
rename to model/mongo/src/main/java/org/keycloak/models/mongo/keycloak/adapters/MongoDBSessionFactory.java
index 6f1d7f760e..b1ac5093ec 100644
--- a/services/src/main/java/org/keycloak/services/models/nosql/keycloak/adapters/MongoDBSessionFactory.java
+++ b/model/mongo/src/main/java/org/keycloak/models/mongo/keycloak/adapters/MongoDBSessionFactory.java
@@ -1,27 +1,24 @@
-package org.keycloak.services.models.nosql.keycloak.adapters;
+package org.keycloak.models.mongo.keycloak.adapters;
import java.net.UnknownHostException;
import com.mongodb.DB;
import com.mongodb.MongoClient;
-import org.jboss.resteasy.logging.Logger;
-import org.keycloak.services.managers.RealmManager;
-import org.keycloak.services.models.KeycloakSession;
-import org.keycloak.services.models.KeycloakSessionFactory;
-import org.keycloak.services.models.nosql.api.NoSQL;
-import org.keycloak.services.models.nosql.api.NoSQLObject;
-import org.keycloak.services.models.nosql.api.query.NoSQLQuery;
-import org.keycloak.services.models.nosql.api.query.NoSQLQueryBuilder;
-import org.keycloak.services.models.nosql.keycloak.data.ApplicationData;
-import org.keycloak.services.models.nosql.keycloak.data.RealmData;
-import org.keycloak.services.models.nosql.keycloak.data.RequiredCredentialData;
-import org.keycloak.services.models.nosql.keycloak.data.RoleData;
-import org.keycloak.services.models.nosql.keycloak.data.SocialLinkData;
-import org.keycloak.services.models.nosql.keycloak.data.UserData;
-import org.keycloak.services.models.nosql.impl.MongoDBImpl;
-import org.keycloak.services.models.nosql.impl.MongoDBQueryBuilder;
-import org.keycloak.services.models.nosql.keycloak.data.credentials.OTPData;
-import org.keycloak.services.models.nosql.keycloak.data.credentials.PasswordData;
+import org.jboss.logging.Logger;
+import org.keycloak.models.KeycloakSession;
+import org.keycloak.models.KeycloakSessionFactory;
+import org.keycloak.models.mongo.api.NoSQL;
+import org.keycloak.models.mongo.api.NoSQLObject;
+import org.keycloak.models.mongo.keycloak.data.ApplicationData;
+import org.keycloak.models.mongo.keycloak.data.OAuthClientData;
+import org.keycloak.models.mongo.keycloak.data.RealmData;
+import org.keycloak.models.mongo.keycloak.data.RequiredCredentialData;
+import org.keycloak.models.mongo.keycloak.data.RoleData;
+import org.keycloak.models.mongo.keycloak.data.SocialLinkData;
+import org.keycloak.models.mongo.keycloak.data.UserData;
+import org.keycloak.models.mongo.impl.MongoDBImpl;
+import org.keycloak.models.mongo.keycloak.data.credentials.OTPData;
+import org.keycloak.models.mongo.keycloak.data.credentials.PasswordData;
/**
* NoSQL implementation based on MongoDB
@@ -39,7 +36,8 @@ public class MongoDBSessionFactory implements KeycloakSessionFactory {
PasswordData.class,
OTPData.class,
SocialLinkData.class,
- ApplicationData.class
+ ApplicationData.class,
+ OAuthClientData.class
};
private final MongoClient mongoClient;
diff --git a/services/src/main/java/org/keycloak/services/models/nosql/keycloak/adapters/NoSQLSession.java b/model/mongo/src/main/java/org/keycloak/models/mongo/keycloak/adapters/NoSQLSession.java
similarity index 72%
rename from services/src/main/java/org/keycloak/services/models/nosql/keycloak/adapters/NoSQLSession.java
rename to model/mongo/src/main/java/org/keycloak/models/mongo/keycloak/adapters/NoSQLSession.java
index 71cd3a1e58..2bc413de5f 100644
--- a/services/src/main/java/org/keycloak/services/models/nosql/keycloak/adapters/NoSQLSession.java
+++ b/model/mongo/src/main/java/org/keycloak/models/mongo/keycloak/adapters/NoSQLSession.java
@@ -1,19 +1,16 @@
-package org.keycloak.services.models.nosql.keycloak.adapters;
+package org.keycloak.models.mongo.keycloak.adapters;
import java.util.ArrayList;
import java.util.List;
-import org.jboss.resteasy.spi.NotImplementedYetException;
-import org.keycloak.services.models.KeycloakSession;
-import org.keycloak.services.models.KeycloakTransaction;
-import org.keycloak.services.models.RealmModel;
-import org.keycloak.services.models.UserModel;
-import org.keycloak.services.models.nosql.api.query.NoSQLQuery;
-import org.keycloak.services.models.nosql.api.query.NoSQLQueryBuilder;
-import org.keycloak.services.models.nosql.impl.MongoDBQueryBuilder;
-import org.keycloak.services.models.nosql.keycloak.data.RealmData;
-import org.keycloak.services.models.nosql.api.NoSQL;
-import org.keycloak.services.models.picketlink.PicketlinkKeycloakSession;
+import org.keycloak.models.KeycloakSession;
+import org.keycloak.models.KeycloakTransaction;
+import org.keycloak.models.RealmModel;
+import org.keycloak.models.UserModel;
+import org.keycloak.models.mongo.api.query.NoSQLQuery;
+import org.keycloak.models.mongo.keycloak.data.RealmData;
+import org.keycloak.models.mongo.api.NoSQL;
+import org.keycloak.models.utils.KeycloakSessionUtils;
/**
* @author Marek Posolda
@@ -38,7 +35,7 @@ public class NoSQLSession implements KeycloakSession {
@Override
public RealmModel createRealm(String name) {
- return createRealm(PicketlinkKeycloakSession.generateId(), name);
+ return createRealm(KeycloakSessionUtils.generateId(), name);
}
@Override
diff --git a/services/src/main/java/org/keycloak/services/models/nosql/keycloak/adapters/NoSQLTransaction.java b/model/mongo/src/main/java/org/keycloak/models/mongo/keycloak/adapters/NoSQLTransaction.java
similarity index 88%
rename from services/src/main/java/org/keycloak/services/models/nosql/keycloak/adapters/NoSQLTransaction.java
rename to model/mongo/src/main/java/org/keycloak/models/mongo/keycloak/adapters/NoSQLTransaction.java
index 2842852d6b..3d166357ae 100644
--- a/services/src/main/java/org/keycloak/services/models/nosql/keycloak/adapters/NoSQLTransaction.java
+++ b/model/mongo/src/main/java/org/keycloak/models/mongo/keycloak/adapters/NoSQLTransaction.java
@@ -1,6 +1,6 @@
-package org.keycloak.services.models.nosql.keycloak.adapters;
+package org.keycloak.models.mongo.keycloak.adapters;
-import org.keycloak.services.models.KeycloakTransaction;
+import org.keycloak.models.KeycloakTransaction;
/**
* @author Marek Posolda
diff --git a/model/mongo/src/main/java/org/keycloak/models/mongo/keycloak/adapters/OAuthClientAdapter.java b/model/mongo/src/main/java/org/keycloak/models/mongo/keycloak/adapters/OAuthClientAdapter.java
new file mode 100644
index 0000000000..d79b0a1782
--- /dev/null
+++ b/model/mongo/src/main/java/org/keycloak/models/mongo/keycloak/adapters/OAuthClientAdapter.java
@@ -0,0 +1,43 @@
+package org.keycloak.models.mongo.keycloak.adapters;
+
+import org.keycloak.models.OAuthClientModel;
+import org.keycloak.models.UserModel;
+import org.keycloak.models.mongo.api.NoSQL;
+import org.keycloak.models.mongo.keycloak.data.OAuthClientData;
+
+/**
+ * @author Marek Posolda
+ */
+public class OAuthClientAdapter implements OAuthClientModel {
+
+ private final OAuthClientData delegate;
+ private final UserAdapter oauthAgent;
+ private final NoSQL noSQL;
+
+ public OAuthClientAdapter(OAuthClientData oauthClientData, UserAdapter oauthAgent, NoSQL noSQL) {
+ this.delegate = oauthClientData;
+ this.oauthAgent = oauthAgent;
+ this.noSQL = noSQL;
+ }
+
+ @Override
+ public String getId() {
+ return delegate.getId();
+ }
+
+ @Override
+ public UserModel getOAuthAgent() {
+ return oauthAgent;
+ }
+
+ @Override
+ public String getBaseUrl() {
+ return delegate.getBaseUrl();
+ }
+
+ @Override
+ public void setBaseUrl(String base) {
+ delegate.setBaseUrl(base);
+ noSQL.saveObject(delegate);
+ }
+}
diff --git a/services/src/main/java/org/keycloak/services/models/nosql/keycloak/adapters/RealmAdapter.java b/model/mongo/src/main/java/org/keycloak/models/mongo/keycloak/adapters/RealmAdapter.java
similarity index 83%
rename from services/src/main/java/org/keycloak/services/models/nosql/keycloak/adapters/RealmAdapter.java
rename to model/mongo/src/main/java/org/keycloak/models/mongo/keycloak/adapters/RealmAdapter.java
index 4d613d50c4..73fcf3aaf1 100644
--- a/services/src/main/java/org/keycloak/services/models/nosql/keycloak/adapters/RealmAdapter.java
+++ b/model/mongo/src/main/java/org/keycloak/models/mongo/keycloak/adapters/RealmAdapter.java
@@ -1,4 +1,4 @@
-package org.keycloak.services.models.nosql.keycloak.adapters;
+package org.keycloak.models.mongo.keycloak.adapters;
import java.io.IOException;
import java.io.StringWriter;
@@ -12,28 +12,30 @@ import java.util.Map;
import java.util.Set;
import org.bouncycastle.openssl.PEMWriter;
-import org.jboss.resteasy.security.PemUtils;
+import org.keycloak.PemUtils;
+import org.keycloak.models.ApplicationModel;
+import org.keycloak.models.OAuthClientModel;
+import org.keycloak.models.RealmModel;
+import org.keycloak.models.RequiredCredentialModel;
+import org.keycloak.models.RoleModel;
+import org.keycloak.models.SocialLinkModel;
+import org.keycloak.models.UserCredentialModel;
+import org.keycloak.models.UserModel;
+import org.keycloak.models.mongo.api.query.NoSQLQueryBuilder;
+import org.keycloak.models.mongo.keycloak.data.OAuthClientData;
import org.keycloak.representations.idm.CredentialRepresentation;
-import org.keycloak.services.models.ApplicationModel;
-import org.keycloak.services.models.RealmModel;
-import org.keycloak.services.models.RequiredCredentialModel;
-import org.keycloak.services.models.RoleModel;
-import org.keycloak.services.models.SocialLinkModel;
-import org.keycloak.services.models.UserCredentialModel;
-import org.keycloak.services.models.UserModel;
-import org.keycloak.services.models.nosql.api.NoSQL;
-import org.keycloak.services.models.nosql.api.query.NoSQLQuery;
-import org.keycloak.services.models.nosql.keycloak.credentials.PasswordCredentialHandler;
-import org.keycloak.services.models.nosql.keycloak.credentials.TOTPCredentialHandler;
-import org.keycloak.services.models.nosql.keycloak.data.ApplicationData;
-import org.keycloak.services.models.nosql.keycloak.data.RealmData;
-import org.keycloak.services.models.nosql.keycloak.data.RequiredCredentialData;
-import org.keycloak.services.models.nosql.keycloak.data.RoleData;
-import org.keycloak.services.models.nosql.keycloak.data.SocialLinkData;
-import org.keycloak.services.models.nosql.keycloak.data.UserData;
+import org.keycloak.models.mongo.api.NoSQL;
+import org.keycloak.models.mongo.api.query.NoSQLQuery;
+import org.keycloak.models.mongo.keycloak.credentials.PasswordCredentialHandler;
+import org.keycloak.models.mongo.keycloak.credentials.TOTPCredentialHandler;
+import org.keycloak.models.mongo.keycloak.data.ApplicationData;
+import org.keycloak.models.mongo.keycloak.data.RealmData;
+import org.keycloak.models.mongo.keycloak.data.RequiredCredentialData;
+import org.keycloak.models.mongo.keycloak.data.RoleData;
+import org.keycloak.models.mongo.keycloak.data.SocialLinkData;
+import org.keycloak.models.mongo.keycloak.data.UserData;
import org.picketlink.idm.credential.Credentials;
-import org.picketlink.idm.credential.Password;
-import org.picketlink.idm.credential.TOTPCredentials;
+import org.picketlink.idm.model.sample.User;
/**
* @author Marek Posolda
@@ -152,6 +154,17 @@ public class RealmAdapter implements RealmModel {
updateRealm();
}
+ @Override
+ public boolean isResetPasswordAllowed() {
+ return realm.isResetPasswordAllowed();
+ }
+
+ @Override
+ public void setResetPasswordAllowed(boolean resetPassword) {
+ realm.setResetPasswordAllowed(resetPassword);
+ updateRealm();
+ }
+
@Override
public int getTokenLifespan() {
return realm.getTokenLifespan();
@@ -290,6 +303,7 @@ public class RealmAdapter implements RealmModel {
UserData userData = new UserData();
userData.setLoginName(username);
+ userData.setEnabled(true);
userData.setRealmId(getOid());
noSQL.saveObject(userData);
@@ -405,7 +419,7 @@ public class RealmAdapter implements RealmModel {
}
@Override
- public Map getResourceNameMap() {
+ public Map getApplicationNameMap() {
Map resourceMap = new HashMap();
for (ApplicationModel resource : getApplications()) {
resourceMap.put(resource.getName(), resource);
@@ -439,7 +453,7 @@ public class RealmAdapter implements RealmModel {
ApplicationModel resource = new ApplicationAdapter(appData, noSQL);
resource.addRole("*");
- resource.addScope(resourceUser, "*");
+ resource.addScopeMapping(resourceUser, "*");
return resource;
}
@@ -466,16 +480,22 @@ public class RealmAdapter implements RealmModel {
}
@Override
- public Set getRoleMappings(UserModel user) {
- UserData userData = ((UserAdapter)user).getUser();
- List roleIds = userData.getRoleIds();
+ public List getRoleMappings(UserModel user) {
+ List result = new ArrayList();
+ List roles = ApplicationAdapter.getAllRolesOfUser(user, noSQL);
+ // TODO: Maybe improve as currently we need to obtain all roles and then filter programmatically...
+ for (RoleData role : roles) {
+ if (getOid().equals(role.getRealmId())) {
+ result.add(new RoleAdapter(role, noSQL));
+ }
+ }
+ return result;
+ }
+ @Override
+ public Set getRoleMappingValues(UserModel user) {
Set result = new HashSet();
-
- NoSQLQuery query = noSQL.createQueryBuilder()
- .inCondition("_id", roleIds)
- .build();
- List roles = noSQL.loadObjects(RoleData.class, query);
+ List roles = ApplicationAdapter.getAllRolesOfUser(user, noSQL);
// TODO: Maybe improve as currently we need to obtain all roles and then filter programmatically...
for (RoleData role : roles) {
if (getOid().equals(role.getRealmId())) {
@@ -486,7 +506,13 @@ public class RealmAdapter implements RealmModel {
}
@Override
- public void addScope(UserModel agent, String roleName) {
+ public void deleteRoleMapping(UserModel user, RoleModel role) {
+ UserData userData = ((UserAdapter)user).getUser();
+ noSQL.pullItemFromList(userData, "roleIds", role.getId());
+ }
+
+ @Override
+ public void addScopeMapping(UserModel agent, String roleName) {
UserData userData = ((UserAdapter)agent).getUser();
RoleAdapter role = getRole(roleName);
if (role == null) {
@@ -497,7 +523,31 @@ public class RealmAdapter implements RealmModel {
}
@Override
- public Set getScope(UserModel agent) {
+ public OAuthClientModel addOAuthClient(String name) {
+ UserAdapter oauthAgent = addUser(name);
+
+ OAuthClientData oauthClient = new OAuthClientData();
+ oauthClient.setOauthAgentId(oauthAgent.getUser().getId());
+ oauthClient.setRealmId(getOid());
+ noSQL.saveObject(oauthClient);
+
+ return new OAuthClientAdapter(oauthClient, oauthAgent, noSQL);
+ }
+
+ @Override
+ public OAuthClientModel getOAuthClient(String name) {
+ UserAdapter user = getUser(name);
+ if (user == null) return null;
+ NoSQLQuery query = noSQL.createQueryBuilder()
+ .andCondition("realmId", getOid())
+ .andCondition("oauthAgentId", user.getUser().getId())
+ .build();
+ OAuthClientData oauthClient = noSQL.loadSingleObject(OAuthClientData.class, query);
+ return oauthClient == null ? null : new OAuthClientAdapter(oauthClient, user, noSQL);
+ }
+
+ @Override
+ public Set getScopeMapping(UserModel agent) {
UserData userData = ((UserAdapter)agent).getUser();
List scopeIds = userData.getScopeIds();
@@ -755,4 +805,28 @@ public class RealmAdapter implements RealmModel {
}
return model;
}
+
+ @Override
+ public List searchForUserByAttributes(Map attributes) {
+ NoSQLQueryBuilder queryBuilder = noSQL.createQueryBuilder();
+ for (Map.Entry entry : attributes.entrySet()) {
+ if (entry.getKey().equals(UserModel.LOGIN_NAME)) {
+ queryBuilder.andCondition("loginName", entry.getValue());
+ } else if (entry.getKey().equalsIgnoreCase(UserModel.FIRST_NAME)) {
+ queryBuilder.andCondition(UserModel.FIRST_NAME, entry.getValue());
+
+ } else if (entry.getKey().equalsIgnoreCase(UserModel.LAST_NAME)) {
+ queryBuilder.andCondition(UserModel.LAST_NAME, entry.getValue());
+
+ } else if (entry.getKey().equalsIgnoreCase(UserModel.EMAIL)) {
+ queryBuilder.andCondition(UserModel.EMAIL, entry.getValue());
+ }
+ }
+ List users = noSQL.loadObjects(UserData.class, queryBuilder.build());
+ List userModels = new ArrayList();
+ for (UserData user : users) {
+ userModels.add(new UserAdapter(user, noSQL));
+ }
+ return userModels;
+ }
}
diff --git a/services/src/main/java/org/keycloak/services/models/nosql/keycloak/adapters/RoleAdapter.java b/model/mongo/src/main/java/org/keycloak/models/mongo/keycloak/adapters/RoleAdapter.java
similarity index 81%
rename from services/src/main/java/org/keycloak/services/models/nosql/keycloak/adapters/RoleAdapter.java
rename to model/mongo/src/main/java/org/keycloak/models/mongo/keycloak/adapters/RoleAdapter.java
index 9c3f1394b0..7b2692f42c 100644
--- a/services/src/main/java/org/keycloak/services/models/nosql/keycloak/adapters/RoleAdapter.java
+++ b/model/mongo/src/main/java/org/keycloak/models/mongo/keycloak/adapters/RoleAdapter.java
@@ -1,8 +1,8 @@
-package org.keycloak.services.models.nosql.keycloak.adapters;
+package org.keycloak.models.mongo.keycloak.adapters;
-import org.keycloak.services.models.RoleModel;
-import org.keycloak.services.models.nosql.api.NoSQL;
-import org.keycloak.services.models.nosql.keycloak.data.RoleData;
+import org.keycloak.models.RoleModel;
+import org.keycloak.models.mongo.api.NoSQL;
+import org.keycloak.models.mongo.keycloak.data.RoleData;
/**
* Wrapper around RoleData object, which will persist wrapped object after each set operation (compatibility with picketlink based impl)
diff --git a/services/src/main/java/org/keycloak/services/models/nosql/keycloak/adapters/UserAdapter.java b/model/mongo/src/main/java/org/keycloak/models/mongo/keycloak/adapters/UserAdapter.java
similarity index 78%
rename from services/src/main/java/org/keycloak/services/models/nosql/keycloak/adapters/UserAdapter.java
rename to model/mongo/src/main/java/org/keycloak/models/mongo/keycloak/adapters/UserAdapter.java
index 24c3a29c18..06e70cf679 100644
--- a/services/src/main/java/org/keycloak/services/models/nosql/keycloak/adapters/UserAdapter.java
+++ b/model/mongo/src/main/java/org/keycloak/models/mongo/keycloak/adapters/UserAdapter.java
@@ -1,11 +1,14 @@
-package org.keycloak.services.models.nosql.keycloak.adapters;
+package org.keycloak.models.mongo.keycloak.adapters;
+import java.util.Collections;
+import java.util.HashSet;
import java.util.List;
import java.util.Map;
+import java.util.Set;
-import org.keycloak.services.models.UserModel;
-import org.keycloak.services.models.nosql.api.NoSQL;
-import org.keycloak.services.models.nosql.keycloak.data.UserData;
+import org.keycloak.models.UserModel;
+import org.keycloak.models.mongo.api.NoSQL;
+import org.keycloak.models.mongo.keycloak.data.UserData;
/**
* Wrapper around UserData object, which will persist wrapped object after each set operation (compatibility with picketlink based impl)
@@ -33,17 +36,11 @@ public class UserAdapter implements UserModel {
}
@Override
- public void setStatus(Status status) {
- user.setStatus(status);
+ public void setEnabled(boolean enabled) {
+ user.setEnabled(enabled);
noSQL.saveObject(user);
}
- @Override
- public Status getStatus() {
- Status status = user.getStatus();
- return status != null ? status : Status.ENABLED;
- }
-
@Override
public String getFirstName() {
return user.getFirstName();
@@ -114,15 +111,19 @@ public class UserAdapter implements UserModel {
}
@Override
- public List getRequiredActions() {
- List requiredActions = user.getRequiredActions();
+ public Set getRequiredActions() {
+ List actions = user.getRequiredActions();
// Compatibility with picketlink impl
- if (requiredActions == null || requiredActions.size() == 0) {
- return null;
+ if (actions == null) {
+ return Collections.emptySet();
+ } else {
+ Set s = new HashSet();
+ for (RequiredAction a : actions) {
+ s.add(a);
+ }
+ return Collections.unmodifiableSet(s);
}
-
- return requiredActions;
}
@Override
diff --git a/services/src/main/java/org/keycloak/services/models/nosql/keycloak/credentials/PasswordCredentialHandler.java b/model/mongo/src/main/java/org/keycloak/models/mongo/keycloak/credentials/PasswordCredentialHandler.java
similarity index 93%
rename from services/src/main/java/org/keycloak/services/models/nosql/keycloak/credentials/PasswordCredentialHandler.java
rename to model/mongo/src/main/java/org/keycloak/models/mongo/keycloak/credentials/PasswordCredentialHandler.java
index 52d706e7f6..a2f61c9811 100644
--- a/services/src/main/java/org/keycloak/services/models/nosql/keycloak/credentials/PasswordCredentialHandler.java
+++ b/model/mongo/src/main/java/org/keycloak/models/mongo/keycloak/credentials/PasswordCredentialHandler.java
@@ -1,13 +1,13 @@
-package org.keycloak.services.models.nosql.keycloak.credentials;
+package org.keycloak.models.mongo.keycloak.credentials;
import java.util.Date;
import java.util.Map;
import java.util.UUID;
-import org.keycloak.services.models.nosql.api.NoSQL;
-import org.keycloak.services.models.nosql.api.query.NoSQLQuery;
-import org.keycloak.services.models.nosql.keycloak.data.UserData;
-import org.keycloak.services.models.nosql.keycloak.data.credentials.PasswordData;
+import org.keycloak.models.mongo.api.NoSQL;
+import org.keycloak.models.mongo.api.query.NoSQLQuery;
+import org.keycloak.models.mongo.keycloak.data.UserData;
+import org.keycloak.models.mongo.keycloak.data.credentials.PasswordData;
import org.picketlink.idm.credential.Credentials;
import org.picketlink.idm.credential.encoder.PasswordEncoder;
import org.picketlink.idm.credential.encoder.SHAPasswordEncoder;
diff --git a/services/src/main/java/org/keycloak/services/models/nosql/keycloak/credentials/TOTPCredentialHandler.java b/model/mongo/src/main/java/org/keycloak/models/mongo/keycloak/credentials/TOTPCredentialHandler.java
similarity index 94%
rename from services/src/main/java/org/keycloak/services/models/nosql/keycloak/credentials/TOTPCredentialHandler.java
rename to model/mongo/src/main/java/org/keycloak/models/mongo/keycloak/credentials/TOTPCredentialHandler.java
index 84b5f0a5e3..b8f02e7d6e 100644
--- a/services/src/main/java/org/keycloak/services/models/nosql/keycloak/credentials/TOTPCredentialHandler.java
+++ b/model/mongo/src/main/java/org/keycloak/models/mongo/keycloak/credentials/TOTPCredentialHandler.java
@@ -1,12 +1,12 @@
-package org.keycloak.services.models.nosql.keycloak.credentials;
+package org.keycloak.models.mongo.keycloak.credentials;
import java.util.Date;
import java.util.Map;
-import org.keycloak.services.models.nosql.api.NoSQL;
-import org.keycloak.services.models.nosql.api.query.NoSQLQuery;
-import org.keycloak.services.models.nosql.keycloak.data.UserData;
-import org.keycloak.services.models.nosql.keycloak.data.credentials.OTPData;
+import org.keycloak.models.mongo.api.NoSQL;
+import org.keycloak.models.mongo.api.query.NoSQLQuery;
+import org.keycloak.models.mongo.keycloak.data.UserData;
+import org.keycloak.models.mongo.keycloak.data.credentials.OTPData;
import org.picketlink.idm.credential.Credentials;
import org.picketlink.idm.credential.util.TimeBasedOTP;
diff --git a/services/src/main/java/org/keycloak/services/models/nosql/keycloak/data/ApplicationData.java b/model/mongo/src/main/java/org/keycloak/models/mongo/keycloak/data/ApplicationData.java
similarity index 79%
rename from services/src/main/java/org/keycloak/services/models/nosql/keycloak/data/ApplicationData.java
rename to model/mongo/src/main/java/org/keycloak/models/mongo/keycloak/data/ApplicationData.java
index 108f1d0e51..5ceb788dbb 100644
--- a/services/src/main/java/org/keycloak/services/models/nosql/keycloak/data/ApplicationData.java
+++ b/model/mongo/src/main/java/org/keycloak/models/mongo/keycloak/data/ApplicationData.java
@@ -1,11 +1,11 @@
-package org.keycloak.services.models.nosql.keycloak.data;
+package org.keycloak.models.mongo.keycloak.data;
-import org.keycloak.services.models.nosql.api.NoSQL;
-import org.keycloak.services.models.nosql.api.NoSQLCollection;
-import org.keycloak.services.models.nosql.api.NoSQLField;
-import org.keycloak.services.models.nosql.api.NoSQLId;
-import org.keycloak.services.models.nosql.api.NoSQLObject;
-import org.keycloak.services.models.nosql.api.query.NoSQLQuery;
+import org.keycloak.models.mongo.api.NoSQL;
+import org.keycloak.models.mongo.api.NoSQLCollection;
+import org.keycloak.models.mongo.api.NoSQLField;
+import org.keycloak.models.mongo.api.NoSQLId;
+import org.keycloak.models.mongo.api.NoSQLObject;
+import org.keycloak.models.mongo.api.query.NoSQLQuery;
/**
* @author Marek Posolda
@@ -18,6 +18,7 @@ public class ApplicationData implements NoSQLObject {
private boolean enabled;
private boolean surrogateAuthRequired;
private String managementUrl;
+ private String baseUrl;
private String resourceUserId;
private String realmId;
@@ -67,6 +68,15 @@ public class ApplicationData implements NoSQLObject {
this.managementUrl = managementUrl;
}
+ @NoSQLField
+ public String getBaseUrl() {
+ return baseUrl;
+ }
+
+ public void setBaseUrl(String baseUrl) {
+ this.baseUrl = baseUrl;
+ }
+
@NoSQLField
public String getResourceUserId() {
return resourceUserId;
diff --git a/model/mongo/src/main/java/org/keycloak/models/mongo/keycloak/data/OAuthClientData.java b/model/mongo/src/main/java/org/keycloak/models/mongo/keycloak/data/OAuthClientData.java
new file mode 100644
index 0000000000..67f74ee6a3
--- /dev/null
+++ b/model/mongo/src/main/java/org/keycloak/models/mongo/keycloak/data/OAuthClientData.java
@@ -0,0 +1,62 @@
+package org.keycloak.models.mongo.keycloak.data;
+
+import org.keycloak.models.mongo.api.NoSQL;
+import org.keycloak.models.mongo.api.NoSQLCollection;
+import org.keycloak.models.mongo.api.NoSQLField;
+import org.keycloak.models.mongo.api.NoSQLId;
+import org.keycloak.models.mongo.api.NoSQLObject;
+
+/**
+ * @author Marek Posolda
+ */
+@NoSQLCollection(collectionName = "oauthClients")
+public class OAuthClientData implements NoSQLObject {
+
+ private String id;
+ private String baseUrl;
+
+ private String oauthAgentId;
+ private String realmId;
+
+ @NoSQLId
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ @NoSQLField
+ public String getBaseUrl() {
+ return baseUrl;
+ }
+
+ public void setBaseUrl(String baseUrl) {
+ this.baseUrl = baseUrl;
+ }
+
+ @NoSQLField
+ public String getOauthAgentId() {
+ return oauthAgentId;
+ }
+
+ public void setOauthAgentId(String oauthUserId) {
+ this.oauthAgentId = oauthUserId;
+ }
+
+ @NoSQLField
+ public String getRealmId() {
+ return realmId;
+ }
+
+ public void setRealmId(String realmId) {
+ this.realmId = realmId;
+ }
+
+ @Override
+ public void afterRemove(NoSQL noSQL) {
+ // Remove user of this oauthClient
+ noSQL.removeObject(UserData.class, oauthAgentId);
+ }
+}
diff --git a/services/src/main/java/org/keycloak/services/models/nosql/keycloak/data/RealmData.java b/model/mongo/src/main/java/org/keycloak/models/mongo/keycloak/data/RealmData.java
similarity index 88%
rename from services/src/main/java/org/keycloak/services/models/nosql/keycloak/data/RealmData.java
rename to model/mongo/src/main/java/org/keycloak/models/mongo/keycloak/data/RealmData.java
index 70d0a511a5..5247d60034 100644
--- a/services/src/main/java/org/keycloak/services/models/nosql/keycloak/data/RealmData.java
+++ b/model/mongo/src/main/java/org/keycloak/models/mongo/keycloak/data/RealmData.java
@@ -1,16 +1,13 @@
-package org.keycloak.services.models.nosql.keycloak.data;
+package org.keycloak.models.mongo.keycloak.data;
-import java.security.SecureRandom;
import java.util.List;
-import java.util.Random;
-import java.util.UUID;
-import org.keycloak.services.models.nosql.api.NoSQL;
-import org.keycloak.services.models.nosql.api.NoSQLCollection;
-import org.keycloak.services.models.nosql.api.NoSQLField;
-import org.keycloak.services.models.nosql.api.NoSQLId;
-import org.keycloak.services.models.nosql.api.NoSQLObject;
-import org.keycloak.services.models.nosql.api.query.NoSQLQuery;
+import org.keycloak.models.mongo.api.NoSQL;
+import org.keycloak.models.mongo.api.NoSQLCollection;
+import org.keycloak.models.mongo.api.NoSQLField;
+import org.keycloak.models.mongo.api.NoSQLId;
+import org.keycloak.models.mongo.api.NoSQLObject;
+import org.keycloak.models.mongo.api.query.NoSQLQuery;
/**
* @author Marek Posolda
@@ -27,6 +24,7 @@ public class RealmData implements NoSQLObject {
private boolean cookieLoginAllowed;
private boolean registrationAllowed;
private boolean verifyEmail;
+ private boolean resetPasswordAllowed;
private boolean social;
private boolean automaticRegistrationAfterSocialLogin;
private int tokenLifespan;
@@ -110,6 +108,15 @@ public class RealmData implements NoSQLObject {
this.verifyEmail = verifyEmail;
}
+ @NoSQLField
+ public boolean isResetPasswordAllowed() {
+ return resetPasswordAllowed;
+ }
+
+ public void setResetPasswordAllowed(boolean resetPasswordAllowed) {
+ this.resetPasswordAllowed = resetPasswordAllowed;
+ }
+
@NoSQLField
public boolean isSocial() {
return social;
diff --git a/services/src/main/java/org/keycloak/services/models/nosql/keycloak/data/RequiredCredentialData.java b/model/mongo/src/main/java/org/keycloak/models/mongo/keycloak/data/RequiredCredentialData.java
similarity index 82%
rename from services/src/main/java/org/keycloak/services/models/nosql/keycloak/data/RequiredCredentialData.java
rename to model/mongo/src/main/java/org/keycloak/models/mongo/keycloak/data/RequiredCredentialData.java
index 124e507113..e46ee9fd07 100644
--- a/services/src/main/java/org/keycloak/services/models/nosql/keycloak/data/RequiredCredentialData.java
+++ b/model/mongo/src/main/java/org/keycloak/models/mongo/keycloak/data/RequiredCredentialData.java
@@ -1,10 +1,9 @@
-package org.keycloak.services.models.nosql.keycloak.data;
+package org.keycloak.models.mongo.keycloak.data;
-import org.keycloak.services.models.nosql.api.AbstractNoSQLObject;
-import org.keycloak.services.models.nosql.api.NoSQLCollection;
-import org.keycloak.services.models.nosql.api.NoSQLField;
-import org.keycloak.services.models.nosql.api.NoSQLId;
-import org.keycloak.services.models.nosql.api.NoSQLObject;
+import org.keycloak.models.mongo.api.AbstractNoSQLObject;
+import org.keycloak.models.mongo.api.NoSQLCollection;
+import org.keycloak.models.mongo.api.NoSQLField;
+import org.keycloak.models.mongo.api.NoSQLId;
/**
* @author Marek Posolda
diff --git a/services/src/main/java/org/keycloak/services/models/nosql/keycloak/data/RoleData.java b/model/mongo/src/main/java/org/keycloak/models/mongo/keycloak/data/RoleData.java
similarity index 82%
rename from services/src/main/java/org/keycloak/services/models/nosql/keycloak/data/RoleData.java
rename to model/mongo/src/main/java/org/keycloak/models/mongo/keycloak/data/RoleData.java
index 49483a125f..29bc1f8930 100644
--- a/services/src/main/java/org/keycloak/services/models/nosql/keycloak/data/RoleData.java
+++ b/model/mongo/src/main/java/org/keycloak/models/mongo/keycloak/data/RoleData.java
@@ -1,14 +1,14 @@
-package org.keycloak.services.models.nosql.keycloak.data;
+package org.keycloak.models.mongo.keycloak.data;
import java.util.List;
-import org.jboss.resteasy.logging.Logger;
-import org.keycloak.services.models.nosql.api.NoSQL;
-import org.keycloak.services.models.nosql.api.NoSQLCollection;
-import org.keycloak.services.models.nosql.api.NoSQLField;
-import org.keycloak.services.models.nosql.api.NoSQLId;
-import org.keycloak.services.models.nosql.api.NoSQLObject;
-import org.keycloak.services.models.nosql.api.query.NoSQLQuery;
+import org.jboss.logging.Logger;
+import org.keycloak.models.mongo.api.NoSQL;
+import org.keycloak.models.mongo.api.NoSQLCollection;
+import org.keycloak.models.mongo.api.NoSQLField;
+import org.keycloak.models.mongo.api.NoSQLId;
+import org.keycloak.models.mongo.api.NoSQLObject;
+import org.keycloak.models.mongo.api.query.NoSQLQuery;
/**
* @author Marek Posolda
diff --git a/services/src/main/java/org/keycloak/services/models/nosql/keycloak/data/SocialLinkData.java b/model/mongo/src/main/java/org/keycloak/models/mongo/keycloak/data/SocialLinkData.java
similarity index 77%
rename from services/src/main/java/org/keycloak/services/models/nosql/keycloak/data/SocialLinkData.java
rename to model/mongo/src/main/java/org/keycloak/models/mongo/keycloak/data/SocialLinkData.java
index 46b1c2622d..37ea43d44e 100644
--- a/services/src/main/java/org/keycloak/services/models/nosql/keycloak/data/SocialLinkData.java
+++ b/model/mongo/src/main/java/org/keycloak/models/mongo/keycloak/data/SocialLinkData.java
@@ -1,10 +1,8 @@
-package org.keycloak.services.models.nosql.keycloak.data;
+package org.keycloak.models.mongo.keycloak.data;
-import org.keycloak.services.models.nosql.api.AbstractNoSQLObject;
-import org.keycloak.services.models.nosql.api.NoSQLCollection;
-import org.keycloak.services.models.nosql.api.NoSQLField;
-import org.keycloak.services.models.nosql.api.NoSQLId;
-import org.keycloak.services.models.nosql.api.NoSQLObject;
+import org.keycloak.models.mongo.api.AbstractNoSQLObject;
+import org.keycloak.models.mongo.api.NoSQLCollection;
+import org.keycloak.models.mongo.api.NoSQLField;
/**
* @author Marek Posolda
diff --git a/services/src/main/java/org/keycloak/services/models/nosql/keycloak/data/UserData.java b/model/mongo/src/main/java/org/keycloak/models/mongo/keycloak/data/UserData.java
similarity index 80%
rename from services/src/main/java/org/keycloak/services/models/nosql/keycloak/data/UserData.java
rename to model/mongo/src/main/java/org/keycloak/models/mongo/keycloak/data/UserData.java
index 6206289adb..cfeb67d6d1 100644
--- a/services/src/main/java/org/keycloak/services/models/nosql/keycloak/data/UserData.java
+++ b/model/mongo/src/main/java/org/keycloak/models/mongo/keycloak/data/UserData.java
@@ -1,16 +1,16 @@
-package org.keycloak.services.models.nosql.keycloak.data;
+package org.keycloak.models.mongo.keycloak.data;
import java.util.List;
-import org.jboss.resteasy.logging.Logger;
-import org.keycloak.services.models.UserModel;
-import org.keycloak.services.models.nosql.api.AbstractAttributedNoSQLObject;
-import org.keycloak.services.models.nosql.api.NoSQL;
-import org.keycloak.services.models.nosql.api.NoSQLCollection;
-import org.keycloak.services.models.nosql.api.NoSQLField;
-import org.keycloak.services.models.nosql.api.NoSQLId;
-import org.keycloak.services.models.nosql.api.query.NoSQLQuery;
-import org.keycloak.services.models.nosql.keycloak.data.credentials.PasswordData;
+import org.jboss.logging.Logger;
+import org.keycloak.models.UserModel;
+import org.keycloak.models.mongo.api.AbstractAttributedNoSQLObject;
+import org.keycloak.models.mongo.api.NoSQL;
+import org.keycloak.models.mongo.api.NoSQLCollection;
+import org.keycloak.models.mongo.api.NoSQLField;
+import org.keycloak.models.mongo.api.NoSQLId;
+import org.keycloak.models.mongo.api.query.NoSQLQuery;
+import org.keycloak.models.mongo.keycloak.data.credentials.PasswordData;
/**
* @author Marek Posolda
@@ -27,7 +27,7 @@ public class UserData extends AbstractAttributedNoSQLObject {
private String email;
private boolean emailVerified;
private boolean totp;
- private UserModel.Status status;
+ private boolean enabled;
private String realmId;
@@ -89,8 +89,13 @@ public class UserData extends AbstractAttributedNoSQLObject {
this.emailVerified = emailVerified;
}
+ @NoSQLField
public boolean isEnabled() {
- return !UserModel.Status.DISABLED.equals(getStatus());
+ return enabled;
+ }
+
+ public void setEnabled(boolean enabled) {
+ this.enabled = enabled;
}
@NoSQLField
@@ -102,15 +107,6 @@ public class UserData extends AbstractAttributedNoSQLObject {
this.totp = totp;
}
- @NoSQLField
- public UserModel.Status getStatus() {
- return status;
- }
-
- public void setStatus(UserModel.Status status) {
- this.status = status;
- }
-
@NoSQLField
public String getRealmId() {
return realmId;
diff --git a/services/src/main/java/org/keycloak/services/models/nosql/keycloak/data/credentials/OTPData.java b/model/mongo/src/main/java/org/keycloak/models/mongo/keycloak/data/credentials/OTPData.java
similarity index 82%
rename from services/src/main/java/org/keycloak/services/models/nosql/keycloak/data/credentials/OTPData.java
rename to model/mongo/src/main/java/org/keycloak/models/mongo/keycloak/data/credentials/OTPData.java
index cf4fef864f..8ab31a65fc 100644
--- a/services/src/main/java/org/keycloak/services/models/nosql/keycloak/data/credentials/OTPData.java
+++ b/model/mongo/src/main/java/org/keycloak/models/mongo/keycloak/data/credentials/OTPData.java
@@ -1,10 +1,10 @@
-package org.keycloak.services.models.nosql.keycloak.data.credentials;
+package org.keycloak.models.mongo.keycloak.data.credentials;
import java.util.Date;
-import org.keycloak.services.models.nosql.api.AbstractNoSQLObject;
-import org.keycloak.services.models.nosql.api.NoSQLCollection;
-import org.keycloak.services.models.nosql.api.NoSQLField;
+import org.keycloak.models.mongo.api.AbstractNoSQLObject;
+import org.keycloak.models.mongo.api.NoSQLCollection;
+import org.keycloak.models.mongo.api.NoSQLField;
/**
* @author Marek Posolda
diff --git a/services/src/main/java/org/keycloak/services/models/nosql/keycloak/data/credentials/PasswordData.java b/model/mongo/src/main/java/org/keycloak/models/mongo/keycloak/data/credentials/PasswordData.java
similarity index 76%
rename from services/src/main/java/org/keycloak/services/models/nosql/keycloak/data/credentials/PasswordData.java
rename to model/mongo/src/main/java/org/keycloak/models/mongo/keycloak/data/credentials/PasswordData.java
index 4834316b22..7480e1fb87 100644
--- a/services/src/main/java/org/keycloak/services/models/nosql/keycloak/data/credentials/PasswordData.java
+++ b/model/mongo/src/main/java/org/keycloak/models/mongo/keycloak/data/credentials/PasswordData.java
@@ -1,12 +1,10 @@
-package org.keycloak.services.models.nosql.keycloak.data.credentials;
+package org.keycloak.models.mongo.keycloak.data.credentials;
import java.util.Date;
-import org.keycloak.services.models.nosql.api.AbstractNoSQLObject;
-import org.keycloak.services.models.nosql.api.NoSQLCollection;
-import org.keycloak.services.models.nosql.api.NoSQLField;
-import org.keycloak.services.models.nosql.api.NoSQLId;
-import org.keycloak.services.models.nosql.api.NoSQLObject;
+import org.keycloak.models.mongo.api.AbstractNoSQLObject;
+import org.keycloak.models.mongo.api.NoSQLCollection;
+import org.keycloak.models.mongo.api.NoSQLField;
/**
* @author Marek Posolda
diff --git a/services/src/test/java/org/keycloak/test/nosql/Address.java b/model/mongo/src/test/java/org/keycloak/models/mongo/test/Address.java
similarity index 82%
rename from services/src/test/java/org/keycloak/test/nosql/Address.java
rename to model/mongo/src/test/java/org/keycloak/models/mongo/test/Address.java
index 8b56c595ae..8f6b6f885e 100644
--- a/services/src/test/java/org/keycloak/test/nosql/Address.java
+++ b/model/mongo/src/test/java/org/keycloak/models/mongo/test/Address.java
@@ -1,9 +1,9 @@
-package org.keycloak.test.nosql;
+package org.keycloak.models.mongo.test;
import java.util.List;
-import org.keycloak.services.models.nosql.api.AbstractNoSQLObject;
-import org.keycloak.services.models.nosql.api.NoSQLField;
+import org.keycloak.models.mongo.api.AbstractNoSQLObject;
+import org.keycloak.models.mongo.api.NoSQLField;
/**
* @author Marek Posolda
diff --git a/services/src/test/java/org/keycloak/test/nosql/MongoDBModelTest.java b/model/mongo/src/test/java/org/keycloak/models/mongo/test/MongoDBModelTest.java
similarity index 92%
rename from services/src/test/java/org/keycloak/test/nosql/MongoDBModelTest.java
rename to model/mongo/src/test/java/org/keycloak/models/mongo/test/MongoDBModelTest.java
index b59fdffe59..262ade855b 100644
--- a/services/src/test/java/org/keycloak/test/nosql/MongoDBModelTest.java
+++ b/model/mongo/src/test/java/org/keycloak/models/mongo/test/MongoDBModelTest.java
@@ -1,4 +1,4 @@
-package org.keycloak.test.nosql;
+package org.keycloak.models.mongo.test;
import java.net.UnknownHostException;
import java.util.ArrayList;
@@ -10,11 +10,10 @@ import com.mongodb.MongoClient;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
-import org.junit.Test;
-import org.keycloak.services.models.nosql.api.NoSQL;
-import org.keycloak.services.models.nosql.api.NoSQLObject;
-import org.keycloak.services.models.nosql.api.query.NoSQLQuery;
-import org.keycloak.services.models.nosql.impl.MongoDBImpl;
+import org.keycloak.models.mongo.api.NoSQL;
+import org.keycloak.models.mongo.api.NoSQLObject;
+import org.keycloak.models.mongo.api.query.NoSQLQuery;
+import org.keycloak.models.mongo.impl.MongoDBImpl;
/**
* @author Marek Posolda
diff --git a/services/src/test/java/org/keycloak/test/nosql/Person.java b/model/mongo/src/test/java/org/keycloak/models/mongo/test/Person.java
similarity index 86%
rename from services/src/test/java/org/keycloak/test/nosql/Person.java
rename to model/mongo/src/test/java/org/keycloak/models/mongo/test/Person.java
index 3ead51235f..ab2ded3844 100644
--- a/services/src/test/java/org/keycloak/test/nosql/Person.java
+++ b/model/mongo/src/test/java/org/keycloak/models/mongo/test/Person.java
@@ -1,11 +1,11 @@
-package org.keycloak.test.nosql;
+package org.keycloak.models.mongo.test;
import java.util.List;
-import org.keycloak.services.models.nosql.api.AbstractNoSQLObject;
-import org.keycloak.services.models.nosql.api.NoSQLCollection;
-import org.keycloak.services.models.nosql.api.NoSQLField;
-import org.keycloak.services.models.nosql.api.NoSQLId;
+import org.keycloak.models.mongo.api.AbstractNoSQLObject;
+import org.keycloak.models.mongo.api.NoSQLCollection;
+import org.keycloak.models.mongo.api.NoSQLField;
+import org.keycloak.models.mongo.api.NoSQLId;
/**
* @author Marek Posolda
diff --git a/model/picketlink/pom.xml b/model/picketlink/pom.xml
index a035b19a37..b42cd805ba 100755
--- a/model/picketlink/pom.xml
+++ b/model/picketlink/pom.xml
@@ -4,7 +4,7 @@
keycloak-parent
org.keycloak
1.0-alpha-1
- ../pom.xml
+ ../../pom.xml
4.0.0
diff --git a/model/picketlink/src/main/java/org/keycloak/models/picketlink/PicketlinkKeycloakSession.java b/model/picketlink/src/main/java/org/keycloak/models/picketlink/PicketlinkKeycloakSession.java
index 4139e03ee7..8e2a75d460 100755
--- a/model/picketlink/src/main/java/org/keycloak/models/picketlink/PicketlinkKeycloakSession.java
+++ b/model/picketlink/src/main/java/org/keycloak/models/picketlink/PicketlinkKeycloakSession.java
@@ -6,6 +6,7 @@ import org.keycloak.models.RealmModel;
import org.keycloak.models.UserModel;
import org.keycloak.models.picketlink.mappings.RealmData;
import org.keycloak.models.picketlink.relationships.RealmAdminRelationship;
+import org.keycloak.models.utils.KeycloakSessionUtils;
import org.picketlink.idm.PartitionManager;
import org.picketlink.idm.RelationshipManager;
import org.picketlink.idm.query.RelationshipQuery;
@@ -25,11 +26,6 @@ public class PicketlinkKeycloakSession implements KeycloakSession {
protected PartitionManager partitionManager;
protected EntityManager entityManager;
- private static AtomicLong counter = new AtomicLong(1);
- public static String generateId() {
- return counter.getAndIncrement() + "-" + System.currentTimeMillis();
- }
-
public PicketlinkKeycloakSession(PartitionManager partitionManager, EntityManager entityManager) {
this.partitionManager = partitionManager;
this.entityManager = entityManager;
@@ -50,7 +46,7 @@ public class PicketlinkKeycloakSession implements KeycloakSession {
@Override
public RealmAdapter createRealm(String name) {
- return createRealm(generateId(), name);
+ return createRealm(KeycloakSessionUtils.generateId(), name);
}
@Override
diff --git a/model/pom.xml b/model/pom.xml
index c6a4a9ef90..3d0b0dc31b 100755
--- a/model/pom.xml
+++ b/model/pom.xml
@@ -37,5 +37,6 @@
api
picketlink
jpa
+ mongo
diff --git a/pom.xml b/pom.xml
index 9ab5c51f5b..04b6ec76f2 100755
--- a/pom.xml
+++ b/pom.xml
@@ -18,6 +18,7 @@
3.6.6.Final
1.3.161
1.6.1
+ 5.1.25
1.6.1
@@ -295,7 +296,7 @@
mysql
mysql-connector-java
- 5.1.25
+ ${mysql.version}
diff --git a/services/pom.xml b/services/pom.xml
index b35bef4135..9cee9f509e 100755
--- a/services/pom.xml
+++ b/services/pom.xml
@@ -34,6 +34,12 @@
keycloak-model-picketlink
${project.version}
+
+
+ org.keycloak
+ keycloak-model-mongo
+ ${project.version}
+
org.keycloak
keycloak-social-core
diff --git a/services/src/main/java/org/keycloak/services/resources/KeycloakApplication.java b/services/src/main/java/org/keycloak/services/resources/KeycloakApplication.java
index fc82975224..a642bc9aa3 100755
--- a/services/src/main/java/org/keycloak/services/resources/KeycloakApplication.java
+++ b/services/src/main/java/org/keycloak/services/resources/KeycloakApplication.java
@@ -1,18 +1,13 @@
package org.keycloak.services.resources;
import org.keycloak.SkeletonKeyContextResolver;
+import org.keycloak.models.mongo.keycloak.adapters.MongoDBSessionFactory;
import org.keycloak.services.managers.TokenManager;
import org.keycloak.models.KeycloakSessionFactory;
import org.keycloak.models.picketlink.PicketlinkKeycloakSession;
import org.keycloak.models.picketlink.PicketlinkKeycloakSessionFactory;
import org.keycloak.models.picketlink.mappings.ApplicationEntity;
import org.keycloak.models.picketlink.mappings.RealmEntity;
-import org.keycloak.services.models.KeycloakSessionFactory;
-import org.keycloak.services.models.nosql.keycloak.adapters.MongoDBSessionFactory;
-import org.keycloak.services.models.picketlink.PicketlinkKeycloakSession;
-import org.keycloak.services.models.picketlink.PicketlinkKeycloakSessionFactory;
-import org.keycloak.services.models.picketlink.mappings.ApplicationEntity;
-import org.keycloak.services.models.picketlink.mappings.RealmEntity;
import org.keycloak.social.SocialRequestManager;
import org.picketlink.idm.PartitionManager;
import org.picketlink.idm.config.IdentityConfigurationBuilder;
@@ -25,8 +20,6 @@ import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;
import javax.servlet.ServletContext;
-import javax.persistence.EntityManagerFactory;
-import javax.persistence.Persistence;
import javax.ws.rs.core.Application;
import javax.ws.rs.core.Context;
import java.util.HashSet;
diff --git a/services/src/test/java/org/keycloak/test/AdapterTest.java b/services/src/test/java/org/keycloak/test/AdapterTest.java
index 08420363e7..41aa8e15b2 100755
--- a/services/src/test/java/org/keycloak/test/AdapterTest.java
+++ b/services/src/test/java/org/keycloak/test/AdapterTest.java
@@ -141,6 +141,8 @@ public class AdapterTest extends AbstractKeycloakTest {
user.setEmail("bburke@redhat.com");
}
+ RealmManager adapter = getRealmManager();
+
{
List userModels = adapter.searchUsers("total junk query", realmModel);
Assert.assertEquals(userModels.size(), 0);
diff --git a/services/src/test/java/org/keycloak/test/RealmCreationTest.java b/services/src/test/java/org/keycloak/test/RealmCreationTest.java
index 725a0d1228..a99042f6c5 100755
--- a/services/src/test/java/org/keycloak/test/RealmCreationTest.java
+++ b/services/src/test/java/org/keycloak/test/RealmCreationTest.java
@@ -11,11 +11,6 @@ import org.keycloak.services.managers.AuthenticationManager;
import org.keycloak.services.managers.RealmManager;
import org.keycloak.models.KeycloakSession;
import org.keycloak.models.RealmModel;
-import org.keycloak.services.models.KeycloakSession;
-import org.keycloak.services.models.RealmModel;
-import org.keycloak.services.resources.KeycloakApplication;
-import org.keycloak.test.common.AbstractKeycloakTest;
-import org.keycloak.test.common.SessionFactoryTestContext;
import javax.ws.rs.NotAuthorizedException;
import javax.ws.rs.client.Entity;
diff --git a/services/src/test/java/org/keycloak/test/common/AbstractKeycloakTest.java b/services/src/test/java/org/keycloak/test/common/AbstractKeycloakTest.java
index 0e9b692efd..34f052bb5d 100644
--- a/services/src/test/java/org/keycloak/test/common/AbstractKeycloakTest.java
+++ b/services/src/test/java/org/keycloak/test/common/AbstractKeycloakTest.java
@@ -10,9 +10,9 @@ import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
+import org.keycloak.models.KeycloakSession;
+import org.keycloak.models.KeycloakSessionFactory;
import org.keycloak.services.managers.RealmManager;
-import org.keycloak.services.models.KeycloakSession;
-import org.keycloak.services.models.KeycloakSessionFactory;
import org.keycloak.services.resources.KeycloakApplication;
/**
diff --git a/services/src/test/java/org/keycloak/test/common/MongoDBSessionFactoryTestContext.java b/services/src/test/java/org/keycloak/test/common/MongoDBSessionFactoryTestContext.java
index fc723a2137..ece90a10e4 100644
--- a/services/src/test/java/org/keycloak/test/common/MongoDBSessionFactoryTestContext.java
+++ b/services/src/test/java/org/keycloak/test/common/MongoDBSessionFactoryTestContext.java
@@ -1,7 +1,5 @@
package org.keycloak.test.common;
-import com.mongodb.DB;
-import com.mongodb.MongoClient;
import de.flapdoodle.embed.mongo.MongodExecutable;
import de.flapdoodle.embed.mongo.MongodProcess;
import de.flapdoodle.embed.mongo.MongodStarter;
@@ -9,7 +7,6 @@ import de.flapdoodle.embed.mongo.config.MongodConfig;
import de.flapdoodle.embed.mongo.distribution.Version;
import de.flapdoodle.embed.process.runtime.Network;
import org.jboss.resteasy.logging.Logger;
-import org.keycloak.services.models.KeycloakSessionFactory;
import org.keycloak.services.resources.KeycloakApplication;
/**
diff --git a/services/src/test/java/org/keycloak/test/common/PicketlinkSessionFactoryTestContext.java b/services/src/test/java/org/keycloak/test/common/PicketlinkSessionFactoryTestContext.java
index 7ffbbf359d..1f757bf92c 100644
--- a/services/src/test/java/org/keycloak/test/common/PicketlinkSessionFactoryTestContext.java
+++ b/services/src/test/java/org/keycloak/test/common/PicketlinkSessionFactoryTestContext.java
@@ -1,6 +1,5 @@
package org.keycloak.test.common;
-import org.keycloak.services.models.KeycloakSessionFactory;
import org.keycloak.services.resources.KeycloakApplication;
/**
diff --git a/services/src/test/java/org/keycloak/test/common/SessionFactoryTestContext.java b/services/src/test/java/org/keycloak/test/common/SessionFactoryTestContext.java
index 3bbc4bd655..a35cfd25c6 100644
--- a/services/src/test/java/org/keycloak/test/common/SessionFactoryTestContext.java
+++ b/services/src/test/java/org/keycloak/test/common/SessionFactoryTestContext.java
@@ -1,7 +1,5 @@
package org.keycloak.test.common;
-import org.keycloak.services.models.KeycloakSessionFactory;
-
/**
* @author Marek Posolda
*/
diff --git a/testsuite/integration/pom.xml b/testsuite/integration/pom.xml
new file mode 100644
index 0000000000..d8e4537206
--- /dev/null
+++ b/testsuite/integration/pom.xml
@@ -0,0 +1,223 @@
+
+
+
+ keycloak-parent
+ org.keycloak
+ 1.0-alpha-1
+ ../../pom.xml
+
+ 4.0.0
+
+ keycloak-testsuite-integration
+ Keycloak Integration TestSuite
+
+
+
+
+
+ org.keycloak
+ keycloak-as7-adapter
+ ${project.version}
+
+
+
+
+
+
+ org.bouncycastle
+ bcprov-jdk16
+
+
+ org.keycloak
+ keycloak-core
+ ${project.version}
+
+
+ org.keycloak
+ keycloak-services
+ ${project.version}
+
+
+
+ org.keycloak
+ keycloak-social-core
+ ${project.version}
+
+
+ org.keycloak
+ keycloak-social-google
+ ${project.version}
+
+
+ org.keycloak
+ keycloak-social-twitter
+ ${project.version}
+
+
+ org.keycloak
+ keycloak-social-facebook
+ ${project.version}
+
+
+ org.keycloak
+ keycloak-forms
+ ${project.version}
+
+
+
+ org.jboss.logging
+ jboss-logging
+
+
+ org.picketlink
+ picketlink-idm-api
+
+
+ org.picketlink
+ picketlink-common
+
+
+ org.picketlink
+ picketlink-idm-impl
+
+
+ org.picketlink
+ picketlink-idm-simple-schema
+
+
+ org.picketlink
+ picketlink-config
+
+
+ org.jboss.resteasy
+ resteasy-jaxrs
+
+
+ log4j
+ log4j
+
+
+ org.slf4j
+ slf4j-api
+
+
+ org.slf4j
+ slf4j-simple
+
+
+
+
+ org.jboss.resteasy
+ jaxrs-api
+
+
+ org.jboss.resteasy
+ resteasy-client
+
+
+ org.jboss.resteasy
+ resteasy-crypto
+
+
+ org.jboss.resteasy
+ jose-jwt
+
+
+ org.jboss.resteasy
+ resteasy-undertow
+
+
+ io.undertow
+ undertow-servlet
+
+
+ io.undertow
+ undertow-core
+
+
+ org.codehaus.jackson
+ jackson-core-asl
+
+
+ org.codehaus.jackson
+ jackson-mapper-asl
+
+
+ org.jboss.spec.javax.servlet
+ jboss-servlet-api_3.0_spec
+
+
+ org.codehaus.jackson
+ jackson-xc
+
+
+ junit
+ junit
+
+
+ org.hibernate.javax.persistence
+ hibernate-jpa-2.0-api
+
+
+ com.h2database
+ h2
+ 1.3.161
+
+
+ org.hibernate
+ hibernate-entitymanager
+ 3.6.6.Final
+
+
+ com.icegreen
+ greenmail
+
+
+ org.seleniumhq.selenium
+ selenium-java
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+
+
+ 1.6
+
+
+
+
+
+
+
+ jboss-managed
+
+
+ org.jboss.as
+ jboss-as-arquillian-container-managed
+ test
+ 7.1.1.Final
+
+
+
+
+ jboss-remote
+
+
+ org.jboss.as
+ jboss-as-arquillian-container-remote
+ test
+ 7.1.1.Final
+
+
+
+
+
\ No newline at end of file
diff --git a/testsuite/src/main/java/org/keycloak/testutils/KeycloakServer.java b/testsuite/integration/src/main/java/org/keycloak/testutils/KeycloakServer.java
similarity index 100%
rename from testsuite/src/main/java/org/keycloak/testutils/KeycloakServer.java
rename to testsuite/integration/src/main/java/org/keycloak/testutils/KeycloakServer.java
diff --git a/testsuite/src/main/java/org/keycloak/testutils/MailServer.java b/testsuite/integration/src/main/java/org/keycloak/testutils/MailServer.java
similarity index 100%
rename from testsuite/src/main/java/org/keycloak/testutils/MailServer.java
rename to testsuite/integration/src/main/java/org/keycloak/testutils/MailServer.java
diff --git a/testsuite/src/main/java/org/keycloak/testutils/TotpGenerator.java b/testsuite/integration/src/main/java/org/keycloak/testutils/TotpGenerator.java
similarity index 100%
rename from testsuite/src/main/java/org/keycloak/testutils/TotpGenerator.java
rename to testsuite/integration/src/main/java/org/keycloak/testutils/TotpGenerator.java
diff --git a/testsuite/src/main/resources/META-INF/persistence.xml b/testsuite/integration/src/main/resources/META-INF/persistence.xml
similarity index 100%
rename from testsuite/src/main/resources/META-INF/persistence.xml
rename to testsuite/integration/src/main/resources/META-INF/persistence.xml
diff --git a/testsuite/src/test/java/org/keycloak/testsuite/ApplicationServlet.java b/testsuite/integration/src/test/java/org/keycloak/testsuite/ApplicationServlet.java
similarity index 100%
rename from testsuite/src/test/java/org/keycloak/testsuite/ApplicationServlet.java
rename to testsuite/integration/src/test/java/org/keycloak/testsuite/ApplicationServlet.java
diff --git a/testsuite/src/test/java/org/keycloak/testsuite/Constants.java b/testsuite/integration/src/test/java/org/keycloak/testsuite/Constants.java
similarity index 100%
rename from testsuite/src/test/java/org/keycloak/testsuite/Constants.java
rename to testsuite/integration/src/test/java/org/keycloak/testsuite/Constants.java
diff --git a/testsuite/src/test/java/org/keycloak/testsuite/DummySocial.java b/testsuite/integration/src/test/java/org/keycloak/testsuite/DummySocial.java
similarity index 100%
rename from testsuite/src/test/java/org/keycloak/testsuite/DummySocial.java
rename to testsuite/integration/src/test/java/org/keycloak/testsuite/DummySocial.java
diff --git a/testsuite/src/test/java/org/keycloak/testsuite/DummySocialServlet.java b/testsuite/integration/src/test/java/org/keycloak/testsuite/DummySocialServlet.java
similarity index 100%
rename from testsuite/src/test/java/org/keycloak/testsuite/DummySocialServlet.java
rename to testsuite/integration/src/test/java/org/keycloak/testsuite/DummySocialServlet.java
diff --git a/testsuite/src/test/java/org/keycloak/testsuite/OAuthClient.java b/testsuite/integration/src/test/java/org/keycloak/testsuite/OAuthClient.java
similarity index 100%
rename from testsuite/src/test/java/org/keycloak/testsuite/OAuthClient.java
rename to testsuite/integration/src/test/java/org/keycloak/testsuite/OAuthClient.java
diff --git a/testsuite/src/test/java/org/keycloak/testsuite/actions/RequiredActionEmailVerificationTest.java b/testsuite/integration/src/test/java/org/keycloak/testsuite/actions/RequiredActionEmailVerificationTest.java
similarity index 100%
rename from testsuite/src/test/java/org/keycloak/testsuite/actions/RequiredActionEmailVerificationTest.java
rename to testsuite/integration/src/test/java/org/keycloak/testsuite/actions/RequiredActionEmailVerificationTest.java
diff --git a/testsuite/src/test/java/org/keycloak/testsuite/actions/RequiredActionMultipleActionsTest.java b/testsuite/integration/src/test/java/org/keycloak/testsuite/actions/RequiredActionMultipleActionsTest.java
similarity index 100%
rename from testsuite/src/test/java/org/keycloak/testsuite/actions/RequiredActionMultipleActionsTest.java
rename to testsuite/integration/src/test/java/org/keycloak/testsuite/actions/RequiredActionMultipleActionsTest.java
diff --git a/testsuite/src/test/java/org/keycloak/testsuite/actions/RequiredActionResetPasswordTest.java b/testsuite/integration/src/test/java/org/keycloak/testsuite/actions/RequiredActionResetPasswordTest.java
similarity index 100%
rename from testsuite/src/test/java/org/keycloak/testsuite/actions/RequiredActionResetPasswordTest.java
rename to testsuite/integration/src/test/java/org/keycloak/testsuite/actions/RequiredActionResetPasswordTest.java
diff --git a/testsuite/src/test/java/org/keycloak/testsuite/actions/RequiredActionTotpSetupTest.java b/testsuite/integration/src/test/java/org/keycloak/testsuite/actions/RequiredActionTotpSetupTest.java
similarity index 100%
rename from testsuite/src/test/java/org/keycloak/testsuite/actions/RequiredActionTotpSetupTest.java
rename to testsuite/integration/src/test/java/org/keycloak/testsuite/actions/RequiredActionTotpSetupTest.java
diff --git a/testsuite/src/test/java/org/keycloak/testsuite/actions/RequiredActionUpdateProfileTest.java b/testsuite/integration/src/test/java/org/keycloak/testsuite/actions/RequiredActionUpdateProfileTest.java
similarity index 100%
rename from testsuite/src/test/java/org/keycloak/testsuite/actions/RequiredActionUpdateProfileTest.java
rename to testsuite/integration/src/test/java/org/keycloak/testsuite/actions/RequiredActionUpdateProfileTest.java
diff --git a/testsuite/src/test/java/org/keycloak/testsuite/forms/AccountTest.java b/testsuite/integration/src/test/java/org/keycloak/testsuite/forms/AccountTest.java
similarity index 100%
rename from testsuite/src/test/java/org/keycloak/testsuite/forms/AccountTest.java
rename to testsuite/integration/src/test/java/org/keycloak/testsuite/forms/AccountTest.java
diff --git a/testsuite/src/test/java/org/keycloak/testsuite/forms/LoginTest.java b/testsuite/integration/src/test/java/org/keycloak/testsuite/forms/LoginTest.java
similarity index 100%
rename from testsuite/src/test/java/org/keycloak/testsuite/forms/LoginTest.java
rename to testsuite/integration/src/test/java/org/keycloak/testsuite/forms/LoginTest.java
diff --git a/testsuite/src/test/java/org/keycloak/testsuite/forms/LoginTotpTest.java b/testsuite/integration/src/test/java/org/keycloak/testsuite/forms/LoginTotpTest.java
similarity index 100%
rename from testsuite/src/test/java/org/keycloak/testsuite/forms/LoginTotpTest.java
rename to testsuite/integration/src/test/java/org/keycloak/testsuite/forms/LoginTotpTest.java
diff --git a/testsuite/src/test/java/org/keycloak/testsuite/forms/RegisterTest.java b/testsuite/integration/src/test/java/org/keycloak/testsuite/forms/RegisterTest.java
similarity index 100%
rename from testsuite/src/test/java/org/keycloak/testsuite/forms/RegisterTest.java
rename to testsuite/integration/src/test/java/org/keycloak/testsuite/forms/RegisterTest.java
diff --git a/testsuite/src/test/java/org/keycloak/testsuite/forms/ResetPasswordTest.java b/testsuite/integration/src/test/java/org/keycloak/testsuite/forms/ResetPasswordTest.java
similarity index 100%
rename from testsuite/src/test/java/org/keycloak/testsuite/forms/ResetPasswordTest.java
rename to testsuite/integration/src/test/java/org/keycloak/testsuite/forms/ResetPasswordTest.java
diff --git a/testsuite/src/test/java/org/keycloak/testsuite/oauth/AccessTokenTest.java b/testsuite/integration/src/test/java/org/keycloak/testsuite/oauth/AccessTokenTest.java
similarity index 100%
rename from testsuite/src/test/java/org/keycloak/testsuite/oauth/AccessTokenTest.java
rename to testsuite/integration/src/test/java/org/keycloak/testsuite/oauth/AccessTokenTest.java
diff --git a/testsuite/src/test/java/org/keycloak/testsuite/oauth/AuthorizationCodeTest.java b/testsuite/integration/src/test/java/org/keycloak/testsuite/oauth/AuthorizationCodeTest.java
similarity index 100%
rename from testsuite/src/test/java/org/keycloak/testsuite/oauth/AuthorizationCodeTest.java
rename to testsuite/integration/src/test/java/org/keycloak/testsuite/oauth/AuthorizationCodeTest.java
diff --git a/testsuite/src/test/java/org/keycloak/testsuite/pages/AccountPasswordPage.java b/testsuite/integration/src/test/java/org/keycloak/testsuite/pages/AccountPasswordPage.java
similarity index 100%
rename from testsuite/src/test/java/org/keycloak/testsuite/pages/AccountPasswordPage.java
rename to testsuite/integration/src/test/java/org/keycloak/testsuite/pages/AccountPasswordPage.java
diff --git a/testsuite/src/test/java/org/keycloak/testsuite/pages/AccountTotpPage.java b/testsuite/integration/src/test/java/org/keycloak/testsuite/pages/AccountTotpPage.java
similarity index 100%
rename from testsuite/src/test/java/org/keycloak/testsuite/pages/AccountTotpPage.java
rename to testsuite/integration/src/test/java/org/keycloak/testsuite/pages/AccountTotpPage.java
diff --git a/testsuite/src/test/java/org/keycloak/testsuite/pages/AccountUpdateProfilePage.java b/testsuite/integration/src/test/java/org/keycloak/testsuite/pages/AccountUpdateProfilePage.java
similarity index 100%
rename from testsuite/src/test/java/org/keycloak/testsuite/pages/AccountUpdateProfilePage.java
rename to testsuite/integration/src/test/java/org/keycloak/testsuite/pages/AccountUpdateProfilePage.java
diff --git a/testsuite/src/test/java/org/keycloak/testsuite/pages/AppPage.java b/testsuite/integration/src/test/java/org/keycloak/testsuite/pages/AppPage.java
similarity index 100%
rename from testsuite/src/test/java/org/keycloak/testsuite/pages/AppPage.java
rename to testsuite/integration/src/test/java/org/keycloak/testsuite/pages/AppPage.java
diff --git a/testsuite/src/test/java/org/keycloak/testsuite/pages/LoginConfigTotpPage.java b/testsuite/integration/src/test/java/org/keycloak/testsuite/pages/LoginConfigTotpPage.java
similarity index 100%
rename from testsuite/src/test/java/org/keycloak/testsuite/pages/LoginConfigTotpPage.java
rename to testsuite/integration/src/test/java/org/keycloak/testsuite/pages/LoginConfigTotpPage.java
diff --git a/testsuite/src/test/java/org/keycloak/testsuite/pages/LoginPage.java b/testsuite/integration/src/test/java/org/keycloak/testsuite/pages/LoginPage.java
similarity index 100%
rename from testsuite/src/test/java/org/keycloak/testsuite/pages/LoginPage.java
rename to testsuite/integration/src/test/java/org/keycloak/testsuite/pages/LoginPage.java
diff --git a/testsuite/src/test/java/org/keycloak/testsuite/pages/LoginPasswordResetPage.java b/testsuite/integration/src/test/java/org/keycloak/testsuite/pages/LoginPasswordResetPage.java
similarity index 100%
rename from testsuite/src/test/java/org/keycloak/testsuite/pages/LoginPasswordResetPage.java
rename to testsuite/integration/src/test/java/org/keycloak/testsuite/pages/LoginPasswordResetPage.java
diff --git a/testsuite/src/test/java/org/keycloak/testsuite/pages/LoginPasswordUpdatePage.java b/testsuite/integration/src/test/java/org/keycloak/testsuite/pages/LoginPasswordUpdatePage.java
similarity index 100%
rename from testsuite/src/test/java/org/keycloak/testsuite/pages/LoginPasswordUpdatePage.java
rename to testsuite/integration/src/test/java/org/keycloak/testsuite/pages/LoginPasswordUpdatePage.java
diff --git a/testsuite/src/test/java/org/keycloak/testsuite/pages/LoginTotpPage.java b/testsuite/integration/src/test/java/org/keycloak/testsuite/pages/LoginTotpPage.java
similarity index 100%
rename from testsuite/src/test/java/org/keycloak/testsuite/pages/LoginTotpPage.java
rename to testsuite/integration/src/test/java/org/keycloak/testsuite/pages/LoginTotpPage.java
diff --git a/testsuite/src/test/java/org/keycloak/testsuite/pages/LoginUpdateProfilePage.java b/testsuite/integration/src/test/java/org/keycloak/testsuite/pages/LoginUpdateProfilePage.java
similarity index 100%
rename from testsuite/src/test/java/org/keycloak/testsuite/pages/LoginUpdateProfilePage.java
rename to testsuite/integration/src/test/java/org/keycloak/testsuite/pages/LoginUpdateProfilePage.java
diff --git a/testsuite/src/test/java/org/keycloak/testsuite/pages/Page.java b/testsuite/integration/src/test/java/org/keycloak/testsuite/pages/Page.java
similarity index 100%
rename from testsuite/src/test/java/org/keycloak/testsuite/pages/Page.java
rename to testsuite/integration/src/test/java/org/keycloak/testsuite/pages/Page.java
diff --git a/testsuite/src/test/java/org/keycloak/testsuite/pages/RegisterPage.java b/testsuite/integration/src/test/java/org/keycloak/testsuite/pages/RegisterPage.java
similarity index 100%
rename from testsuite/src/test/java/org/keycloak/testsuite/pages/RegisterPage.java
rename to testsuite/integration/src/test/java/org/keycloak/testsuite/pages/RegisterPage.java
diff --git a/testsuite/src/test/java/org/keycloak/testsuite/pages/VerifyEmailPage.java b/testsuite/integration/src/test/java/org/keycloak/testsuite/pages/VerifyEmailPage.java
similarity index 100%
rename from testsuite/src/test/java/org/keycloak/testsuite/pages/VerifyEmailPage.java
rename to testsuite/integration/src/test/java/org/keycloak/testsuite/pages/VerifyEmailPage.java
diff --git a/testsuite/src/test/java/org/keycloak/testsuite/rule/GreenMailRule.java b/testsuite/integration/src/test/java/org/keycloak/testsuite/rule/GreenMailRule.java
similarity index 100%
rename from testsuite/src/test/java/org/keycloak/testsuite/rule/GreenMailRule.java
rename to testsuite/integration/src/test/java/org/keycloak/testsuite/rule/GreenMailRule.java
diff --git a/testsuite/src/test/java/org/keycloak/testsuite/rule/KeycloakRule.java b/testsuite/integration/src/test/java/org/keycloak/testsuite/rule/KeycloakRule.java
similarity index 100%
rename from testsuite/src/test/java/org/keycloak/testsuite/rule/KeycloakRule.java
rename to testsuite/integration/src/test/java/org/keycloak/testsuite/rule/KeycloakRule.java
diff --git a/testsuite/src/test/java/org/keycloak/testsuite/rule/WebResource.java b/testsuite/integration/src/test/java/org/keycloak/testsuite/rule/WebResource.java
similarity index 100%
rename from testsuite/src/test/java/org/keycloak/testsuite/rule/WebResource.java
rename to testsuite/integration/src/test/java/org/keycloak/testsuite/rule/WebResource.java
diff --git a/testsuite/src/test/java/org/keycloak/testsuite/rule/WebRule.java b/testsuite/integration/src/test/java/org/keycloak/testsuite/rule/WebRule.java
similarity index 100%
rename from testsuite/src/test/java/org/keycloak/testsuite/rule/WebRule.java
rename to testsuite/integration/src/test/java/org/keycloak/testsuite/rule/WebRule.java
diff --git a/testsuite/src/test/java/org/keycloak/testsuite/social/SocialLoginTest.java b/testsuite/integration/src/test/java/org/keycloak/testsuite/social/SocialLoginTest.java
similarity index 100%
rename from testsuite/src/test/java/org/keycloak/testsuite/social/SocialLoginTest.java
rename to testsuite/integration/src/test/java/org/keycloak/testsuite/social/SocialLoginTest.java
diff --git a/testsuite/src/test/resources/META-INF/services/org.keycloak.social.SocialProvider b/testsuite/integration/src/test/resources/META-INF/services/org.keycloak.social.SocialProvider
similarity index 100%
rename from testsuite/src/test/resources/META-INF/services/org.keycloak.social.SocialProvider
rename to testsuite/integration/src/test/resources/META-INF/services/org.keycloak.social.SocialProvider
diff --git a/testsuite/src/test/resources/testrealm.json b/testsuite/integration/src/test/resources/testrealm.json
similarity index 100%
rename from testsuite/src/test/resources/testrealm.json
rename to testsuite/integration/src/test/resources/testrealm.json
diff --git a/testsuite/performance/pom.xml b/testsuite/performance/pom.xml
new file mode 100644
index 0000000000..1cb822099b
--- /dev/null
+++ b/testsuite/performance/pom.xml
@@ -0,0 +1,240 @@
+
+
+
+ keycloak-parent
+ org.keycloak
+ 1.0-alpha-1
+ ../../pom.xml
+
+ 4.0.0
+
+ keycloak-testsuite-performance
+ Keycloak Performance TestSuite
+
+
+
+
+ org.keycloak
+ keycloak-core
+ ${project.version}
+
+
+ org.keycloak
+ keycloak-services
+ ${project.version}
+
+
+ org.jboss.resteasy
+ resteasy-jaxrs
+ provided
+
+
+ log4j
+ log4j
+
+
+ org.slf4j
+ slf4j-api
+
+
+ org.slf4j
+ slf4j-simple
+
+
+
+
+ org.jboss.resteasy
+ jaxrs-api
+ provided
+
+
+ org.jboss.resteasy
+ resteasy-client
+ provided
+
+
+ org.apache.jmeter
+ ApacheJMeter_java
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+
+
+ 1.6
+
+
+
+ org.apache.maven.plugins
+ maven-jar-plugin
+
+
+
+ test-jar
+
+
+
+
+
+
+
+
+
+ performance-tests
+
+
+
+ com.lazerycode.jmeter
+ jmeter-maven-plugin
+
+
+ jmeter-tests
+ verify
+
+ jmeter
+
+
+
+
+
+ org.keycloak
+ keycloak-testsuite
+ ${project.version}
+ test-jar
+
+
+ org.keycloak
+ keycloak-services
+ ${project.version}
+
+
+ org.jboss.resteasy
+ jaxrs-api
+ ${resteasy.version}
+
+
+ org.jboss.resteasy
+ resteasy-jaxrs
+ ${resteasy.version}
+
+
+ log4j
+ log4j
+
+
+ org.slf4j
+ slf4j-api
+
+
+ org.slf4j
+ slf4j-simple
+
+
+ commons-io
+ commons-io
+
+
+
+
+ org.jboss.logging
+ jboss-logging
+ ${jboss.logging.version}
+
+
+ org.picketlink
+ picketlink-idm-impl
+ ${picketlink.version}
+
+
+ org.picketlink
+ picketlink-idm-simple-schema
+ ${picketlink.version}
+
+
+ org.picketlink
+ picketlink-config
+ ${picketlink.version}
+
+
+ org.mongodb
+ mongo-java-driver
+ ${mongo.driver.version}
+
+
+
+
+ org.hibernate.javax.persistence
+ hibernate-jpa-2.0-api
+ ${hibernate.javax.persistence.version}
+
+
+ com.h2database
+ h2
+ ${h2.version}
+
+
+ org.hibernate
+ hibernate-entitymanager
+ ${hibernate.entitymanager.version}
+
+
+ dom4j
+ dom4j
+ ${dom4j.version}
+
+
+ org.slf4j
+ slf4j-api
+ ${slf4j.version}
+
+
+
+
+ mysql
+ mysql-connector-java
+ ${mysql.version}
+
+
+
+
+
+
+ com.lazerycode.jmeter
+ jmeter-analysis-maven-plugin
+
+
+ jmeter-tests-analyze
+ verify
+
+ analyze
+
+
+
+ ${project.build.directory}/jmeter/results
+ false
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/testsuite/src/test/java/org/keycloak/testsuite/performance/BaseJMeterPerformanceTest.java b/testsuite/performance/src/test/java/org/keycloak/testsuite/performance/BaseJMeterPerformanceTest.java
similarity index 94%
rename from testsuite/src/test/java/org/keycloak/testsuite/performance/BaseJMeterPerformanceTest.java
rename to testsuite/performance/src/test/java/org/keycloak/testsuite/performance/BaseJMeterPerformanceTest.java
index bc38e6d7bd..efe57c128a 100644
--- a/testsuite/src/test/java/org/keycloak/testsuite/performance/BaseJMeterPerformanceTest.java
+++ b/testsuite/performance/src/test/java/org/keycloak/testsuite/performance/BaseJMeterPerformanceTest.java
@@ -7,10 +7,9 @@ import java.util.concurrent.atomic.AtomicInteger;
import org.apache.jmeter.protocol.java.sampler.AbstractJavaSamplerClient;
import org.apache.jmeter.protocol.java.sampler.JavaSamplerContext;
import org.apache.jmeter.samplers.SampleResult;
-import org.keycloak.services.models.KeycloakSession;
-import org.keycloak.services.models.KeycloakSessionFactory;
-import org.keycloak.services.models.KeycloakTransaction;
-import org.keycloak.services.models.picketlink.PicketlinkKeycloakSession;
+import org.keycloak.models.KeycloakSession;
+import org.keycloak.models.KeycloakSessionFactory;
+import org.keycloak.models.KeycloakTransaction;
import org.keycloak.services.resources.KeycloakApplication;
/**
diff --git a/testsuite/src/test/java/org/keycloak/testsuite/performance/CreateRealmsWorker.java b/testsuite/performance/src/test/java/org/keycloak/testsuite/performance/CreateRealmsWorker.java
similarity index 96%
rename from testsuite/src/test/java/org/keycloak/testsuite/performance/CreateRealmsWorker.java
rename to testsuite/performance/src/test/java/org/keycloak/testsuite/performance/CreateRealmsWorker.java
index a3b37e091f..27499982b2 100644
--- a/testsuite/src/test/java/org/keycloak/testsuite/performance/CreateRealmsWorker.java
+++ b/testsuite/performance/src/test/java/org/keycloak/testsuite/performance/CreateRealmsWorker.java
@@ -5,11 +5,11 @@ import java.util.concurrent.atomic.AtomicInteger;
import org.apache.jmeter.samplers.SampleResult;
import org.apache.jorphan.logging.LoggingManager;
import org.apache.log.Logger;
+import org.keycloak.models.ApplicationModel;
+import org.keycloak.models.KeycloakSession;
+import org.keycloak.models.RealmModel;
import org.keycloak.representations.idm.CredentialRepresentation;
import org.keycloak.services.managers.RealmManager;
-import org.keycloak.services.models.ApplicationModel;
-import org.keycloak.services.models.KeycloakSession;
-import org.keycloak.services.models.RealmModel;
/**
* @author Marek Posolda
diff --git a/testsuite/src/test/java/org/keycloak/testsuite/performance/CreateUsersWorker.java b/testsuite/performance/src/test/java/org/keycloak/testsuite/performance/CreateUsersWorker.java
similarity index 94%
rename from testsuite/src/test/java/org/keycloak/testsuite/performance/CreateUsersWorker.java
rename to testsuite/performance/src/test/java/org/keycloak/testsuite/performance/CreateUsersWorker.java
index f4279442d3..29bd33cc92 100644
--- a/testsuite/src/test/java/org/keycloak/testsuite/performance/CreateUsersWorker.java
+++ b/testsuite/performance/src/test/java/org/keycloak/testsuite/performance/CreateUsersWorker.java
@@ -5,13 +5,13 @@ import java.util.concurrent.atomic.AtomicInteger;
import org.apache.jmeter.samplers.SampleResult;
import org.apache.jorphan.logging.LoggingManager;
import org.apache.log.Logger;
+import org.keycloak.models.KeycloakSession;
+import org.keycloak.models.RealmModel;
+import org.keycloak.models.RoleModel;
+import org.keycloak.models.SocialLinkModel;
+import org.keycloak.models.UserCredentialModel;
+import org.keycloak.models.UserModel;
import org.keycloak.representations.idm.CredentialRepresentation;
-import org.keycloak.services.models.KeycloakSession;
-import org.keycloak.services.models.RealmModel;
-import org.keycloak.services.models.RoleModel;
-import org.keycloak.services.models.SocialLinkModel;
-import org.keycloak.services.models.UserCredentialModel;
-import org.keycloak.services.models.UserModel;
/**
* @author Marek Posolda
diff --git a/testsuite/src/test/java/org/keycloak/testsuite/performance/PerfTestUtils.java b/testsuite/performance/src/test/java/org/keycloak/testsuite/performance/PerfTestUtils.java
similarity index 100%
rename from testsuite/src/test/java/org/keycloak/testsuite/performance/PerfTestUtils.java
rename to testsuite/performance/src/test/java/org/keycloak/testsuite/performance/PerfTestUtils.java
diff --git a/testsuite/src/test/java/org/keycloak/testsuite/performance/ReadUsersWorker.java b/testsuite/performance/src/test/java/org/keycloak/testsuite/performance/ReadUsersWorker.java
similarity index 95%
rename from testsuite/src/test/java/org/keycloak/testsuite/performance/ReadUsersWorker.java
rename to testsuite/performance/src/test/java/org/keycloak/testsuite/performance/ReadUsersWorker.java
index 1439919512..30bab60586 100644
--- a/testsuite/src/test/java/org/keycloak/testsuite/performance/ReadUsersWorker.java
+++ b/testsuite/performance/src/test/java/org/keycloak/testsuite/performance/ReadUsersWorker.java
@@ -5,10 +5,10 @@ import java.util.concurrent.atomic.AtomicInteger;
import org.apache.jmeter.samplers.SampleResult;
import org.apache.jorphan.logging.LoggingManager;
import org.apache.log.Logger;
-import org.keycloak.services.models.KeycloakSession;
-import org.keycloak.services.models.RealmModel;
-import org.keycloak.services.models.SocialLinkModel;
-import org.keycloak.services.models.UserModel;
+import org.keycloak.models.KeycloakSession;
+import org.keycloak.models.RealmModel;
+import org.keycloak.models.SocialLinkModel;
+import org.keycloak.models.UserModel;
/**
* @author Marek Posolda
@@ -95,7 +95,7 @@ public class ReadUsersWorker implements Worker {
// Read scopes of user in realm
if (readScopes) {
- realm.getScope(user);
+ realm.getScopeMapping(user);
}
// Validate password (shoould be same as username)
diff --git a/testsuite/src/test/java/org/keycloak/testsuite/performance/RemoveUsersWorker.java b/testsuite/performance/src/test/java/org/keycloak/testsuite/performance/RemoveUsersWorker.java
similarity index 90%
rename from testsuite/src/test/java/org/keycloak/testsuite/performance/RemoveUsersWorker.java
rename to testsuite/performance/src/test/java/org/keycloak/testsuite/performance/RemoveUsersWorker.java
index 966024ac73..f23977283a 100644
--- a/testsuite/src/test/java/org/keycloak/testsuite/performance/RemoveUsersWorker.java
+++ b/testsuite/performance/src/test/java/org/keycloak/testsuite/performance/RemoveUsersWorker.java
@@ -5,11 +5,9 @@ import java.util.concurrent.atomic.AtomicInteger;
import org.apache.jmeter.samplers.SampleResult;
import org.apache.jorphan.logging.LoggingManager;
import org.apache.log.Logger;
-import org.keycloak.services.models.KeycloakSession;
-import org.keycloak.services.models.RealmModel;
-import org.keycloak.services.models.SocialLinkModel;
-import org.keycloak.services.models.UserModel;
-import org.keycloak.services.models.nosql.keycloak.adapters.RealmAdapter;
+import org.keycloak.models.KeycloakSession;
+import org.keycloak.models.RealmModel;
+import org.keycloak.models.mongo.keycloak.adapters.RealmAdapter;
import org.keycloak.services.resources.KeycloakApplication;
/**
diff --git a/testsuite/src/test/java/org/keycloak/testsuite/performance/Worker.java b/testsuite/performance/src/test/java/org/keycloak/testsuite/performance/Worker.java
similarity index 72%
rename from testsuite/src/test/java/org/keycloak/testsuite/performance/Worker.java
rename to testsuite/performance/src/test/java/org/keycloak/testsuite/performance/Worker.java
index 6060f49a3f..69732cf192 100644
--- a/testsuite/src/test/java/org/keycloak/testsuite/performance/Worker.java
+++ b/testsuite/performance/src/test/java/org/keycloak/testsuite/performance/Worker.java
@@ -1,9 +1,7 @@
package org.keycloak.testsuite.performance;
import org.apache.jmeter.samplers.SampleResult;
-import org.apache.log.Logger;
-import org.keycloak.services.managers.RealmManager;
-import org.keycloak.services.models.KeycloakSession;
+import org.keycloak.models.KeycloakSession;
/**
* @author Marek Posolda
diff --git a/testsuite/src/test/jmeter/jmeter.properties b/testsuite/performance/src/test/jmeter/jmeter.properties
similarity index 100%
rename from testsuite/src/test/jmeter/jmeter.properties
rename to testsuite/performance/src/test/jmeter/jmeter.properties
diff --git a/testsuite/src/test/jmeter/mongo_test.jmx b/testsuite/performance/src/test/jmeter/keycloak_perf_test.jmx
similarity index 100%
rename from testsuite/src/test/jmeter/mongo_test.jmx
rename to testsuite/performance/src/test/jmeter/keycloak_perf_test.jmx
diff --git a/testsuite/src/test/jmeter/system.properties b/testsuite/performance/src/test/jmeter/system.properties
similarity index 100%
rename from testsuite/src/test/jmeter/system.properties
rename to testsuite/performance/src/test/jmeter/system.properties
diff --git a/testsuite/src/test/resources/META-INF/persistence-performance.xml b/testsuite/performance/src/test/resources/META-INF/persistence.xml
similarity index 100%
rename from testsuite/src/test/resources/META-INF/persistence-performance.xml
rename to testsuite/performance/src/test/resources/META-INF/persistence.xml
diff --git a/testsuite/pom.xml b/testsuite/pom.xml
index adb5aa3e7e..c8b7bcf19d 100755
--- a/testsuite/pom.xml
+++ b/testsuite/pom.xml
@@ -8,382 +8,13 @@
4.0.0
- keycloak-testsuite
- Keycloak TestSuite
+ keycloak-testsuite-pom
+ pom
+ Keycloak TestSuite
+
+ integration
+ performance
+
-
-
-
- org.keycloak
- keycloak-as7-adapter
- ${project.version}
-
-
-
-
-
-
- org.bouncycastle
- bcprov-jdk16
-
-
- org.keycloak
- keycloak-core
- ${project.version}
-
-
- org.keycloak
- keycloak-services
- ${project.version}
-
-
-
- org.keycloak
- keycloak-social-core
- ${project.version}
-
-
- org.keycloak
- keycloak-social-google
- ${project.version}
-
-
- org.keycloak
- keycloak-social-twitter
- ${project.version}
-
-
- org.keycloak
- keycloak-social-facebook
- ${project.version}
-
-
- org.keycloak
- keycloak-forms
- ${project.version}
-
-
-
- org.jboss.logging
- jboss-logging
-
-
- org.picketlink
- picketlink-idm-api
-
-
- org.picketlink
- picketlink-common
-
-
- org.picketlink
- picketlink-idm-impl
-
-
- org.picketlink
- picketlink-idm-simple-schema
-
-
- org.picketlink
- picketlink-config
-
-
- org.jboss.resteasy
- resteasy-jaxrs
-
-
- log4j
- log4j
-
-
- org.slf4j
- slf4j-api
-
-
- org.slf4j
- slf4j-simple
-
-
-
-
- org.jboss.resteasy
- jaxrs-api
-
-
- org.jboss.resteasy
- resteasy-client
-
-
- org.jboss.resteasy
- resteasy-crypto
-
-
- org.jboss.resteasy
- jose-jwt
-
-
- org.jboss.resteasy
- resteasy-undertow
-
-
- io.undertow
- undertow-servlet
-
-
- io.undertow
- undertow-core
-
-
- org.codehaus.jackson
- jackson-core-asl
-
-
- org.codehaus.jackson
- jackson-mapper-asl
-
-
- org.jboss.spec.javax.servlet
- jboss-servlet-api_3.0_spec
-
-
- org.codehaus.jackson
- jackson-xc
-
-
- junit
- junit
-
-
- org.hibernate.javax.persistence
- hibernate-jpa-2.0-api
-
-
- com.h2database
- h2
- 1.3.161
-
-
- org.hibernate
- hibernate-entitymanager
- 3.6.6.Final
-
-
- com.icegreen
- greenmail
-
-
- org.seleniumhq.selenium
- selenium-java
-
-
- org.apache.jmeter
- ApacheJMeter_java
-
-
-
-
-
- org.apache.maven.plugins
- maven-compiler-plugin
-
-
- 1.6
-
-
-
- org.apache.maven.plugins
- maven-jar-plugin
-
-
-
- test-jar
-
-
-
-
-
-
-
-
-
- jboss-managed
-
-
- org.jboss.as
- jboss-as-arquillian-container-managed
- test
- 7.1.1.Final
-
-
-
-
- jboss-remote
-
-
- org.jboss.as
- jboss-as-arquillian-container-remote
- test
- 7.1.1.Final
-
-
-
-
-
- performance-tests
-
-
-
- com.lazerycode.jmeter
- jmeter-maven-plugin
-
-
- jmeter-tests
- verify
-
- jmeter
-
-
-
-
-
- org.keycloak
- keycloak-testsuite
- ${project.version}
- test-jar
-
-
- org.keycloak
- keycloak-services
- ${project.version}
-
-
- org.jboss.resteasy
- jaxrs-api
- ${resteasy.version}
-
-
- org.jboss.resteasy
- resteasy-jaxrs
- ${resteasy.version}
-
-
- log4j
- log4j
-
-
- org.slf4j
- slf4j-api
-
-
- org.slf4j
- slf4j-simple
-
-
- commons-io
- commons-io
-
-
-
-
- org.jboss.logging
- jboss-logging
- ${jboss.logging.version}
-
-
- org.picketlink
- picketlink-idm-impl
- ${picketlink.version}
-
-
- org.picketlink
- picketlink-idm-simple-schema
- ${picketlink.version}
-
-
- org.picketlink
- picketlink-config
- ${picketlink.version}
-
-
- org.mongodb
- mongo-java-driver
- ${mongo.driver.version}
-
-
-
-
- org.hibernate.javax.persistence
- hibernate-jpa-2.0-api
- ${hibernate.javax.persistence.version}
-
-
- com.h2database
- h2
- ${h2.version}
-
-
- org.hibernate
- hibernate-entitymanager
- ${hibernate.entitymanager.version}
-
-
- dom4j
- dom4j
- ${dom4j.version}
-
-
- org.slf4j
- slf4j-api
- ${slf4j.version}
-
-
-
-
- mysql
- mysql-connector-java
-
-
-
-
-
-
- com.lazerycode.jmeter
- jmeter-analysis-maven-plugin
-
-
- jmeter-tests-analyze
- verify
-
- analyze
-
-
-
- ${project.build.directory}/jmeter/results
- false
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-