diff --git a/authz/policy/aggregate/pom.xml b/authz/policy/aggregate/pom.xml
deleted file mode 100644
index 325b154853..0000000000
--- a/authz/policy/aggregate/pom.xml
+++ /dev/null
@@ -1,33 +0,0 @@
-
-
- 4.0.0
-
-
- org.keycloak
- keycloak-authz-provider-parent
- 2.0.0.CR1-SNAPSHOT
- ../pom.xml
-
-
- keycloak-authz-policy-aggregate
- jar
-
- KeyCloak AuthZ: Aggregate Policy Provider
- KeyCloak AuthZ: Aggregate Policy Provider
-
-
-
- org.keycloak
- keycloak-core
- provided
-
-
- org.keycloak
- keycloak-server-spi
- provided
-
-
-
-
\ No newline at end of file
diff --git a/authz/policy/aggregate/src/main/resources/META-INF/services/org.keycloak.authorization.policy.provider.PolicyProviderFactory b/authz/policy/aggregate/src/main/resources/META-INF/services/org.keycloak.authorization.policy.provider.PolicyProviderFactory
deleted file mode 100644
index d17f63ff6f..0000000000
--- a/authz/policy/aggregate/src/main/resources/META-INF/services/org.keycloak.authorization.policy.provider.PolicyProviderFactory
+++ /dev/null
@@ -1,19 +0,0 @@
-#
-# JBoss, Home of Professional Open Source.
-# Copyright 2016 Red Hat, Inc., and individual contributors
-# as indicated by the @author tags.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-org.keycloak.authorization.policy.provider.time.AggregatePolicyProviderFactory
\ No newline at end of file
diff --git a/authz/policy/user/pom.xml b/authz/policy/common/pom.xml
similarity index 52%
rename from authz/policy/user/pom.xml
rename to authz/policy/common/pom.xml
index fd5f598a86..279867ccf7 100644
--- a/authz/policy/user/pom.xml
+++ b/authz/policy/common/pom.xml
@@ -1,20 +1,20 @@
../pom.xml
- keycloak-authz-policy-user
+ keycloak-authz-policy-common
jar
- KeyCloak AuthZ: User Policy Provider
- KeyCloak AuthZ: User Policy Provider
+ KeyCloak AuthZ: Common Policy Providers
+ KeyCloak AuthZ: Common Policy Providers
diff --git a/authz/policy/aggregate/src/main/java/org/keycloak/authorization/policy/provider/time/AggregatePolicyAdminResource.java b/authz/policy/common/src/main/java/org/keycloak/authorization/policy/provider/aggregated/AggregatePolicyAdminResource.java
similarity index 64%
rename from authz/policy/aggregate/src/main/java/org/keycloak/authorization/policy/provider/time/AggregatePolicyAdminResource.java
rename to authz/policy/common/src/main/java/org/keycloak/authorization/policy/provider/aggregated/AggregatePolicyAdminResource.java
index 22ce794db4..0cfb0f9f32 100644
--- a/authz/policy/aggregate/src/main/java/org/keycloak/authorization/policy/provider/time/AggregatePolicyAdminResource.java
+++ b/authz/policy/common/src/main/java/org/keycloak/authorization/policy/provider/aggregated/AggregatePolicyAdminResource.java
@@ -1,22 +1,22 @@
/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2016 Red Hat, Inc., and individual contributors
- * as indicated by the @author tags.
+ * Copyright 2016 Red Hat, Inc. and/or its affiliates
+ * and other contributors as indicated by the @author tags.
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
*/
-package org.keycloak.authorization.policy.provider.time;
+package org.keycloak.authorization.policy.provider.aggregated;
import org.keycloak.authorization.model.Policy;
import org.keycloak.authorization.model.ResourceServer;
diff --git a/authz/policy/aggregate/src/main/java/org/keycloak/authorization/policy/provider/time/AggregatePolicyProvider.java b/authz/policy/common/src/main/java/org/keycloak/authorization/policy/provider/aggregated/AggregatePolicyProvider.java
similarity index 74%
rename from authz/policy/aggregate/src/main/java/org/keycloak/authorization/policy/provider/time/AggregatePolicyProvider.java
rename to authz/policy/common/src/main/java/org/keycloak/authorization/policy/provider/aggregated/AggregatePolicyProvider.java
index 960eb1f57b..b1e668aee3 100644
--- a/authz/policy/aggregate/src/main/java/org/keycloak/authorization/policy/provider/time/AggregatePolicyProvider.java
+++ b/authz/policy/common/src/main/java/org/keycloak/authorization/policy/provider/aggregated/AggregatePolicyProvider.java
@@ -1,27 +1,27 @@
/*
- * JBoss, Home of Professional Open Source
+ * Copyright 2016 Red Hat, Inc. and/or its affiliates
+ * and other contributors as indicated by the @author tags.
*
- * Copyright 2015 Red Hat, Inc. and/or its affiliates.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
*/
-package org.keycloak.authorization.policy.provider.time;
+package org.keycloak.authorization.policy.provider.aggregated;
import org.keycloak.authorization.AuthorizationProvider;
import org.keycloak.authorization.model.Policy;
import org.keycloak.authorization.policy.evaluation.DecisionResultCollector;
-import org.keycloak.authorization.policy.evaluation.Evaluation;
import org.keycloak.authorization.policy.evaluation.DefaultEvaluation;
+import org.keycloak.authorization.policy.evaluation.Evaluation;
import org.keycloak.authorization.policy.evaluation.Result;
import org.keycloak.authorization.policy.provider.PolicyProvider;
import org.keycloak.authorization.policy.provider.PolicyProviderFactory;
diff --git a/authz/policy/aggregate/src/main/java/org/keycloak/authorization/policy/provider/time/AggregatePolicyProviderFactory.java b/authz/policy/common/src/main/java/org/keycloak/authorization/policy/provider/aggregated/AggregatePolicyProviderFactory.java
similarity index 67%
rename from authz/policy/aggregate/src/main/java/org/keycloak/authorization/policy/provider/time/AggregatePolicyProviderFactory.java
rename to authz/policy/common/src/main/java/org/keycloak/authorization/policy/provider/aggregated/AggregatePolicyProviderFactory.java
index b4f5d9753d..9c7faad5f8 100644
--- a/authz/policy/aggregate/src/main/java/org/keycloak/authorization/policy/provider/time/AggregatePolicyProviderFactory.java
+++ b/authz/policy/common/src/main/java/org/keycloak/authorization/policy/provider/aggregated/AggregatePolicyProviderFactory.java
@@ -1,4 +1,21 @@
-package org.keycloak.authorization.policy.provider.time;
+/*
+ * Copyright 2016 Red Hat, Inc. and/or its affiliates
+ * and other contributors as indicated by the @author tags.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.keycloak.authorization.policy.provider.aggregated;
import org.keycloak.Config;
import org.keycloak.authorization.AuthorizationProvider;
diff --git a/authz/policy/javascript/src/main/java/org/keycloak/authorization/policy/provider/js/JSPolicyProvider.java b/authz/policy/common/src/main/java/org/keycloak/authorization/policy/provider/js/JSPolicyProvider.java
similarity index 100%
rename from authz/policy/javascript/src/main/java/org/keycloak/authorization/policy/provider/js/JSPolicyProvider.java
rename to authz/policy/common/src/main/java/org/keycloak/authorization/policy/provider/js/JSPolicyProvider.java
diff --git a/authz/policy/javascript/src/main/java/org/keycloak/authorization/policy/provider/js/JSPolicyProviderFactory.java b/authz/policy/common/src/main/java/org/keycloak/authorization/policy/provider/js/JSPolicyProviderFactory.java
similarity index 100%
rename from authz/policy/javascript/src/main/java/org/keycloak/authorization/policy/provider/js/JSPolicyProviderFactory.java
rename to authz/policy/common/src/main/java/org/keycloak/authorization/policy/provider/js/JSPolicyProviderFactory.java
diff --git a/authz/policy/resource/src/main/java/org/keycloak/authorization/policy/provider/resource/ResourcePolicyProvider.java b/authz/policy/common/src/main/java/org/keycloak/authorization/policy/provider/resource/ResourcePolicyProvider.java
similarity index 100%
rename from authz/policy/resource/src/main/java/org/keycloak/authorization/policy/provider/resource/ResourcePolicyProvider.java
rename to authz/policy/common/src/main/java/org/keycloak/authorization/policy/provider/resource/ResourcePolicyProvider.java
diff --git a/authz/policy/resource/src/main/java/org/keycloak/authorization/policy/provider/resource/ResourcePolicyProviderFactory.java b/authz/policy/common/src/main/java/org/keycloak/authorization/policy/provider/resource/ResourcePolicyProviderFactory.java
similarity index 100%
rename from authz/policy/resource/src/main/java/org/keycloak/authorization/policy/provider/resource/ResourcePolicyProviderFactory.java
rename to authz/policy/common/src/main/java/org/keycloak/authorization/policy/provider/resource/ResourcePolicyProviderFactory.java
diff --git a/authz/policy/role/src/main/java/org/keycloak/authorization/policy/provider/identity/RolePolicyProvider.java b/authz/policy/common/src/main/java/org/keycloak/authorization/policy/provider/role/RolePolicyProvider.java
similarity index 65%
rename from authz/policy/role/src/main/java/org/keycloak/authorization/policy/provider/identity/RolePolicyProvider.java
rename to authz/policy/common/src/main/java/org/keycloak/authorization/policy/provider/role/RolePolicyProvider.java
index f6711536e1..af5f322cd2 100644
--- a/authz/policy/role/src/main/java/org/keycloak/authorization/policy/provider/identity/RolePolicyProvider.java
+++ b/authz/policy/common/src/main/java/org/keycloak/authorization/policy/provider/role/RolePolicyProvider.java
@@ -1,21 +1,21 @@
/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2016 Red Hat, Inc., and individual contributors
- * as indicated by the @author tags.
+ * Copyright 2016 Red Hat, Inc. and/or its affiliates
+ * and other contributors as indicated by the @author tags.
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
*/
-package org.keycloak.authorization.policy.provider.identity;
+package org.keycloak.authorization.policy.provider.role;
import org.keycloak.authorization.AuthorizationProvider;
import org.keycloak.authorization.identity.Identity;
@@ -26,7 +26,7 @@ import org.keycloak.authorization.policy.provider.PolicyProvider;
import org.keycloak.models.RealmModel;
import org.keycloak.models.RoleModel;
-import static org.keycloak.authorization.policy.provider.identity.RolePolicyProviderFactory.getRoles;
+import static org.keycloak.authorization.policy.provider.role.RolePolicyProviderFactory.getRoles;
/**
* @author Pedro Igor
diff --git a/authz/policy/role/src/main/java/org/keycloak/authorization/policy/provider/identity/RolePolicyProviderFactory.java b/authz/policy/common/src/main/java/org/keycloak/authorization/policy/provider/role/RolePolicyProviderFactory.java
similarity index 83%
rename from authz/policy/role/src/main/java/org/keycloak/authorization/policy/provider/identity/RolePolicyProviderFactory.java
rename to authz/policy/common/src/main/java/org/keycloak/authorization/policy/provider/role/RolePolicyProviderFactory.java
index 2aa8c803b0..598a41ef20 100644
--- a/authz/policy/role/src/main/java/org/keycloak/authorization/policy/provider/identity/RolePolicyProviderFactory.java
+++ b/authz/policy/common/src/main/java/org/keycloak/authorization/policy/provider/role/RolePolicyProviderFactory.java
@@ -1,22 +1,22 @@
/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2016 Red Hat, Inc., and individual contributors
- * as indicated by the @author tags.
+ * Copyright 2016 Red Hat, Inc. and/or its affiliates
+ * and other contributors as indicated by the @author tags.
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
*/
-package org.keycloak.authorization.policy.provider.identity;
+package org.keycloak.authorization.policy.provider.role;
import org.keycloak.Config;
import org.keycloak.authorization.AuthorizationProvider;
diff --git a/authz/policy/scope/src/main/java/org/keycloak/authorization/policy/provider/scope/ScopePolicyProvider.java b/authz/policy/common/src/main/java/org/keycloak/authorization/policy/provider/scope/ScopePolicyProvider.java
similarity index 100%
rename from authz/policy/scope/src/main/java/org/keycloak/authorization/policy/provider/scope/ScopePolicyProvider.java
rename to authz/policy/common/src/main/java/org/keycloak/authorization/policy/provider/scope/ScopePolicyProvider.java
diff --git a/authz/policy/scope/src/main/java/org/keycloak/authorization/policy/provider/scope/ScopePolicyProviderFactory.java b/authz/policy/common/src/main/java/org/keycloak/authorization/policy/provider/scope/ScopePolicyProviderFactory.java
similarity index 100%
rename from authz/policy/scope/src/main/java/org/keycloak/authorization/policy/provider/scope/ScopePolicyProviderFactory.java
rename to authz/policy/common/src/main/java/org/keycloak/authorization/policy/provider/scope/ScopePolicyProviderFactory.java
diff --git a/authz/policy/time/src/main/java/org/keycloak/authorization/policy/provider/time/TimePolicyAdminResource.java b/authz/policy/common/src/main/java/org/keycloak/authorization/policy/provider/time/TimePolicyAdminResource.java
similarity index 100%
rename from authz/policy/time/src/main/java/org/keycloak/authorization/policy/provider/time/TimePolicyAdminResource.java
rename to authz/policy/common/src/main/java/org/keycloak/authorization/policy/provider/time/TimePolicyAdminResource.java
diff --git a/authz/policy/time/src/main/java/org/keycloak/authorization/policy/provider/time/TimePolicyProvider.java b/authz/policy/common/src/main/java/org/keycloak/authorization/policy/provider/time/TimePolicyProvider.java
similarity index 100%
rename from authz/policy/time/src/main/java/org/keycloak/authorization/policy/provider/time/TimePolicyProvider.java
rename to authz/policy/common/src/main/java/org/keycloak/authorization/policy/provider/time/TimePolicyProvider.java
diff --git a/authz/policy/time/src/main/java/org/keycloak/authorization/policy/provider/time/TimePolicyProviderFactory.java b/authz/policy/common/src/main/java/org/keycloak/authorization/policy/provider/time/TimePolicyProviderFactory.java
similarity index 100%
rename from authz/policy/time/src/main/java/org/keycloak/authorization/policy/provider/time/TimePolicyProviderFactory.java
rename to authz/policy/common/src/main/java/org/keycloak/authorization/policy/provider/time/TimePolicyProviderFactory.java
diff --git a/authz/policy/user/src/main/java/org/keycloak/authorization/policy/provider/identity/UserPolicyProvider.java b/authz/policy/common/src/main/java/org/keycloak/authorization/policy/provider/user/UserPolicyProvider.java
similarity index 51%
rename from authz/policy/user/src/main/java/org/keycloak/authorization/policy/provider/identity/UserPolicyProvider.java
rename to authz/policy/common/src/main/java/org/keycloak/authorization/policy/provider/user/UserPolicyProvider.java
index 6416d0683b..a6fc0a48c3 100644
--- a/authz/policy/user/src/main/java/org/keycloak/authorization/policy/provider/identity/UserPolicyProvider.java
+++ b/authz/policy/common/src/main/java/org/keycloak/authorization/policy/provider/user/UserPolicyProvider.java
@@ -1,31 +1,28 @@
/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2016 Red Hat, Inc., and individual contributors
- * as indicated by the @author tags.
+ * Copyright 2016 Red Hat, Inc. and/or its affiliates
+ * and other contributors as indicated by the @author tags.
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
*/
-package org.keycloak.authorization.policy.provider.identity;
+package org.keycloak.authorization.policy.provider.user;
import org.keycloak.authorization.model.Policy;
import org.keycloak.authorization.policy.evaluation.Evaluation;
import org.keycloak.authorization.policy.evaluation.EvaluationContext;
import org.keycloak.authorization.policy.provider.PolicyProvider;
-import org.keycloak.util.JsonSerialization;
-import java.io.IOException;
-
-import static org.keycloak.authorization.policy.provider.identity.UserPolicyProviderFactory.getUsers;
+import static org.keycloak.authorization.policy.provider.user.UserPolicyProviderFactory.getUsers;
/**
* @author Pedro Igor
diff --git a/authz/policy/user/src/main/java/org/keycloak/authorization/policy/provider/identity/UserPolicyProviderFactory.java b/authz/policy/common/src/main/java/org/keycloak/authorization/policy/provider/user/UserPolicyProviderFactory.java
similarity index 83%
rename from authz/policy/user/src/main/java/org/keycloak/authorization/policy/provider/identity/UserPolicyProviderFactory.java
rename to authz/policy/common/src/main/java/org/keycloak/authorization/policy/provider/user/UserPolicyProviderFactory.java
index 3cd8bb3f7a..946147474f 100644
--- a/authz/policy/user/src/main/java/org/keycloak/authorization/policy/provider/identity/UserPolicyProviderFactory.java
+++ b/authz/policy/common/src/main/java/org/keycloak/authorization/policy/provider/user/UserPolicyProviderFactory.java
@@ -1,22 +1,22 @@
/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2016 Red Hat, Inc., and individual contributors
- * as indicated by the @author tags.
+ * Copyright 2016 Red Hat, Inc. and/or its affiliates
+ * and other contributors as indicated by the @author tags.
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
*/
-package org.keycloak.authorization.policy.provider.identity;
+package org.keycloak.authorization.policy.provider.user;
import org.keycloak.Config;
import org.keycloak.authorization.AuthorizationProvider;
diff --git a/authz/policy/common/src/main/resources/META-INF/services/org.keycloak.authorization.policy.provider.PolicyProviderFactory b/authz/policy/common/src/main/resources/META-INF/services/org.keycloak.authorization.policy.provider.PolicyProviderFactory
new file mode 100644
index 0000000000..1e8dfd20cb
--- /dev/null
+++ b/authz/policy/common/src/main/resources/META-INF/services/org.keycloak.authorization.policy.provider.PolicyProviderFactory
@@ -0,0 +1,43 @@
+#
+# Copyright 2016 Red Hat, Inc. and/or its affiliates
+# and other contributors as indicated by the @author tags.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#
+
+#
+# JBoss, Home of Professional Open Source.
+# Copyright 2016 Red Hat, Inc., and individual contributors
+# as indicated by the @author tags.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+org.keycloak.authorization.policy.provider.aggregated.AggregatePolicyProviderFactory
+org.keycloak.authorization.policy.provider.js.JSPolicyProviderFactory
+org.keycloak.authorization.policy.provider.resource.ResourcePolicyProviderFactory
+org.keycloak.authorization.policy.provider.role.RolePolicyProviderFactory
+org.keycloak.authorization.policy.provider.scope.ScopePolicyProviderFactory
+org.keycloak.authorization.policy.provider.time.TimePolicyProviderFactory
+org.keycloak.authorization.policy.provider.user.UserPolicyProviderFactory
\ No newline at end of file
diff --git a/authz/policy/javascript/pom.xml b/authz/policy/javascript/pom.xml
deleted file mode 100644
index 53e35ee25b..0000000000
--- a/authz/policy/javascript/pom.xml
+++ /dev/null
@@ -1,33 +0,0 @@
-
-
- 4.0.0
-
-
- org.keycloak
- keycloak-authz-provider-parent
- 2.0.0.CR1-SNAPSHOT
- ../pom.xml
-
-
- keycloak-authz-policy-js
- jar
-
- KeyCloak AuthZ: Javascript-based Policy Provider
- KeyCloak AuthZ: Javascript-based Policy Provider
-
-
-
- org.keycloak
- keycloak-core
- provided
-
-
- org.keycloak
- keycloak-server-spi
- provided
-
-
-
-
\ No newline at end of file
diff --git a/authz/policy/javascript/src/main/resources/META-INF/services/org.keycloak.authorization.policy.provider.PolicyProviderFactory b/authz/policy/javascript/src/main/resources/META-INF/services/org.keycloak.authorization.policy.provider.PolicyProviderFactory
deleted file mode 100644
index 09d56cc16f..0000000000
--- a/authz/policy/javascript/src/main/resources/META-INF/services/org.keycloak.authorization.policy.provider.PolicyProviderFactory
+++ /dev/null
@@ -1,19 +0,0 @@
-#
-# JBoss, Home of Professional Open Source.
-# Copyright 2016 Red Hat, Inc., and individual contributors
-# as indicated by the @author tags.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-org.keycloak.authorization.policy.provider.js.JSPolicyProviderFactory
\ No newline at end of file
diff --git a/authz/policy/pom.xml b/authz/policy/pom.xml
index 64766a4cb6..a867c64f4f 100644
--- a/authz/policy/pom.xml
+++ b/authz/policy/pom.xml
@@ -18,14 +18,8 @@
KeyCloak AuthZ: Provider Parent
- user
- role
+ common
drools
- resource
- scope
- javascript
- time
- aggregate
\ No newline at end of file
diff --git a/authz/policy/resource/pom.xml b/authz/policy/resource/pom.xml
deleted file mode 100644
index b59226d3fa..0000000000
--- a/authz/policy/resource/pom.xml
+++ /dev/null
@@ -1,33 +0,0 @@
-
-
- 4.0.0
-
-
- org.keycloak
- keycloak-authz-provider-parent
- 2.0.0.CR1-SNAPSHOT
- ../pom.xml
-
-
- keycloak-authz-policy-resource
- jar
-
- KeyCloak Authz: Resource Policy Provider
- KeyCloak Authz: Resource Policy Provider
-
-
-
- org.keycloak
- keycloak-core
- provided
-
-
- org.keycloak
- keycloak-server-spi
- provided
-
-
-
-
\ No newline at end of file
diff --git a/authz/policy/resource/src/main/resources/META-INF/services/org.keycloak.authorization.policy.provider.PolicyProviderFactory b/authz/policy/resource/src/main/resources/META-INF/services/org.keycloak.authorization.policy.provider.PolicyProviderFactory
deleted file mode 100644
index c5c6976d2a..0000000000
--- a/authz/policy/resource/src/main/resources/META-INF/services/org.keycloak.authorization.policy.provider.PolicyProviderFactory
+++ /dev/null
@@ -1,19 +0,0 @@
-#
-# JBoss, Home of Professional Open Source.
-# Copyright 2016 Red Hat, Inc., and individual contributors
-# as indicated by the @author tags.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-org.keycloak.authorization.policy.provider.resource.ResourcePolicyProviderFactory
\ No newline at end of file
diff --git a/authz/policy/role/pom.xml b/authz/policy/role/pom.xml
deleted file mode 100644
index 64bbbd21e5..0000000000
--- a/authz/policy/role/pom.xml
+++ /dev/null
@@ -1,51 +0,0 @@
-
-
-
-
- 4.0.0
-
-
- org.keycloak
- keycloak-authz-provider-parent
- 2.0.0.CR1-SNAPSHOT
- ../pom.xml
-
-
- keycloak-authz-policy-role
- jar
-
- KeyCloak AuthZ: Role Policy Provider
- KeyCloak AuthZ: Role Policy Provider
-
-
-
- org.keycloak
- keycloak-core
- provided
-
-
- org.keycloak
- keycloak-server-spi
- provided
-
-
-
-
\ No newline at end of file
diff --git a/authz/policy/role/src/main/resources/META-INF/services/org.keycloak.authorization.policy.provider.PolicyProviderFactory b/authz/policy/role/src/main/resources/META-INF/services/org.keycloak.authorization.policy.provider.PolicyProviderFactory
deleted file mode 100644
index bdfa0396d2..0000000000
--- a/authz/policy/role/src/main/resources/META-INF/services/org.keycloak.authorization.policy.provider.PolicyProviderFactory
+++ /dev/null
@@ -1,19 +0,0 @@
-#
-# JBoss, Home of Professional Open Source.
-# Copyright 2016 Red Hat, Inc., and individual contributors
-# as indicated by the @author tags.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-org.keycloak.authorization.policy.provider.identity.RolePolicyProviderFactory
\ No newline at end of file
diff --git a/authz/policy/scope/pom.xml b/authz/policy/scope/pom.xml
deleted file mode 100644
index f51802bf54..0000000000
--- a/authz/policy/scope/pom.xml
+++ /dev/null
@@ -1,33 +0,0 @@
-
-
- 4.0.0
-
-
- org.keycloak
- keycloak-authz-provider-parent
- 2.0.0.CR1-SNAPSHOT
- ../pom.xml
-
-
- keycloak-authz-policy-scope
- jar
-
- KeyCloak AuthZ: Scope Policy Provider
- KeyCloak AuthZ: Scope Policy Provider
-
-
-
- org.keycloak
- keycloak-core
- provided
-
-
- org.keycloak
- keycloak-server-spi
- provided
-
-
-
-
\ No newline at end of file
diff --git a/authz/policy/scope/src/main/resources/META-INF/services/org.keycloak.authorization.policy.provider.PolicyProviderFactory b/authz/policy/scope/src/main/resources/META-INF/services/org.keycloak.authorization.policy.provider.PolicyProviderFactory
deleted file mode 100644
index b3adce4e10..0000000000
--- a/authz/policy/scope/src/main/resources/META-INF/services/org.keycloak.authorization.policy.provider.PolicyProviderFactory
+++ /dev/null
@@ -1,19 +0,0 @@
-#
-# JBoss, Home of Professional Open Source.
-# Copyright 2016 Red Hat, Inc., and individual contributors
-# as indicated by the @author tags.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-org.keycloak.authorization.policy.provider.scope.ScopePolicyProviderFactory
\ No newline at end of file
diff --git a/authz/policy/time/pom.xml b/authz/policy/time/pom.xml
deleted file mode 100644
index 9d1abcf639..0000000000
--- a/authz/policy/time/pom.xml
+++ /dev/null
@@ -1,32 +0,0 @@
-
-
- 4.0.0
-
-
- org.keycloak
- keycloak-authz-provider-parent
- 2.0.0.CR1-SNAPSHOT
- ../pom.xml
-
-
- keycloak-authz-policy-time
- jar
-
- KeyCloak AuthZ: Time-based Policy Provider
- KeyCloak AuthZ: Time-based Policy Provider
-
-
-
- org.keycloak
- keycloak-core
- provided
-
-
- org.keycloak
- keycloak-server-spi
- provided
-
-
-
\ No newline at end of file
diff --git a/authz/policy/time/src/main/resources/META-INF/services/org.keycloak.authorization.policy.provider.PolicyProviderFactory b/authz/policy/time/src/main/resources/META-INF/services/org.keycloak.authorization.policy.provider.PolicyProviderFactory
deleted file mode 100644
index 7f1ab27a72..0000000000
--- a/authz/policy/time/src/main/resources/META-INF/services/org.keycloak.authorization.policy.provider.PolicyProviderFactory
+++ /dev/null
@@ -1,19 +0,0 @@
-#
-# JBoss, Home of Professional Open Source.
-# Copyright 2016 Red Hat, Inc., and individual contributors
-# as indicated by the @author tags.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-org.keycloak.authorization.policy.provider.time.TimePolicyProviderFactory
\ No newline at end of file
diff --git a/authz/policy/user/src/main/resources/META-INF/services/org.keycloak.authorization.policy.provider.PolicyProviderFactory b/authz/policy/user/src/main/resources/META-INF/services/org.keycloak.authorization.policy.provider.PolicyProviderFactory
deleted file mode 100644
index 33608eebd6..0000000000
--- a/authz/policy/user/src/main/resources/META-INF/services/org.keycloak.authorization.policy.provider.PolicyProviderFactory
+++ /dev/null
@@ -1,19 +0,0 @@
-#
-# JBoss, Home of Professional Open Source.
-# Copyright 2016 Red Hat, Inc., and individual contributors
-# as indicated by the @author tags.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-org.keycloak.authorization.policy.provider.identity.UserPolicyProviderFactory
\ No newline at end of file
diff --git a/dependencies/server-all/pom.xml b/dependencies/server-all/pom.xml
index f989be1275..25887bc357 100755
--- a/dependencies/server-all/pom.xml
+++ b/dependencies/server-all/pom.xml
@@ -89,37 +89,7 @@
org.keycloak
- keycloak-authz-policy-resource
- ${project.version}
-
-
- org.keycloak
- keycloak-authz-policy-scope
- ${project.version}
-
-
- org.keycloak
- keycloak-authz-policy-user
- ${project.version}
-
-
- org.keycloak
- keycloak-authz-policy-role
- ${project.version}
-
-
- org.keycloak
- keycloak-authz-policy-js
- ${project.version}
-
-
- org.keycloak
- keycloak-authz-policy-time
- ${project.version}
-
-
- org.keycloak
- keycloak-authz-policy-aggregate
+ keycloak-authz-policy-common
${project.version}
diff --git a/distribution/feature-packs/server-feature-pack/src/main/resources/modules/system/layers/keycloak-authz/org/keycloak/keycloak-authz-policy-provider/main/module.xml b/distribution/feature-packs/server-feature-pack/src/main/resources/modules/system/layers/keycloak-authz/org/keycloak/keycloak-authz-policy-provider/main/module.xml
deleted file mode 100644
index 5500a82646..0000000000
--- a/distribution/feature-packs/server-feature-pack/src/main/resources/modules/system/layers/keycloak-authz/org/keycloak/keycloak-authz-policy-provider/main/module.xml
+++ /dev/null
@@ -1,41 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/distribution/feature-packs/server-feature-pack/src/main/resources/modules/system/layers/keycloak-authz/org/drools/main/module.xml b/distribution/feature-packs/server-feature-pack/src/main/resources/modules/system/layers/keycloak/org/drools/main/module.xml
similarity index 100%
rename from distribution/feature-packs/server-feature-pack/src/main/resources/modules/system/layers/keycloak-authz/org/drools/main/module.xml
rename to distribution/feature-packs/server-feature-pack/src/main/resources/modules/system/layers/keycloak/org/drools/main/module.xml
diff --git a/distribution/feature-packs/server-feature-pack/src/main/resources/modules/system/layers/keycloak/org/keycloak/keycloak-authz-policy-common/main/module.xml b/distribution/feature-packs/server-feature-pack/src/main/resources/modules/system/layers/keycloak/org/keycloak/keycloak-authz-policy-common/main/module.xml
new file mode 100644
index 0000000000..ced09b5668
--- /dev/null
+++ b/distribution/feature-packs/server-feature-pack/src/main/resources/modules/system/layers/keycloak/org/keycloak/keycloak-authz-policy-common/main/module.xml
@@ -0,0 +1,32 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/distribution/feature-packs/server-feature-pack/src/main/resources/modules/system/layers/keycloak-authz/org/keycloak/keycloak-authz-policy-drools/main/module.xml b/distribution/feature-packs/server-feature-pack/src/main/resources/modules/system/layers/keycloak/org/keycloak/keycloak-authz-policy-drools/main/module.xml
similarity index 100%
rename from distribution/feature-packs/server-feature-pack/src/main/resources/modules/system/layers/keycloak-authz/org/keycloak/keycloak-authz-policy-drools/main/module.xml
rename to distribution/feature-packs/server-feature-pack/src/main/resources/modules/system/layers/keycloak/org/keycloak/keycloak-authz-policy-drools/main/module.xml
diff --git a/distribution/feature-packs/server-feature-pack/src/main/resources/modules/system/layers/keycloak-authz/org/keycloak/keycloak-authz-server/main/module.xml b/distribution/feature-packs/server-feature-pack/src/main/resources/modules/system/layers/keycloak/org/keycloak/keycloak-authz-server/main/module.xml
similarity index 72%
rename from distribution/feature-packs/server-feature-pack/src/main/resources/modules/system/layers/keycloak-authz/org/keycloak/keycloak-authz-server/main/module.xml
rename to distribution/feature-packs/server-feature-pack/src/main/resources/modules/system/layers/keycloak/org/keycloak/keycloak-authz-server/main/module.xml
index ab9ef984b2..6f5a540274 100644
--- a/distribution/feature-packs/server-feature-pack/src/main/resources/modules/system/layers/keycloak-authz/org/keycloak/keycloak-authz-server/main/module.xml
+++ b/distribution/feature-packs/server-feature-pack/src/main/resources/modules/system/layers/keycloak/org/keycloak/keycloak-authz-server/main/module.xml
@@ -3,7 +3,7 @@
-
+
diff --git a/distribution/server-dist/src/main/modules/layers.conf b/distribution/server-dist/src/main/modules/layers.conf
index afb302443c..74f44850c7 100644
--- a/distribution/server-dist/src/main/modules/layers.conf
+++ b/distribution/server-dist/src/main/modules/layers.conf
@@ -1 +1 @@
-layers=keycloak,keycloak-authz
\ No newline at end of file
+layers=keycloak
\ No newline at end of file
diff --git a/distribution/server-overlay/assembly.xml b/distribution/server-overlay/assembly.xml
index 3c6c25dd23..325cadff19 100755
--- a/distribution/server-overlay/assembly.xml
+++ b/distribution/server-overlay/assembly.xml
@@ -37,6 +37,7 @@
org/liquibase/**
org/mongodb/**
org/twitter4j/**
+ org/drools/**
sun/jdk/jgss/**
diff --git a/pom.xml b/pom.xml
index 0e2b3ffc58..1b2dd37e4f 100755
--- a/pom.xml
+++ b/pom.xml
@@ -1010,32 +1010,7 @@
org.keycloak
- keycloak-authz-policy-resource
- ${project.version}
-
-
- org.keycloak
- keycloak-authz-policy-scope
- ${project.version}
-
-
- org.keycloak
- keycloak-authz-policy-identity
- ${project.version}
-
-
- org.keycloak
- keycloak-authz-policy-js
- ${project.version}
-
-
- org.keycloak
- keycloak-authz-policy-time
- ${project.version}
-
-
- org.keycloak
- keycloak-authz-policy-aggregate
+ keycloak-authz-policy-common
${project.version}