Repository: gravitee-io/graviteeio-access-management
Pull request #686 (2019-11-29 15:03:38)

fix(management): use the new sync process for the management part
fixes gravitee-io/issues#2953


Patch:
diff --git a/gravitee-am-model/src/main/java/io/gravitee/am/model/common/event/Action.java b/gravitee-am-common/src/main/java/io/gravitee/am/common/event/Action.java
similarity index 95%
rename from gravitee-am-model/src/main/java/io/gravitee/am/model/common/event/Action.java
rename to gravitee-am-common/src/main/java/io/gravitee/am/common/event/Action.java
index 089d11d9cb..80722bc098 100644
--- a/gravitee-am-model/src/main/java/io/gravitee/am/model/common/event/Action.java
+++ b/gravitee-am-common/src/main/java/io/gravitee/am/common/event/Action.java
@@ -13,7 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package io.gravitee.am.model.common.event;
+package io.gravitee.am.common.event;
 
 /**
  * @author Titouan COMPIEGNE (titouan.compiegne at graviteesource.com)
diff --git a/gravitee-am-gateway/gravitee-am-gateway-core/src/main/java/io/gravitee/am/gateway/core/event/CertificateEvent.java b/gravitee-am-common/src/main/java/io/gravitee/am/common/event/CertificateEvent.java
similarity index 93%
rename from gravitee-am-gateway/gravitee-am-gateway-core/src/main/java/io/gravitee/am/gateway/core/event/CertificateEvent.java
rename to gravitee-am-common/src/main/java/io/gravitee/am/common/event/CertificateEvent.java
index ccc430c2ff..b3c5f0cb19 100644
--- a/gravitee-am-gateway/gravitee-am-gateway-core/src/main/java/io/gravitee/am/gateway/core/event/CertificateEvent.java
+++ b/gravitee-am-common/src/main/java/io/gravitee/am/common/event/CertificateEvent.java
@@ -13,9 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package io.gravitee.am.gateway.core.event;
-
-import io.gravitee.am.model.common.event.Action;
+package io.gravitee.am.common.event;
 
 /**
  * @author Titouan COMPIEGNE (titouan.compiegne at graviteesource.com)
diff --git a/gravitee-am-gateway/gravitee-am-gateway-core/src/main/java/io/gravitee/am/gateway/core/event/ClientEvent.java b/gravitee-am-common/src/main/java/io/gravitee/am/common/event/ClientEvent.java
similarity index 93%
rename from gravitee-am-gateway/gravitee-am-gateway-core/src/main/java/io/gravitee/am/gateway/core/event/ClientEvent.java
rename to gravitee-am-common/src/main/java/io/gravitee/am/common/event/ClientEvent.java
index 46a787580d..8fe8e26b8e 100644
--- a/gravitee-am-gateway/gravitee-am-gateway-core/src/main/java/io/gravitee/am/gateway/core/event/ClientEvent.java
+++ b/gravitee-am-common/src/main/java/io/gravitee/am/common/event/ClientEvent.java
@@ -13,9 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package io.gravitee.am.gateway.core.event;
-
-import io.gravitee.am.model.common.event.Action;
+package io.gravitee.am.common.event;
 
 /**
  * @author Titouan COMPIEGNE (titouan.compiegne at graviteesource.com)
diff --git a/gravitee-am-gateway/gravitee-am-gateway-core/src/main/java/io/gravitee/am/gateway/core/event/DomainEvent.java b/gravitee-am-common/src/main/java/io/gravitee/am/common/event/DomainEvent.java
similarity index 93%
rename from gravitee-am-gateway/gravitee-am-gateway-core/src/main/java/io/gravitee/am/gateway/core/event/DomainEvent.java
rename to gravitee-am-common/src/main/java/io/gravitee/am/common/event/DomainEvent.java
index 5c30f7af6c..0a7229e643 100644
--- a/gravitee-am-gateway/gravitee-am-gateway-core/src/main/java/io/gravitee/am/gateway/core/event/DomainEvent.java
+++ b/gravitee-am-common/src/main/java/io/gravitee/am/common/event/DomainEvent.java
@@ -13,9 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package io.gravitee.am.gateway.core.event;
-
-import io.gravitee.am.model.common.event.Action;
+package io.gravitee.am.common.event;
 
 /**
  * @author David BRASSELY (david.brassely at graviteesource.com)
diff --git a/gravitee-am-gateway/gravitee-am-gateway-core/src/main/java/io/gravitee/am/gateway/core/event/EmailEvent.java b/gravitee-am-common/src/main/java/io/gravitee/am/common/event/EmailEvent.java
similarity index 93%
rename from gravitee-am-gateway/gravitee-am-gateway-core/src/main/java/io/gravitee/am/gateway/core/event/EmailEvent.java
rename to gravitee-am-common/src/main/java/io/gravitee/am/common/event/EmailEvent.java
index 79a29d2084..5e5920a46c 100644
--- a/gravitee-am-gateway/gravitee-am-gateway-core/src/main/java/io/gravitee/am/gateway/core/event/EmailEvent.java
+++ b/gravitee-am-common/src/main/java/io/gravitee/am/common/event/EmailEvent.java
@@ -13,9 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package io.gravitee.am.gateway.core.event;
-
-import io.gravitee.am.model.common.event.Action;
+package io.gravitee.am.common.event;
 
 /**
  * @author Titouan COMPIEGNE (titouan.compiegne at graviteesource.com)
diff --git a/gravitee-am-gateway/gravitee-am-gateway-core/src/main/java/io/gravitee/am/gateway/core/event/Event.java b/gravitee-am-common/src/main/java/io/gravitee/am/common/event/Event.java
similarity index 55%
rename from gravitee-am-gateway/gravitee-am-gateway-core/src/main/java/io/gravitee/am/gateway/core/event/Event.java
rename to gravitee-am-common/src/main/java/io/gravitee/am/common/event/Event.java
index df48f082b0..2b3c6756e1 100644
--- a/gravitee-am-gateway/gravitee-am-gateway-core/src/main/java/io/gravitee/am/gateway/core/event/Event.java
+++ b/gravitee-am-common/src/main/java/io/gravitee/am/common/event/Event.java
@@ -13,7 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package io.gravitee.am.gateway.core.event;
+package io.gravitee.am.common.event;
 
 /**
  * @author Titouan COMPIEGNE (titouan.compiegne at graviteesource.com)
@@ -21,44 +21,44 @@ package io.gravitee.am.gateway.core.event;
  */
 public abstract class Event {
 
-    public static Enum valueOf(io.gravitee.am.model.common.event.Event event) {
+    public static Enum valueOf(Type type, Action action) {
         Enum event1 = null;
-        switch (event.getType()) {
+        switch (type) {
             case DOMAIN:
-                event1 =  DomainEvent.actionOf(event.getPayload().getAction());
+                event1 =  DomainEvent.actionOf(action);
                 break;
             case CLIENT:
-                event1 =  ClientEvent.actionOf(event.getPayload().getAction());
+                event1 =  ClientEvent.actionOf(action);
                 break;
             case CERTIFICATE:
-                event1 =  CertificateEvent.actionOf(event.getPayload().getAction());
+                event1 =  CertificateEvent.actionOf(action);
                 break;
             case EXTENSION_GRANT:
-                event1 =  ExtensionGrantEvent.actionOf(event.getPayload().getAction());
+                event1 =  ExtensionGrantEvent.actionOf(action);
                 break;
             case IDENTITY_PROVIDER:
-                event1 =  IdentityProviderEvent.actionOf(event.getPayload().getAction());
+                event1 =  IdentityProviderEvent.actionOf(action);
                 break;
             case ROLE:
-                event1 =  RoleEvent.actionOf(event.getPayload().getAction());
+                event1 =  RoleEvent.actionOf(action);
                 break;
             case SCOPE:
-                event1 =  ScopeEvent.actionOf(event.getPayload().getAction());
+                event1 =  ScopeEvent.actionOf(action);
                 break;
             case FORM:
-                event1 =  FormEvent.actionOf(event.getPayload().getAction());
+                event1 =  FormEvent.actionOf(action);
                 break;
             case EMAIL:
-                event1 =  EmailEvent.actionOf(event.getPayload().getAction());
+                event1 =  EmailEvent.actionOf(action);
                 break;
             case REPORTER:
-                event1 =  ReporterEvent.actionOf(event.getPayload().getAction());
+                event1 =  ReporterEvent.actionOf(action);
                 break;
             case POLICY:
-                event1 =  PolicyEvent.actionOf(event.getPayload().getAction());
+                event1 =  PolicyEvent.actionOf(action);
                 break;
             case USER:
-                event1 =  UserEvent.actionOf(event.getPayload().getAction());
+                event1 =  UserEvent.actionOf(action);
                 break;
         }
 
diff --git a/gravitee-am-gateway/gravitee-am-gateway-core/src/main/java/io/gravitee/am/gateway/core/event/EventManager.java b/gravitee-am-common/src/main/java/io/gravitee/am/common/event/EventManager.java
similarity index 96%
rename from gravitee-am-gateway/gravitee-am-gateway-core/src/main/java/io/gravitee/am/gateway/core/event/EventManager.java
rename to gravitee-am-common/src/main/java/io/gravitee/am/common/event/EventManager.java
index 21db3cd4cd..9dcb473457 100644
--- a/gravitee-am-gateway/gravitee-am-gateway-core/src/main/java/io/gravitee/am/gateway/core/event/EventManager.java
+++ b/gravitee-am-common/src/main/java/io/gravitee/am/common/event/EventManager.java
@@ -13,7 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package io.gravitee.am.gateway.core.event;
+package io.gravitee.am.common.event;
 
 /**
  * Event manager for AM gateway context
diff --git a/gravitee-am-gateway/gravitee-am-gateway-core/src/main/java/io/gravitee/am/gateway/core/event/ExtensionGrantEvent.java b/gravitee-am-common/src/main/java/io/gravitee/am/common/event/ExtensionGrantEvent.java
similarity index 93%
rename from gravitee-am-gateway/gravitee-am-gateway-core/src/main/java/io/gravitee/am/gateway/core/event/ExtensionGrantEvent.java
rename to gravitee-am-common/src/main/java/io/gravitee/am/common/event/ExtensionGrantEvent.java
index 20cd764b8a..5b53361752 100644
--- a/gravitee-am-gateway/gravitee-am-gateway-core/src/main/java/io/gravitee/am/gateway/core/event/ExtensionGrantEvent.java
+++ b/gravitee-am-common/src/main/java/io/gravitee/am/common/event/ExtensionGrantEvent.java
@@ -13,9 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package io.gravitee.am.gateway.core.event;
-
-import io.gravitee.am.model.common.event.Action;
+package io.gravitee.am.common.event;
 
 /**
  * @author Titouan COMPIEGNE (titouan.compiegne at graviteesource.com)
diff --git a/gravitee-am-gateway/gravitee-am-gateway-core/src/main/java/io/gravitee/am/gateway/core/event/FormEvent.java b/gravitee-am-common/src/main/java/io/gravitee/am/common/event/FormEvent.java
similarity index 93%
rename from gravitee-am-gateway/gravitee-am-gateway-core/src/main/java/io/gravitee/am/gateway/core/event/FormEvent.java
rename to gravitee-am-common/src/main/java/io/gravitee/am/common/event/FormEvent.java
index f5693d3633..5143c24dd8 100644
--- a/gravitee-am-gateway/gravitee-am-gateway-core/src/main/java/io/gravitee/am/gateway/core/event/FormEvent.java
+++ b/gravitee-am-common/src/main/java/io/gravitee/am/common/event/FormEvent.java
@@ -13,9 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package io.gravitee.am.gateway.core.event;
-
-import io.gravitee.am.model.common.event.Action;
+package io.gravitee.am.common.event;
 
 /**
  * @author Titouan COMPIEGNE (titouan.compiegne at graviteesource.com)
diff --git a/gravitee-am-gateway/gravitee-am-gateway-core/src/main/java/io/gravitee/am/gateway/core/event/IdentityProviderEvent.java b/gravitee-am-common/src/main/java/io/gravitee/am/common/event/IdentityProviderEvent.java
similarity index 93%
rename from gravitee-am-gateway/gravitee-am-gateway-core/src/main/java/io/gravitee/am/gateway/core/event/IdentityProviderEvent.java
rename to gravitee-am-common/src/main/java/io/gravitee/am/common/event/IdentityProviderEvent.java
index bb33692a22..4557985c12 100644
--- a/gravitee-am-gateway/gravitee-am-gateway-core/src/main/java/io/gravitee/am/gateway/core/event/IdentityProviderEvent.java
+++ b/gravitee-am-common/src/main/java/io/gravitee/am/common/event/IdentityProviderEvent.java
@@ -13,9 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package io.gravitee.am.gateway.core.event;
-
-import io.gravitee.am.model.common.event.Action;
+package io.gravitee.am.common.event;
 
 /**
  * @author Titouan COMPIEGNE (titouan.compiegne at graviteesource.com)
diff --git a/gravitee-am-gateway/gravitee-am-gateway-core/src/main/java/io/gravitee/am/gateway/core/event/PolicyEvent.java b/gravitee-am-common/src/main/java/io/gravitee/am/common/event/PolicyEvent.java
similarity index 93%
rename from gravitee-am-gateway/gravitee-am-gateway-core/src/main/java/io/gravitee/am/gateway/core/event/PolicyEvent.java
rename to gravitee-am-common/src/main/java/io/gravitee/am/common/event/PolicyEvent.java
index 66bfe5b0a0..f4d0f49f39 100644
--- a/gravitee-am-gateway/gravitee-am-gateway-core/src/main/java/io/gravitee/am/gateway/core/event/PolicyEvent.java
+++ b/gravitee-am-common/src/main/java/io/gravitee/am/common/event/PolicyEvent.java
@@ -13,9 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package io.gravitee.am.gateway.core.event;
-
-import io.gravitee.am.model.common.event.Action;
+package io.gravitee.am.common.event;
 
 /**
  * @author Titouan COMPIEGNE (titouan.compiegne at graviteesource.com)
diff --git a/gravitee-am-gateway/gravitee-am-gateway-core/src/main/java/io/gravitee/am/gateway/core/event/ReporterEvent.java b/gravitee-am-common/src/main/java/io/gravitee/am/common/event/ReporterEvent.java
similarity index 93%
rename from gravitee-am-gateway/gravitee-am-gateway-core/src/main/java/io/gravitee/am/gateway/core/event/ReporterEvent.java
rename to gravitee-am-common/src/main/java/io/gravitee/am/common/event/ReporterEvent.java
index 7585af86c7..79dcbc67a3 100644
--- a/gravitee-am-gateway/gravitee-am-gateway-core/src/main/java/io/gravitee/am/gateway/core/event/ReporterEvent.java
+++ b/gravitee-am-common/src/main/java/io/gravitee/am/common/event/ReporterEvent.java
@@ -13,9 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package io.gravitee.am.gateway.core.event;
-
-import io.gravitee.am.model.common.event.Action;
+package io.gravitee.am.common.event;
 
 /**
  * @author Titouan COMPIEGNE (titouan.compiegne at graviteesource.com)
diff --git a/gravitee-am-gateway/gravitee-am-gateway-core/src/main/java/io/gravitee/am/gateway/core/event/RoleEvent.java b/gravitee-am-common/src/main/java/io/gravitee/am/common/event/RoleEvent.java
similarity index 93%
rename from gravitee-am-gateway/gravitee-am-gateway-core/src/main/java/io/gravitee/am/gateway/core/event/RoleEvent.java
rename to gravitee-am-common/src/main/java/io/gravitee/am/common/event/RoleEvent.java
index 1b2efaab3c..44b702f5e9 100644
--- a/gravitee-am-gateway/gravitee-am-gateway-core/src/main/java/io/gravitee/am/gateway/core/event/RoleEvent.java
+++ b/gravitee-am-common/src/main/java/io/gravitee/am/common/event/RoleEvent.java
@@ -13,9 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package io.gravitee.am.gateway.core.event;
-
-import io.gravitee.am.model.common.event.Action;
+package io.gravitee.am.common.event;
 
 /**
  * @author Titouan COMPIEGNE (titouan.compiegne at graviteesource.com)
diff --git a/gravitee-am-gateway/gravitee-am-gateway-core/src/main/java/io/gravitee/am/gateway/core/event/ScopeEvent.java b/gravitee-am-common/src/main/java/io/gravitee/am/common/event/ScopeEvent.java
similarity index 93%
rename from gravitee-am-gateway/gravitee-am-gateway-core/src/main/java/io/gravitee/am/gateway/core/event/ScopeEvent.java
rename to gravitee-am-common/src/main/java/io/gravitee/am/common/event/ScopeEvent.java
index 96f9077a2c..b4e255d0a5 100644
--- a/gravitee-am-gateway/gravitee-am-gateway-core/src/main/java/io/gravitee/am/gateway/core/event/ScopeEvent.java
+++ b/gravitee-am-common/src/main/java/io/gravitee/am/common/event/ScopeEvent.java
@@ -13,9 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package io.gravitee.am.gateway.core.event;
-
-import io.gravitee.am.model.common.event.Action;
+package io.gravitee.am.common.event;
 
 /**
  * @author Titouan COMPIEGNE (titouan.compiegne at graviteesource.com)
diff --git a/gravitee-am-model/src/main/java/io/gravitee/am/model/common/event/Type.java b/gravitee-am-common/src/main/java/io/gravitee/am/common/event/Type.java
similarity index 95%
rename from gravitee-am-model/src/main/java/io/gravitee/am/model/common/event/Type.java
rename to gravitee-am-common/src/main/java/io/gravitee/am/common/event/Type.java
index 9aeb13d680..9396029ddc 100644
--- a/gravitee-am-model/src/main/java/io/gravitee/am/model/common/event/Type.java
+++ b/gravitee-am-common/src/main/java/io/gravitee/am/common/event/Type.java
@@ -13,7 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package io.gravitee.am.model.common.event;
+package io.gravitee.am.common.event;
 
 /**
  * @author Titouan COMPIEGNE (titouan.compiegne at graviteesource.com)
diff --git a/gravitee-am-gateway/gravitee-am-gateway-core/src/main/java/io/gravitee/am/gateway/core/event/UserEvent.java b/gravitee-am-common/src/main/java/io/gravitee/am/common/event/UserEvent.java
similarity index 93%
rename from gravitee-am-gateway/gravitee-am-gateway-core/src/main/java/io/gravitee/am/gateway/core/event/UserEvent.java
rename to gravitee-am-common/src/main/java/io/gravitee/am/common/event/UserEvent.java
index 1414e8a3f0..3885b9e2f4 100644
--- a/gravitee-am-gateway/gravitee-am-gateway-core/src/main/java/io/gravitee/am/gateway/core/event/UserEvent.java
+++ b/gravitee-am-common/src/main/java/io/gravitee/am/common/event/UserEvent.java
@@ -13,9 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package io.gravitee.am.gateway.core.event;
-
-import io.gravitee.am.model.common.event.Action;
+package io.gravitee.am.common.event;
 
 /**
  * @author Titouan COMPIEGNE (titouan.compiegne at graviteesource.com)
diff --git a/gravitee-am-gateway/gravitee-am-gateway-handler/gravitee-am-gateway-handler-common/src/main/java/io/gravitee/am/gateway/handler/common/audit/impl/AuditReporterManagerImpl.java b/gravitee-am-gateway/gravitee-am-gateway-handler/gravitee-am-gateway-handler-common/src/main/java/io/gravitee/am/gateway/handler/common/audit/impl/AuditReporterManagerImpl.java
index 8575f8b1fa..b0a9c6c3df 100644
--- a/gravitee-am-gateway/gravitee-am-gateway-handler/gravitee-am-gateway-handler-common/src/main/java/io/gravitee/am/gateway/handler/common/audit/impl/AuditReporterManagerImpl.java
+++ b/gravitee-am-gateway/gravitee-am-gateway-handler/gravitee-am-gateway-handler-common/src/main/java/io/gravitee/am/gateway/handler/common/audit/impl/AuditReporterManagerImpl.java
@@ -15,8 +15,8 @@
  */
 package io.gravitee.am.gateway.handler.common.audit.impl;
 
-import io.gravitee.am.gateway.core.event.EventManager;
-import io.gravitee.am.gateway.core.event.ReporterEvent;
+import io.gravitee.am.common.event.EventManager;
+import io.gravitee.am.common.event.ReporterEvent;
 import io.gravitee.am.gateway.handler.common.audit.AuditReporterManager;
 import io.gravitee.am.model.Domain;
 import io.gravitee.am.model.Reporter;
diff --git a/gravitee-am-gateway/gravitee-am-gateway-handler/gravitee-am-gateway-handler-common/src/main/java/io/gravitee/am/gateway/handler/common/auth/idp/impl/IdentityProviderManagerImpl.java b/gravitee-am-gateway/gravitee-am-gateway-handler/gravitee-am-gateway-handler-common/src/main/java/io/gravitee/am/gateway/handler/common/auth/idp/impl/IdentityProviderManagerImpl.java
index d6ec936faa..14b8471c7e 100644
--- a/gravitee-am-gateway/gravitee-am-gateway-handler/gravitee-am-gateway-handler-common/src/main/java/io/gravitee/am/gateway/handler/common/auth/idp/impl/IdentityProviderManagerImpl.java
+++ b/gravitee-am-gateway/gravitee-am-gateway-handler/gravitee-am-gateway-handler-common/src/main/java/io/gravitee/am/gateway/handler/common/auth/idp/impl/IdentityProviderManagerImpl.java
@@ -15,8 +15,8 @@
  */
 package io.gravitee.am.gateway.handler.common.auth.idp.impl;
 
-import io.gravitee.am.gateway.core.event.EventManager;
-import io.gravitee.am.gateway.core.event.IdentityProviderEvent;
+import io.gravitee.am.common.event.EventManager;
+import io.gravitee.am.common.event.IdentityProviderEvent;
 import io.gravitee.am.gateway.handler.common.auth.idp.IdentityProviderManager;
 import io.gravitee.am.gateway.handler.common.certificate.CertificateProviderManager;
 import io.gravitee.am.identityprovider.api.AuthenticationProvider;
diff --git a/gravitee-am-gateway/gravitee-am-gateway-handler/gravitee-am-gateway-handler-common/src/main/java/io/gravitee/am/gateway/handler/common/authentication/listener/AuthenticationEventListener.java b/gravitee-am-gateway/gravitee-am-gateway-handler/gravitee-am-gateway-handler-common/src/main/java/io/gravitee/am/gateway/handler/common/authentication/listener/AuthenticationEventListener.java
index d8e61cd369..5a65fc67b1 100644
--- a/gravitee-am-gateway/gravitee-am-gateway-handler/gravitee-am-gateway-handler-common/src/main/java/io/gravitee/am/gateway/handler/common/authentication/listener/AuthenticationEventListener.java
+++ b/gravitee-am-gateway/gravitee-am-gateway-handler/gravitee-am-gateway-handler-common/src/main/java/io/gravitee/am/gateway/handler/common/authentication/listener/AuthenticationEventListener.java
@@ -15,7 +15,7 @@
  */
 package io.gravitee.am.gateway.handler.common.authentication.listener;
 
-import io.gravitee.am.gateway.core.event.EventManager;
+import io.gravitee.am.common.event.EventManager;
 import io.gravitee.am.gateway.handler.common.authentication.AuthenticationDetails;
 import io.gravitee.am.gateway.handler.common.authentication.event.AuthenticationEvent;
 import io.gravitee.am.model.Domain;
diff --git a/gravitee-am-gateway/gravitee-am-gateway-handler/gravitee-am-gateway-handler-common/src/main/java/io/gravitee/am/gateway/handler/common/certificate/impl/CertificateManagerImpl.java b/gravitee-am-gateway/gravitee-am-gateway-handler/gravitee-am-gateway-handler-common/src/main/java/io/gravitee/am/gateway/handler/common/certificate/impl/CertificateManagerImpl.java
index 17f723c526..8ce14f6e61 100644
--- a/gravitee-am-gateway/gravitee-am-gateway-handler/gravitee-am-gateway-handler-common/src/main/java/io/gravitee/am/gateway/handler/common/certificate/impl/CertificateManagerImpl.java
+++ b/gravitee-am-gateway/gravitee-am-gateway-handler/gravitee-am-gateway-handler-common/src/main/java/io/gravitee/am/gateway/handler/common/certificate/impl/CertificateManagerImpl.java
@@ -18,8 +18,8 @@ package io.gravitee.am.gateway.handler.common.certificate.impl;
 import com.fasterxml.jackson.databind.ObjectMapper;
 import io.gravitee.am.certificate.api.CertificateMetadata;
 import io.gravitee.am.certificate.api.DefaultKey;
-import io.gravitee.am.gateway.core.event.CertificateEvent;
-import io.gravitee.am.gateway.core.event.EventManager;
+import io.gravitee.am.common.event.CertificateEvent;
+import io.gravitee.am.common.event.EventManager;
 import io.gravitee.am.gateway.handler.common.certificate.CertificateManager;
 import io.gravitee.am.gateway.handler.common.certificate.CertificateProvider;
 import io.gravitee.am.gateway.handler.common.certificate.CertificateProviderManager;
diff --git a/gravitee-am-gateway/gravitee-am-gateway-handler/gravitee-am-gateway-handler-common/src/main/java/io/gravitee/am/gateway/handler/common/client/impl/ClientSyncServiceImpl.java b/gravitee-am-gateway/gravitee-am-gateway-handler/gravitee-am-gateway-handler-common/src/main/java/io/gravitee/am/gateway/handler/common/client/impl/ClientSyncServiceImpl.java
index 578a034bf6..af5f7a3214 100644
--- a/gravitee-am-gateway/gravitee-am-gateway-handler/gravitee-am-gateway-handler-common/src/main/java/io/gravitee/am/gateway/handler/common/client/impl/ClientSyncServiceImpl.java
+++ b/gravitee-am-gateway/gravitee-am-gateway-handler/gravitee-am-gateway-handler-common/src/main/java/io/gravitee/am/gateway/handler/common/client/impl/ClientSyncServiceImpl.java
@@ -15,8 +15,8 @@
  */
 package io.gravitee.am.gateway.handler.common.client.impl;
 
-import io.gravitee.am.gateway.core.event.ClientEvent;
-import io.gravitee.am.gateway.core.event.EventManager;
+import io.gravitee.am.common.event.ClientEvent;
+import io.gravitee.am.common.event.EventManager;
 import io.gravitee.am.gateway.handler.common.client.ClientSyncService;
 import io.gravitee.am.model.Client;
 import io.gravitee.am.model.Domain;
diff --git a/gravitee-am-gateway/gravitee-am-gateway-handler/gravitee-am-gateway-handler-common/src/main/java/io/gravitee/am/gateway/handler/common/policy/impl/PolicyManagerImpl.java b/gravitee-am-gateway/gravitee-am-gateway-handler/gravitee-am-gateway-handler-common/src/main/java/io/gravitee/am/gateway/handler/common/policy/impl/PolicyManagerImpl.java
index cfc409ab01..6e4b270b69 100644
--- a/gravitee-am-gateway/gravitee-am-gateway-handler/gravitee-am-gateway-handler-common/src/main/java/io/gravitee/am/gateway/handler/common/policy/impl/PolicyManagerImpl.java
+++ b/gravitee-am-gateway/gravitee-am-gateway-handler/gravitee-am-gateway-handler-common/src/main/java/io/gravitee/am/gateway/handler/common/policy/impl/PolicyManagerImpl.java
@@ -16,8 +16,8 @@
 package io.gravitee.am.gateway.handler.common.policy.impl;
 
 import io.gravitee.am.common.policy.ExtensionPoint;
-import io.gravitee.am.gateway.core.event.EventManager;
-import io.gravitee.am.gateway.core.event.PolicyEvent;
+import io.gravitee.am.common.event.EventManager;
+import io.gravitee.am.common.event.PolicyEvent;
 import io.gravitee.am.gateway.handler.common.policy.PolicyManager;
 import io.gravitee.am.gateway.policy.Policy;
 import io.gravitee.am.model.Domain;
diff --git a/gravitee-am-gateway/gravitee-am-gateway-handler/gravitee-am-gateway-handler-common/src/main/java/io/gravitee/am/gateway/handler/common/user/impl/UserManagerImpl.java b/gravitee-am-gateway/gravitee-am-gateway-handler/gravitee-am-gateway-handler-common/src/main/java/io/gravitee/am/gateway/handler/common/user/impl/UserManagerImpl.java
index 4c4df8a951..697f5355c5 100644
--- a/gravitee-am-gateway/gravitee-am-gateway-handler/gravitee-am-gateway-handler-common/src/main/java/io/gravitee/am/gateway/handler/common/user/impl/UserManagerImpl.java
+++ b/gravitee-am-gateway/gravitee-am-gateway-handler/gravitee-am-gateway-handler-common/src/main/java/io/gravitee/am/gateway/handler/common/user/impl/UserManagerImpl.java
@@ -15,8 +15,8 @@
  */
 package io.gravitee.am.gateway.handler.common.user.impl;
 
-import io.gravitee.am.gateway.core.event.EventManager;
-import io.gravitee.am.gateway.core.event.UserEvent;
+import io.gravitee.am.common.event.EventManager;
+import io.gravitee.am.common.event.UserEvent;
 import io.gravitee.am.gateway.handler.common.user.UserManager;
 import io.gravitee.am.gateway.handler.common.user.UserService;
 import io.gravitee.am.gateway.handler.common.user.UserStore;
diff --git a/gravitee-am-gateway/gravitee-am-gateway-handler/gravitee-am-gateway-handler-core/src/main/java/io/gravitee/am/gateway/handler/email/impl/EmailManagerImpl.java b/gravitee-am-gateway/gravitee-am-gateway-handler/gravitee-am-gateway-handler-core/src/main/java/io/gravitee/am/gateway/handler/email/impl/EmailManagerImpl.java
index 26badeb085..2b0d23c8f4 100644
--- a/gravitee-am-gateway/gravitee-am-gateway-handler/gravitee-am-gateway-handler-core/src/main/java/io/gravitee/am/gateway/handler/email/impl/EmailManagerImpl.java
+++ b/gravitee-am-gateway/gravitee-am-gateway-handler/gravitee-am-gateway-handler-core/src/main/java/io/gravitee/am/gateway/handler/email/impl/EmailManagerImpl.java
@@ -17,8 +17,8 @@ package io.gravitee.am.gateway.handler.email.impl;
 
 import freemarker.cache.TemplateLoader;
 import freemarker.template.Configuration;
-import io.gravitee.am.gateway.core.event.EmailEvent;
-import io.gravitee.am.gateway.core.event.EventManager;
+import io.gravitee.am.common.event.EmailEvent;
+import io.gravitee.am.common.event.EventManager;
 import io.gravitee.am.gateway.handler.email.EmailManager;
 import io.gravitee.am.gateway.handler.vertx.view.freemarker.DomainBasedEmailTemplateLoader;
 import io.gravitee.am.model.Domain;
diff --git a/gravitee-am-gateway/gravitee-am-gateway-handler/gravitee-am-gateway-handler-core/src/main/java/io/gravitee/am/gateway/handler/form/impl/FormManagerImpl.java b/gravitee-am-gateway/gravitee-am-gateway-handler/gravitee-am-gateway-handler-core/src/main/java/io/gravitee/am/gateway/handler/form/impl/FormManagerImpl.java
index 3aed634037..1d68e20601 100644
--- a/gravitee-am-gateway/gravitee-am-gateway-handler/gravitee-am-gateway-handler-core/src/main/java/io/gravitee/am/gateway/handler/form/impl/FormManagerImpl.java
+++ b/gravitee-am-gateway/gravitee-am-gateway-handler/gravitee-am-gateway-handler-core/src/main/java/io/gravitee/am/gateway/handler/form/impl/FormManagerImpl.java
@@ -15,8 +15,8 @@
  */
 package io.gravitee.am.gateway.handler.form.impl;
 
-import io.gravitee.am.gateway.core.event.EventManager;
-import io.gravitee.am.gateway.core.event.FormEvent;
+import io.gravitee.am.common.event.EventManager;
+import io.gravitee.am.common.event.FormEvent;
 import io.gravitee.am.gateway.handler.form.FormManager;
 import io.gravitee.am.gateway.handler.vertx.view.thymeleaf.DomainBasedTemplateResolver;
 import io.gravitee.am.model.Domain;
diff --git a/gravitee-am-gateway/gravitee-am-gateway-handler/gravitee-am-gateway-handler-oidc/src/main/java/io/gravitee/am/gateway/handler/oauth2/service/granter/extensiongrant/impl/ExtensionGrantManagerImpl.java b/gravitee-am-gateway/gravitee-am-gateway-handler/gravitee-am-gateway-handler-oidc/src/main/java/io/gravitee/am/gateway/handler/oauth2/service/granter/extensiongrant/impl/ExtensionGrantManagerImpl.java
index 5ec7639c96..551d18f4b7 100644
--- a/gravitee-am-gateway/gravitee-am-gateway-handler/gravitee-am-gateway-handler-oidc/src/main/java/io/gravitee/am/gateway/handler/oauth2/service/granter/extensiongrant/impl/ExtensionGrantManagerImpl.java
+++ b/gravitee-am-gateway/gravitee-am-gateway-handler/gravitee-am-gateway-handler-oidc/src/main/java/io/gravitee/am/gateway/handler/oauth2/service/granter/extensiongrant/impl/ExtensionGrantManagerImpl.java
@@ -16,8 +16,8 @@
 package io.gravitee.am.gateway.handler.oauth2.service.granter.extensiongrant.impl;
 
 import io.gravitee.am.extensiongrant.api.ExtensionGrantProvider;
-import io.gravitee.am.gateway.core.event.EventManager;
-import io.gravitee.am.gateway.core.event.ExtensionGrantEvent;
+import io.gravitee.am.common.event.EventManager;
+import io.gravitee.am.common.event.ExtensionGrantEvent;
 import io.gravitee.am.gateway.handler.common.auth.UserAuthenticationManager;
 import io.gravitee.am.gateway.handler.common.auth.idp.IdentityProviderManager;
 import io.gravitee.am.gateway.handler.oauth2.service.granter.CompositeTokenGranter;
diff --git a/gravitee-am-gateway/gravitee-am-gateway-handler/gravitee-am-gateway-handler-oidc/src/main/java/io/gravitee/am/gateway/handler/oauth2/service/request/AbstractRequestResolver.java b/gravitee-am-gateway/gravitee-am-gateway-handler/gravitee-am-gateway-handler-oidc/src/main/java/io/gravitee/am/gateway/handler/oauth2/service/request/AbstractRequestResolver.java
index d7c43826e3..d377a2c245 100644
--- a/gravitee-am-gateway/gravitee-am-gateway-handler/gravitee-am-gateway-handler-oidc/src/main/java/io/gravitee/am/gateway/handler/oauth2/service/request/AbstractRequestResolver.java
+++ b/gravitee-am-gateway/gravitee-am-gateway-handler/gravitee-am-gateway-handler-oidc/src/main/java/io/gravitee/am/gateway/handler/oauth2/service/request/AbstractRequestResolver.java
@@ -76,23 +76,19 @@ public abstract class AbstractRequestResolver<R extends OAuth2Request> {
                         .map(role -> role.getPermissions() != null ? role.getPermissions() : Collections.<String>emptyList())
                         .flatMap(List::stream)
                         .collect(Collectors.toSet());
-                // no requested scope, set default user permissions scopes to the request
-                if (requestScopes == null || requestScopes.isEmpty()) {
-                    resolvedScopes.addAll(new HashSet<>(permissions));
-                } else {
-                    // filter the actual scopes granted by the resource owner
+                
+                if (requestScopes != null) {
+                	// filter the actual scopes granted by the resource owner
                     requestScopes.forEach(scope -> {
-                        if (permissions.contains(scope)) {
-                            // scope can be rejected by the client but approved by the resource owner
-                            resolvedScopes.add(scope);
-                            invalidScopes.remove(scope);
-                        } else {
-                            if (!clientResolvedScopes.contains(scope)) {
-                                invalidScopes.add(scope);
-                            }
+                        if (!permissions.contains(scope) && !clientResolvedScopes.contains(scope)) {
+                        	invalidScopes.add(scope);
                         }
                     });
                 }
+                
+                // The request must be enhanced with all of user's permissions
+                invalidScopes.removeAll(permissions);
+                resolvedScopes.addAll(permissions);
             }
         }
 
diff --git a/gravitee-am-gateway/gravitee-am-gateway-handler/gravitee-am-gateway-handler-oidc/src/main/java/io/gravitee/am/gateway/handler/oauth2/service/scope/impl/ScopeManagerImpl.java b/gravitee-am-gateway/gravitee-am-gateway-handler/gravitee-am-gateway-handler-oidc/src/main/java/io/gravitee/am/gateway/handler/oauth2/service/scope/impl/ScopeManagerImpl.java
index b280076330..33fcb8dbab 100644
--- a/gravitee-am-gateway/gravitee-am-gateway-handler/gravitee-am-gateway-handler-oidc/src/main/java/io/gravitee/am/gateway/handler/oauth2/service/scope/impl/ScopeManagerImpl.java
+++ b/gravitee-am-gateway/gravitee-am-gateway-handler/gravitee-am-gateway-handler-oidc/src/main/java/io/gravitee/am/gateway/handler/oauth2/service/scope/impl/ScopeManagerImpl.java
@@ -15,8 +15,8 @@
  */
 package io.gravitee.am.gateway.handler.oauth2.service.scope.impl;
 
-import io.gravitee.am.gateway.core.event.EventManager;
-import io.gravitee.am.gateway.core.event.ScopeEvent;
+import io.gravitee.am.common.event.EventManager;
+import io.gravitee.am.common.event.ScopeEvent;
 import io.gravitee.am.gateway.handler.oauth2.service.scope.ScopeManager;
 import io.gravitee.am.model.Domain;
 import io.gravitee.am.model.common.event.Payload;
diff --git a/gravitee-am-gateway/gravitee-am-gateway-reactor/src/main/java/io/gravitee/am/gateway/reactor/impl/DefaultReactor.java b/gravitee-am-gateway/gravitee-am-gateway-reactor/src/main/java/io/gravitee/am/gateway/reactor/impl/DefaultReactor.java
index 9e718e5b99..42715b9851 100644
--- a/gravitee-am-gateway/gravitee-am-gateway-reactor/src/main/java/io/gravitee/am/gateway/reactor/impl/DefaultReactor.java
+++ b/gravitee-am-gateway/gravitee-am-gateway-reactor/src/main/java/io/gravitee/am/gateway/reactor/impl/DefaultReactor.java
@@ -15,7 +15,7 @@
  */
 package io.gravitee.am.gateway.reactor.impl;
 
-import io.gravitee.am.gateway.core.event.DomainEvent;
+import io.gravitee.am.common.event.DomainEvent;
 import io.gravitee.am.gateway.reactor.Reactor;
 import io.gravitee.am.gateway.reactor.SecurityDomainHandlerRegistry;
 import io.gravitee.am.gateway.reactor.impl.transaction.TransactionProcessorFactory;
diff --git a/gravitee-am-gateway/gravitee-am-gateway-reactor/src/main/java/io/gravitee/am/gateway/reactor/impl/DefaultSecurityDomainManager.java b/gravitee-am-gateway/gravitee-am-gateway-reactor/src/main/java/io/gravitee/am/gateway/reactor/impl/DefaultSecurityDomainManager.java
index adc54893c0..992e6c5e86 100644
--- a/gravitee-am-gateway/gravitee-am-gateway-reactor/src/main/java/io/gravitee/am/gateway/reactor/impl/DefaultSecurityDomainManager.java
+++ b/gravitee-am-gateway/gravitee-am-gateway-reactor/src/main/java/io/gravitee/am/gateway/reactor/impl/DefaultSecurityDomainManager.java
@@ -15,8 +15,8 @@
  */
 package io.gravitee.am.gateway.reactor.impl;
 
-import io.gravitee.am.gateway.core.event.DomainEvent;
-import io.gravitee.am.gateway.core.event.EventManager;
+import io.gravitee.am.common.event.DomainEvent;
+import io.gravitee.am.common.event.EventManager;
 import io.gravitee.am.gateway.reactor.SecurityDomainManager;
 import io.gravitee.am.model.Domain;
 import org.slf4j.Logger;
diff --git a/gravitee-am-gateway/gravitee-am-gateway-services/gravitee-am-gateway-services-sync/src/main/java/io/gravitee/am/gateway/services/sync/SyncManager.java b/gravitee-am-gateway/gravitee-am-gateway-services/gravitee-am-gateway-services-sync/src/main/java/io/gravitee/am/gateway/services/sync/SyncManager.java
index 8b437f95c6..709d4ab4b1 100644
--- a/gravitee-am-gateway/gravitee-am-gateway-services/gravitee-am-gateway-services-sync/src/main/java/io/gravitee/am/gateway/services/sync/SyncManager.java
+++ b/gravitee-am-gateway/gravitee-am-gateway-services/gravitee-am-gateway-services-sync/src/main/java/io/gravitee/am/gateway/services/sync/SyncManager.java
@@ -17,9 +17,9 @@ package io.gravitee.am.gateway.services.sync;
 
 import io.gravitee.am.gateway.reactor.SecurityDomainManager;
 import io.gravitee.am.model.Domain;
-import io.gravitee.am.model.common.event.Action;
+import io.gravitee.am.common.event.Action;
 import io.gravitee.am.model.common.event.Event;
-import io.gravitee.am.model.common.event.Type;
+import io.gravitee.am.common.event.Type;
 import io.gravitee.am.repository.management.api.DomainRepository;
 import io.gravitee.am.repository.management.api.EventRepository;
 import io.gravitee.common.event.EventManager;
@@ -138,7 +138,7 @@ public class SyncManager implements InitializingBean {
             } else {
                 // other events (inner domain events such as client events, template events and so one ...)
                 // just propagate the event
-                eventManager.publishEvent(io.gravitee.am.gateway.core.event.Event.valueOf(event), event.getPayload());
+                eventManager.publishEvent(io.gravitee.am.common.event.Event.valueOf(event.getType(), event.getPayload().getAction()), event.getPayload());
             }
         });
     }
diff --git a/gravitee-am-gateway/gravitee-am-gateway-standalone/gravitee-am-gateway-standalone-container/src/main/java/io/gravitee/am/gateway/event/EventManagerImpl.java b/gravitee-am-gateway/gravitee-am-gateway-standalone/gravitee-am-gateway-standalone-container/src/main/java/io/gravitee/am/gateway/event/EventManagerImpl.java
index 34aa00a4c8..bce0eb0266 100644
--- a/gravitee-am-gateway/gravitee-am-gateway-standalone/gravitee-am-gateway-standalone-container/src/main/java/io/gravitee/am/gateway/event/EventManagerImpl.java
+++ b/gravitee-am-gateway/gravitee-am-gateway-standalone/gravitee-am-gateway-standalone-container/src/main/java/io/gravitee/am/gateway/event/EventManagerImpl.java
@@ -16,8 +16,8 @@
 package io.gravitee.am.gateway.event;
 
 import com.google.common.collect.Lists;
-import io.gravitee.am.gateway.core.event.DomainEvent;
-import io.gravitee.am.gateway.core.event.EventManager;
+import io.gravitee.am.common.event.DomainEvent;
+import io.gravitee.am.common.event.EventManager;
 import io.gravitee.am.gateway.handler.common.authentication.AuthenticationDetails;
 import io.gravitee.am.model.Domain;
 import io.gravitee.am.model.common.event.Payload;
diff --git a/gravitee-am-gateway/gravitee-am-gateway-standalone/gravitee-am-gateway-standalone-container/src/main/java/io/gravitee/am/gateway/spring/StandaloneConfiguration.java b/gravitee-am-gateway/gravitee-am-gateway-standalone/gravitee-am-gateway-standalone-container/src/main/java/io/gravitee/am/gateway/spring/StandaloneConfiguration.java
index 60fbdf2261..7449160761 100644
--- a/gravitee-am-gateway/gravitee-am-gateway-standalone/gravitee-am-gateway-standalone-container/src/main/java/io/gravitee/am/gateway/spring/StandaloneConfiguration.java
+++ b/gravitee-am-gateway/gravitee-am-gateway-standalone/gravitee-am-gateway-standalone-container/src/main/java/io/gravitee/am/gateway/spring/StandaloneConfiguration.java
@@ -18,7 +18,7 @@ package io.gravitee.am.gateway.spring;
 import com.fasterxml.jackson.annotation.JsonInclude;
 import com.fasterxml.jackson.databind.ObjectMapper;
 import com.fasterxml.jackson.datatype.jdk8.Jdk8Module;
-import io.gravitee.am.gateway.core.event.EventManager;
+import io.gravitee.am.common.event.EventManager;
 import io.gravitee.am.gateway.event.EventManagerImpl;
 import io.gravitee.am.gateway.node.GatewayNode;
 import io.gravitee.am.gateway.reactor.spring.ReactorConfiguration;
diff --git a/gravitee-am-management-api/gravitee-am-management-api-handlers/gravitee-am-management-api-handlers-admin/src/main/java/io/gravitee/am/management/handlers/admin/form/FormManager.java b/gravitee-am-management-api/gravitee-am-management-api-handlers/gravitee-am-management-api-handlers-admin/src/main/java/io/gravitee/am/management/handlers/admin/form/FormManager.java
new file mode 100644
index 0000000000..7bf31a7cbf
--- /dev/null
+++ b/gravitee-am-management-api/gravitee-am-management-api-handlers/gravitee-am-management-api-handlers-admin/src/main/java/io/gravitee/am/management/handlers/admin/form/FormManager.java
@@ -0,0 +1,23 @@
+/**
+ * Copyright (C) 2015 The Gravitee team (http://gravitee.io)
+ *
+ * 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 io.gravitee.am.management.handlers.admin.form;
+
+/**
+ * @author Titouan COMPIEGNE (titouan.compiegne at graviteesource.com)
+ * @author GraviteeSource Team
+ */
+public interface FormManager {
+}
diff --git a/gravitee-am-management-api/gravitee-am-management-api-handlers/gravitee-am-management-api-handlers-admin/src/main/java/io/gravitee/am/management/handlers/admin/form/impl/FormManagerImpl.java b/gravitee-am-management-api/gravitee-am-management-api-handlers/gravitee-am-management-api-handlers-admin/src/main/java/io/gravitee/am/management/handlers/admin/form/impl/FormManagerImpl.java
new file mode 100644
index 0000000000..9ba40dbd56
--- /dev/null
+++ b/gravitee-am-management-api/gravitee-am-management-api-handlers/gravitee-am-management-api-handlers-admin/src/main/java/io/gravitee/am/management/handlers/admin/form/impl/FormManagerImpl.java
@@ -0,0 +1,127 @@
+/**
+ * Copyright (C) 2015 The Gravitee team (http://gravitee.io)
+ *
+ * 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 io.gravitee.am.management.handlers.admin.form.impl;
+
+import io.gravitee.am.common.event.FormEvent;
+import io.gravitee.am.management.handlers.admin.form.FormManager;
+import io.gravitee.am.management.handlers.admin.view.DomainBasedTemplateResolver;
+import io.gravitee.am.model.Domain;
+import io.gravitee.am.model.Form;
+import io.gravitee.am.model.common.event.Payload;
+import io.gravitee.am.service.FormService;
+import io.gravitee.common.event.Event;
+import io.gravitee.common.event.EventListener;
+import io.gravitee.common.event.EventManager;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.InitializingBean;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.thymeleaf.templateresolver.ITemplateResolver;
+
+import java.util.Collections;
+import java.util.List;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+
+/**
+ * @author Titouan COMPIEGNE (titouan.compiegne at graviteesource.com)
+ * @author GraviteeSource Team
+ */
+public class FormManagerImpl implements FormManager, InitializingBean, EventListener<FormEvent, Payload> {
+
+    private static final Logger logger = LoggerFactory.getLogger(FormManagerImpl.class);
+    private ConcurrentMap<String, Form> forms = new ConcurrentHashMap<>();
+
+    @Autowired
+    private Domain domain;
+
+    @Autowired
+    private FormService formService;
+
+    @Autowired
+    private EventManager eventManager;
+
+    @Autowired
+    private ITemplateResolver templateResolver;
+
+    @Override
+    public void afterPropertiesSet() throws Exception {
+        logger.info("Register event listener for form events for domain {}", domain.getName());
+        eventManager.subscribeForEvents(this, FormEvent.class);
+
+        logger.info("Initializing forms for domain {}", domain.getName());
+        formService.findByDomain(domain.getId())
+                .subscribe(
+                        forms -> {
+                            updateForms(forms);
+                            logger.info("Forms loaded for domain {}", domain.getName());
+                        },
+                        error -> logger.error("Unable to initialize forms for domain {}", domain.getName(), error));
+
+    }
+
+    @Override
+    public void onEvent(Event<FormEvent, Payload> event) {
+        if (domain.getId().equals(event.content().getDomain())) {
+            switch (event.type()) {
+                case DEPLOY:
+                case UPDATE:
+                    updateForm(event.content().getId(), event.type());
+                    break;
+                case UNDEPLOY:
+                    removeForm(event.content().getId());
+                    break;
+            }
+        }
+    }
+
+    private void updateForm(String formId, FormEvent formEvent) {
+        final String eventType = formEvent.toString().toLowerCase();
+        logger.info("Domain {} has received {} form event for {}", domain.getName(), eventType, formId);
+        formService.findById(formId)
+                .subscribe(
+                        form -> {
+                            // check if form has been disabled
+                            if (forms.containsKey(formId) && !form.isEnabled()) {
+                                removeForm(formId);
+                            } else {
+                                updateForms(Collections.singletonList(form));
+                            }
+                            logger.info("Form {} {}d for domain {}", formId, eventType, domain.getName());
+                        },
+                        error -> logger.error("Unable to {} form for domain {}", eventType, domain.getName(), error),
+                        () -> logger.error("No form found with id {}", formId));
+    }
+
+    private void removeForm(String formId) {
+        logger.info("Domain {} has received form event, delete form {}", domain.getName(), formId);
+        Form deletedForm = forms.remove(formId);
+        if (deletedForm != null) {
+            ((DomainBasedTemplateResolver) templateResolver).removeForm(deletedForm.getTemplate());
+        }
+    }
+
+    private void updateForms(List<Form> forms) {
+        forms
+                .stream()
+                .filter(Form::isEnabled)
+                .forEach(form -> {
+                    this.forms.put(form.getId(), form);
+                    ((DomainBasedTemplateResolver) templateResolver).addForm(form.getTemplate(), form.getContent());
+                    logger.info("Form {} loaded for domain {} " + (form.getClient() != null ? "and client {}" : ""), form.getTemplate(), domain.getName(), form.getClient());
+                });
+    }
+}
diff --git a/gravitee-am-management-api/gravitee-am-management-api-handlers/gravitee-am-management-api-handlers-admin/src/main/java/io/gravitee/am/management/handlers/admin/security/IdentityProviderManager.java b/gravitee-am-management-api/gravitee-am-management-api-handlers/gravitee-am-management-api-handlers-admin/src/main/java/io/gravitee/am/management/handlers/admin/security/IdentityProviderManager.java
index e67cf2cf26..8a74e624b4 100644
--- a/gravitee-am-management-api/gravitee-am-management-api-handlers/gravitee-am-management-api-handlers-admin/src/main/java/io/gravitee/am/management/handlers/admin/security/IdentityProviderManager.java
+++ b/gravitee-am-management-api/gravitee-am-management-api-handlers/gravitee-am-management-api-handlers-admin/src/main/java/io/gravitee/am/management/handlers/admin/security/IdentityProviderManager.java
@@ -20,6 +20,7 @@ import io.gravitee.am.model.IdentityProvider;
 
 /**
  * @author David BRASSELY (david.brassely at graviteesource.com)
+ * @author Titouan COMPIEGNE (titouan.compiegne at graviteesource.com)
  * @author GraviteeSource Team
  */
 public interface IdentityProviderManager {
diff --git a/gravitee-am-management-api/gravitee-am-management-api-handlers/gravitee-am-management-api-handlers-admin/src/main/java/io/gravitee/am/management/handlers/admin/security/impl/IdentityProviderManagerImpl.java b/gravitee-am-management-api/gravitee-am-management-api-handlers/gravitee-am-management-api-handlers-admin/src/main/java/io/gravitee/am/management/handlers/admin/security/impl/IdentityProviderManagerImpl.java
index 4c0a98a7ab..058b132ed1 100644
--- a/gravitee-am-management-api/gravitee-am-management-api-handlers/gravitee-am-management-api-handlers-admin/src/main/java/io/gravitee/am/management/handlers/admin/security/impl/IdentityProviderManagerImpl.java
+++ b/gravitee-am-management-api/gravitee-am-management-api-handlers/gravitee-am-management-api-handlers-admin/src/main/java/io/gravitee/am/management/handlers/admin/security/impl/IdentityProviderManagerImpl.java
@@ -15,30 +15,33 @@
  */
 package io.gravitee.am.management.handlers.admin.security.impl;
 
+import io.gravitee.am.common.event.IdentityProviderEvent;
 import io.gravitee.am.identityprovider.api.AuthenticationProvider;
 import io.gravitee.am.management.handlers.admin.security.IdentityProviderManager;
 import io.gravitee.am.model.Domain;
 import io.gravitee.am.model.IdentityProvider;
+import io.gravitee.am.model.common.event.Payload;
 import io.gravitee.am.plugins.idp.core.IdentityProviderPluginManager;
 import io.gravitee.am.service.IdentityProviderService;
+import io.gravitee.common.event.Event;
+import io.gravitee.common.event.EventListener;
+import io.gravitee.common.event.EventManager;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.InitializingBean;
 import org.springframework.beans.factory.annotation.Autowired;
 
-import java.util.HashMap;
 import java.util.List;
-import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
 
 /**
  * @author David BRASSELY (david.brassely at graviteesource.com)
+ * @author Titouan COMPIEGNE (titouan.compiegne at graviteesource.com)
  * @author GraviteeSource Team
  */
-public class IdentityProviderManagerImpl implements IdentityProviderManager, InitializingBean {
+public class IdentityProviderManagerImpl implements IdentityProviderManager, InitializingBean, EventListener<IdentityProviderEvent, Payload> {
 
-    /**
-     * Logger
-     */
     private final Logger logger = LoggerFactory.getLogger(IdentityProviderManagerImpl.class);
 
     @Autowired
@@ -50,8 +53,11 @@ public class IdentityProviderManagerImpl implements IdentityProviderManager, Ini
     @Autowired
     private IdentityProviderService identityProviderService;
 
-    private Map<String, AuthenticationProvider> providers = new HashMap<>();
-    private Map<String, IdentityProvider> identities = new HashMap<>();
+    @Autowired
+    private EventManager eventManager;
+
+    private ConcurrentMap<String, AuthenticationProvider> providers = new ConcurrentHashMap<>();
+    private ConcurrentMap<String, IdentityProvider> identities = new ConcurrentHashMap<>();
 
     @Override
     public AuthenticationProvider get(String id) {
@@ -64,25 +70,84 @@ public class IdentityProviderManagerImpl implements IdentityProviderManager, Ini
 
     @Override
     public void afterPropertiesSet() throws Exception {
+        logger.info("Register event listener for identity provider events for domain {}", domain.getName());
+        eventManager.subscribeForEvents(this, IdentityProviderEvent.class);
+
         logger.info("Initializing identity providers for domain {}", domain.getName());
-        List<IdentityProvider> identityProviders = identityProviderService.findByDomain(domain.getId()).blockingGet();
+        try {
+            List<IdentityProvider> identityProviders = identityProviderService.findByDomain(domain.getId()).blockingGet();
+            identityProviders.forEach(identityProvider -> updateAuthenticationProvider(identityProvider));
+            logger.info("Identity providers loaded for domain {}", domain.getName());
+        } catch (Exception e) {
+            logger.error("Unable to initialize identity providers for domain {}", domain.getName(), e);
+        }
+    }
+
+    @Override
+    public void onEvent(Event<IdentityProviderEvent, Payload> event) {
+        if (domain.getId().equals(event.content().getDomain())) {
+            switch (event.type()) {
+                case DEPLOY:
+                case UPDATE:
+                    updateIdentityProvider(event.content().getId(), event.type());
+                    break;
+                case UNDEPLOY:
+                    removeIdentityProvider(event.content().getId());
+                    break;
+            }
+        }
+    }
 
-        identityProviders.forEach(identityProvider -> {
-            logger.info("\tInitializing identity provider: {} [{}]", identityProvider.getName(), identityProvider.getType());
+    private void updateIdentityProvider(String identityProviderId, IdentityProviderEvent identityProviderEvent) {
+        final String eventType = identityProviderEvent.toString().toLowerCase();
+        logger.info("Domain {} has received {} identity provider event for {}", domain.getName(), eventType, identityProviderId);
+        identityProviderService.findById(identityProviderId)
+                .subscribe(
+                        identityProvider -> {
+                            updateAuthenticationProvider(identityProvider);
+                            logger.info("Identity provider {} {}d for domain {}", identityProviderId, eventType, domain.getName());
+                        },
+                        error -> logger.error("Unable to {} identity provider for domain {}", eventType, domain.getName(), error),
+                        () -> logger.error("No identity provider found with id {}", identityProviderId));
+    }
 
+    private void updateAuthenticationProvider(IdentityProvider identityProvider) {
+        logger.info("\tInitializing identity provider: {} [{}]", identityProvider.getName(), identityProvider.getType());
+        try {
+            // stop existing provider, if any
+            clearProvider(identityProvider.getId());
+            // create and start the new provider
             AuthenticationProvider authenticationProvider =
                     identityProviderPluginManager.create(identityProvider.getType(), identityProvider.getConfiguration(),
                             identityProvider.getMappers(), identityProvider.getRoleMapper());
-            // start the authentication provider
             if (authenticationProvider != null) {
-                try {
-                    authenticationProvider.start();
-                    providers.put(identityProvider.getId(), authenticationProvider);
-                    identities.put(identityProvider.getId(), identityProvider);
-                } catch (Exception ex) {
-                    logger.error("An error occurs while starting the {} identity provider", identityProvider, ex);
-                }
+                // start the authentication provider
+                authenticationProvider.start();
+                providers.put(identityProvider.getId(), authenticationProvider);
+                identities.put(identityProvider.getId(), identityProvider);
+            }
+        } catch (Exception ex) {
+            // failed to load the plugin
+            logger.error("An error occurs while initializing the identity provider : {}", identityProvider.getName(), ex);
+            clearProvider(identityProvider.getId());
+        }
+    }
+
+    private void removeIdentityProvider(String identityProviderId) {
+        logger.info("Domain {} has received identity provider event, delete identity provider {}", domain.getName(), identityProviderId);
+        clearProvider(identityProviderId);
+    }
+
+    private void clearProvider(String identityProviderId) {
+        AuthenticationProvider authenticationProvider = providers.remove(identityProviderId);
+        if (authenticationProvider != null) {
+            // stop the authentication provider
+            try {
+                authenticationProvider.stop();
+            } catch (Exception e) {
+                logger.error("An error occurs while stopping the identity provider : {}", identityProviderId, e);
             }
-        });
+        }
+        identities.remove(identityProviderId);
     }
 }
diff --git a/gravitee-am-management-api/gravitee-am-management-api-handlers/gravitee-am-management-api-handlers-admin/src/main/java/io/gravitee/am/management/handlers/admin/spring/AdminConfiguration.java b/gravitee-am-management-api/gravitee-am-management-api-handlers/gravitee-am-management-api-handlers-admin/src/main/java/io/gravitee/am/management/handlers/admin/spring/AdminConfiguration.java
index 3c0803e5ae..c41546a7fc 100644
--- a/gravitee-am-management-api/gravitee-am-management-api-handlers/gravitee-am-management-api-handlers-admin/src/main/java/io/gravitee/am/management/handlers/admin/spring/AdminConfiguration.java
+++ b/gravitee-am-management-api/gravitee-am-management-api-handlers/gravitee-am-management-api-handlers-admin/src/main/java/io/gravitee/am/management/handlers/admin/spring/AdminConfiguration.java
@@ -17,6 +17,8 @@ package io.gravitee.am.management.handlers.admin.spring;
 
 import io.gravitee.am.management.handlers.admin.SecurityConfiguration;
 import io.gravitee.am.management.handlers.admin.WebMvcConfiguration;
+import io.gravitee.am.management.handlers.admin.form.FormManager;
+import io.gravitee.am.management.handlers.admin.form.impl.FormManagerImpl;
 import io.gravitee.am.management.handlers.admin.service.AuthenticationService;
 import io.gravitee.am.management.handlers.admin.service.impl.AuthenticationServiceImpl;
 import org.springframework.context.annotation.Bean;
@@ -39,4 +41,9 @@ public class AdminConfiguration {
     public AuthenticationService authenticationService() {
         return new AuthenticationServiceImpl();
     }
+
+    @Bean
+    public FormManager formManager() {
+        return new FormManagerImpl();
+    }
 }
diff --git a/gravitee-am-management-api/gravitee-am-management-api-handlers/gravitee-am-management-api-handlers-admin/src/main/java/io/gravitee/am/management/handlers/admin/view/DomainBasedTemplateResolver.java b/gravitee-am-management-api/gravitee-am-management-api-handlers/gravitee-am-management-api-handlers-admin/src/main/java/io/gravitee/am/management/handlers/admin/view/DomainBasedTemplateResolver.java
index 1d97884eb8..68b78f5a1f 100644
--- a/gravitee-am-management-api/gravitee-am-management-api-handlers/gravitee-am-management-api-handlers-admin/src/main/java/io/gravitee/am/management/handlers/admin/view/DomainBasedTemplateResolver.java
+++ b/gravitee-am-management-api/gravitee-am-management-api-handlers/gravitee-am-management-api-handlers-admin/src/main/java/io/gravitee/am/management/handlers/admin/view/DomainBasedTemplateResolver.java
@@ -15,58 +15,46 @@
  */
 package io.gravitee.am.management.handlers.admin.view;
 
-import io.gravitee.am.model.Domain;
-import io.gravitee.am.model.Form;
-import io.gravitee.am.model.Template;
-import io.gravitee.am.service.FormService;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.InitializingBean;
-import org.springframework.beans.factory.annotation.Autowired;
 import org.thymeleaf.IEngineConfiguration;
+import org.thymeleaf.TemplateEngine;
 import org.thymeleaf.templateresolver.AbstractConfigurableTemplateResolver;
 import org.thymeleaf.templateresource.ITemplateResource;
 import org.thymeleaf.templateresource.StringTemplateResource;
 
-import java.util.HashMap;
 import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
 
 /**
  * @author David BRASSELY (david.brassely at graviteesource.com)
  * @author Titouan COMPIEGNE (titouan.compiegne at graviteesource.com)
  * @author GraviteeSource Team
  */
-public class DomainBasedTemplateResolver extends AbstractConfigurableTemplateResolver implements InitializingBean {
+public class DomainBasedTemplateResolver extends AbstractConfigurableTemplateResolver {
 
-    private static final Logger logger = LoggerFactory.getLogger(DomainBasedTemplateResolver.class);
+    private ConcurrentMap<String, StringTemplateResource> templates = new ConcurrentHashMap<>();
 
-    @Autowired
-    private FormService formService;
-
-    @Autowired
-    private Domain domain;
-
-    private Map<String, String> templates = new HashMap<>();
+    private TemplateEngine templateEngine;
 
     @Override
     protected ITemplateResource computeTemplateResource(IEngineConfiguration configuration, String ownerTemplate, String template, String resourceName, String characterEncoding, Map<String, Object> templateResolutionAttributes) {
         if (templates.containsKey(resourceName)) {
-            return new StringTemplateResource(templates.get(resourceName));
+            return templates.get(resourceName);
         }
         return null;
     }
 
-    @Override
-    public void afterPropertiesSet() {
-        formService.findByDomainAndTemplate(domain.getId(), Template.LOGIN.template())
-                .filter(Form::isEnabled)
-                .subscribe(
-                        page -> {
-                            logger.info("Login form has been overridden for domain {}.", domain.getName());
-                            templates.put(page.getTemplate(), page.getContent());
-                        },
-                        error -> logger.error("Unable to initialize login page for domain {}", domain.getName(), error),
-                        () -> logger.info("View templating has not been overridden with custom view, returning default views.")
-                );
+    public void addForm(String templateName, String templateContent) {
+        templates.put(templateName, new StringTemplateResource(templateContent));
+        templateEngine.getCacheManager().clearAllCaches();
+    }
+
+    public void removeForm(String templateName) {
+        templates.remove(templateName);
+        templateEngine.getCacheManager().clearAllCaches();
+    }
+
+    public void setTemplateEngine(TemplateEngine templateEngine) {
+        this.templateEngine = templateEngine;
     }
 }
diff --git a/gravitee-am-management-api/gravitee-am-management-api-handlers/gravitee-am-management-api-handlers-admin/src/main/java/io/gravitee/am/management/handlers/admin/view/ThymeleafConfiguration.java b/gravitee-am-management-api/gravitee-am-management-api-handlers/gravitee-am-management-api-handlers-admin/src/main/java/io/gravitee/am/management/handlers/admin/view/ThymeleafConfiguration.java
index d8914ef201..ed4521722d 100644
--- a/gravitee-am-management-api/gravitee-am-management-api-handlers/gravitee-am-management-api-handlers-admin/src/main/java/io/gravitee/am/management/handlers/admin/view/ThymeleafConfiguration.java
+++ b/gravitee-am-management-api/gravitee-am-management-api-handlers/gravitee-am-management-api-handlers-admin/src/main/java/io/gravitee/am/management/handlers/admin/view/ThymeleafConfiguration.java
@@ -35,7 +35,11 @@ public class ThymeleafConfiguration {
     public TemplateEngine getTemplateEngine() {
         SpringTemplateEngine templateEngine = new SpringTemplateEngine();
         templateEngine.setEnableSpringELCompiler(true);
-        templateEngine.setTemplateResolver(overrideTemplateResolver());
+
+        // set template resolvers
+        DomainBasedTemplateResolver overrideTemplateResolver = (DomainBasedTemplateResolver) overrideTemplateResolver();
+        overrideTemplateResolver.setTemplateEngine(templateEngine);
+        templateEngine.setTemplateResolver(overrideTemplateResolver);
         templateEngine.addTemplateResolver(defaultTemplateResolver());
         return templateEngine;
     }
diff --git a/gravitee-am-management-api/gravitee-am-management-api-services/gravitee-am-management-api-services-sync/src/main/java/io/gravitee/am/management/services/sync/SyncManager.java b/gravitee-am-management-api/gravitee-am-management-api-services/gravitee-am-management-api-services-sync/src/main/java/io/gravitee/am/management/services/sync/SyncManager.java
index 90bbea8147..8768622f6e 100644
--- a/gravitee-am-management-api/gravitee-am-management-api-services/gravitee-am-management-api-services-sync/src/main/java/io/gravitee/am/management/services/sync/SyncManager.java
+++ b/gravitee-am-management-api/gravitee-am-management-api-services/gravitee-am-management-api-services-sync/src/main/java/io/gravitee/am/management/services/sync/SyncManager.java
@@ -17,12 +17,20 @@ package io.gravitee.am.management.services.sync;
 
 import io.gravitee.am.management.core.event.DomainEvent;
 import io.gravitee.am.model.Domain;
+import io.gravitee.am.model.common.event.Event;
 import io.gravitee.am.service.DomainService;
+import io.gravitee.am.service.EventService;
 import io.gravitee.common.event.EventManager;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 
+import java.util.*;
+import java.util.function.BinaryOperator;
+
+import static java.util.Comparator.comparing;
+import static java.util.stream.Collectors.toMap;
+
 /**
  * @author Titouan COMPIEGNE (titouan.compiegne at graviteesource.com)
  * @author GraviteeSource Team
@@ -35,29 +43,62 @@ public class SyncManager {
     @Autowired
     private DomainService domainService;
 
+    @Autowired
+    private EventService eventService;
+
     @Autowired
     private EventManager eventManager;
 
     private Domain deployedAdminDomain;
 
+    private long lastRefreshAt = -1;
+
+    private long lastDelay = 0;
+
     public void refresh() {
         logger.debug("Refreshing sync state...");
+        long nextLastRefreshAt = System.currentTimeMillis();
 
-        // For AM Management API only admin domain is used
-        Domain adminDomain = domainService.findById(ADMIN_DOMAIN).blockingGet();
-
-        if (adminDomain != null) {
-            // Deploy admin domain
-            if (deployedAdminDomain == null) {
-                eventManager.publishEvent(DomainEvent.DEPLOY, adminDomain);
-                deployedAdminDomain = adminDomain;
+        try {
+            if (lastRefreshAt == -1 || deployedAdminDomain == null) {
+                logger.debug("Initial synchronization");
+                deployDomains();
             } else {
-                // Check last update date
-                if (adminDomain.getUpdatedAt().after(deployedAdminDomain.getUpdatedAt())) {
-                    eventManager.publishEvent(DomainEvent.UPDATE, adminDomain);
-                    deployedAdminDomain = adminDomain;
+                // search for events and compute them
+                logger.debug("Events synchronization");
+                List<Event> events = eventService.findByTimeFrame(lastRefreshAt - lastDelay, nextLastRefreshAt).blockingGet();
+
+                if (events != null && !events.isEmpty()) {
+                    // Extract only the latest events by type and id
+                    Map<AbstractMap.SimpleEntry, Event> sortedEvents = events
+                            .stream()
+                            .collect(
+                                    toMap(
+                                            event -> new AbstractMap.SimpleEntry<>(event.getType(), event.getPayload().getId()),
+                                            event -> event, BinaryOperator.maxBy(comparing(Event::getCreatedAt)), LinkedHashMap::new));
+                    computeEvents(sortedEvents.values());
                 }
+
             }
+            lastRefreshAt = nextLastRefreshAt;
+            lastDelay = System.currentTimeMillis() - nextLastRefreshAt;
+        } catch (Exception ex) {
+            logger.error("An error occurs while synchronizing the security domains", ex);
+        }
+    }
+
+    private void deployDomains() {
+        // For AM Management API only admin domain is used
+        deployedAdminDomain = domainService.findById(ADMIN_DOMAIN).filter(Domain::isEnabled).blockingGet();
+        if (deployedAdminDomain != null) {
+            eventManager.publishEvent(DomainEvent.DEPLOY, deployedAdminDomain);
         }
     }
+
+    private void computeEvents(Collection<Event> events) {
+        events.forEach(event -> {
+            logger.debug("Compute event id : {}, with type : {} and timestamp : {} and payload : {}", event.getId(), event.getType(), event.getCreatedAt(), event.getPayload());
+            eventManager.publishEvent(io.gravitee.am.common.event.Event.valueOf(event.getType(), event.getPayload().getAction()), event.getPayload());
+        });
+    }
 }
diff --git a/gravitee-am-model/src/main/java/io/gravitee/am/model/common/event/Event.java b/gravitee-am-model/src/main/java/io/gravitee/am/model/common/event/Event.java
index 946cc8d8c2..4742b9f53a 100644
--- a/gravitee-am-model/src/main/java/io/gravitee/am/model/common/event/Event.java
+++ b/gravitee-am-model/src/main/java/io/gravitee/am/model/common/event/Event.java
@@ -15,6 +15,8 @@
  */
 package io.gravitee.am.model.common.event;
 
+import io.gravitee.am.common.event.Type;
+
 import java.util.Date;
 
 /**
diff --git a/gravitee-am-model/src/main/java/io/gravitee/am/model/common/event/Payload.java b/gravitee-am-model/src/main/java/io/gravitee/am/model/common/event/Payload.java
index 620e2d3035..75b4ba5848 100644
--- a/gravitee-am-model/src/main/java/io/gravitee/am/model/common/event/Payload.java
+++ b/gravitee-am-model/src/main/java/io/gravitee/am/model/common/event/Payload.java
@@ -15,6 +15,8 @@
  */
 package io.gravitee.am.model.common.event;
 
+import io.gravitee.am.common.event.Action;
+
 import java.util.HashMap;
 import java.util.Map;
 
diff --git a/gravitee-am-repository/gravitee-am-repository-mongodb/src/main/java/io/gravitee/am/repository/mongodb/management/MongoEventRepository.java b/gravitee-am-repository/gravitee-am-repository-mongodb/src/main/java/io/gravitee/am/repository/mongodb/management/MongoEventRepository.java
index a2790db851..329ec5cd84 100644
--- a/gravitee-am-repository/gravitee-am-repository-mongodb/src/main/java/io/gravitee/am/repository/mongodb/management/MongoEventRepository.java
+++ b/gravitee-am-repository/gravitee-am-repository-mongodb/src/main/java/io/gravitee/am/repository/mongodb/management/MongoEventRepository.java
@@ -17,10 +17,10 @@ package io.gravitee.am.repository.mongodb.management;
 
 import com.mongodb.reactivestreams.client.MongoCollection;
 import io.gravitee.am.common.utils.RandomString;
-import io.gravitee.am.model.common.event.Action;
+import io.gravitee.am.common.event.Action;
 import io.gravitee.am.model.common.event.Event;
 import io.gravitee.am.model.common.event.Payload;
-import io.gravitee.am.model.common.event.Type;
+import io.gravitee.am.common.event.Type;
 import io.gravitee.am.repository.management.api.EventRepository;
 import io.gravitee.am.repository.mongodb.common.LoggableIndexSubscriber;
 import io.gravitee.am.repository.mongodb.management.internal.model.EventMongo;
diff --git a/gravitee-am-service/src/main/java/io/gravitee/am/service/FormService.java b/gravitee-am-service/src/main/java/io/gravitee/am/service/FormService.java
index 877e05df12..c32d8415ca 100644
--- a/gravitee-am-service/src/main/java/io/gravitee/am/service/FormService.java
+++ b/gravitee-am-service/src/main/java/io/gravitee/am/service/FormService.java
@@ -32,6 +32,8 @@ import java.util.List;
  */
 public interface FormService {
 
+    Maybe<Form> findById(String id);
+
     Single<List<Form>> findByDomain(String domain);
 
     Single<List<Form>> findByDomainAndClient(String domain, String client);
diff --git a/gravitee-am-service/src/main/java/io/gravitee/am/service/impl/CertificateServiceImpl.java b/gravitee-am-service/src/main/java/io/gravitee/am/service/impl/CertificateServiceImpl.java
index 5a37e099f8..5f4a9b4989 100644
--- a/gravitee-am-service/src/main/java/io/gravitee/am/service/impl/CertificateServiceImpl.java
+++ b/gravitee-am-service/src/main/java/io/gravitee/am/service/impl/CertificateServiceImpl.java
@@ -24,10 +24,10 @@ import io.gravitee.am.common.audit.EventType;
 import io.gravitee.am.common.utils.RandomString;
 import io.gravitee.am.identityprovider.api.User;
 import io.gravitee.am.model.Certificate;
-import io.gravitee.am.model.common.event.Action;
+import io.gravitee.am.common.event.Action;
 import io.gravitee.am.model.common.event.Event;
 import io.gravitee.am.model.common.event.Payload;
-import io.gravitee.am.model.common.event.Type;
+import io.gravitee.am.common.event.Type;
 import io.gravitee.am.plugins.certificate.core.CertificatePluginManager;
 import io.gravitee.am.plugins.certificate.core.CertificateSchema;
 import io.gravitee.am.repository.management.api.CertificateRepository;
diff --git a/gravitee-am-service/src/main/java/io/gravitee/am/service/impl/ClientServiceImpl.java b/gravitee-am-service/src/main/java/io/gravitee/am/service/impl/ClientServiceImpl.java
index f9dbf548b6..bdf695c8f3 100644
--- a/gravitee-am-service/src/main/java/io/gravitee/am/service/impl/ClientServiceImpl.java
+++ b/gravitee-am-service/src/main/java/io/gravitee/am/service/impl/ClientServiceImpl.java
@@ -23,10 +23,10 @@ import io.gravitee.am.common.web.UriBuilder;
 import io.gravitee.am.identityprovider.api.User;
 import io.gravitee.am.model.Client;
 import io.gravitee.am.model.common.Page;
-import io.gravitee.am.model.common.event.Action;
+import io.gravitee.am.common.event.Action;
 import io.gravitee.am.model.common.event.Event;
 import io.gravitee.am.model.common.event.Payload;
-import io.gravitee.am.model.common.event.Type;
+import io.gravitee.am.common.event.Type;
 import io.gravitee.am.repository.management.api.ClientRepository;
 import io.gravitee.am.repository.oauth2.api.AccessTokenRepository;
 import io.gravitee.am.service.*;
diff --git a/gravitee-am-service/src/main/java/io/gravitee/am/service/impl/DomainServiceImpl.java b/gravitee-am-service/src/main/java/io/gravitee/am/service/impl/DomainServiceImpl.java
index 3cf1553b99..6fb6d795b9 100644
--- a/gravitee-am-service/src/main/java/io/gravitee/am/service/impl/DomainServiceImpl.java
+++ b/gravitee-am-service/src/main/java/io/gravitee/am/service/impl/DomainServiceImpl.java
@@ -18,10 +18,10 @@ package io.gravitee.am.service.impl;
 import io.gravitee.am.common.audit.EventType;
 import io.gravitee.am.identityprovider.api.User;
 import io.gravitee.am.model.Domain;
-import io.gravitee.am.model.common.event.Action;
+import io.gravitee.am.common.event.Action;
 import io.gravitee.am.model.common.event.Event;
 import io.gravitee.am.model.common.event.Payload;
-import io.gravitee.am.model.common.event.Type;
+import io.gravitee.am.common.event.Type;
 import io.gravitee.am.model.oidc.OIDCSettings;
 import io.gravitee.am.repository.management.api.DomainRepository;
 import io.gravitee.am.service.*;
diff --git a/gravitee-am-service/src/main/java/io/gravitee/am/service/impl/EmailTemplateServiceImpl.java b/gravitee-am-service/src/main/java/io/gravitee/am/service/impl/EmailTemplateServiceImpl.java
index 3ca1879240..5de465e5c6 100644
--- a/gravitee-am-service/src/main/java/io/gravitee/am/service/impl/EmailTemplateServiceImpl.java
+++ b/gravitee-am-service/src/main/java/io/gravitee/am/service/impl/EmailTemplateServiceImpl.java
@@ -20,10 +20,10 @@ import io.gravitee.am.common.utils.RandomString;
 import io.gravitee.am.identityprovider.api.User;
 import io.gravitee.am.model.Email;
 import io.gravitee.am.model.Template;
-import io.gravitee.am.model.common.event.Action;
+import io.gravitee.am.common.event.Action;
 import io.gravitee.am.model.common.event.Event;
 import io.gravitee.am.model.common.event.Payload;
-import io.gravitee.am.model.common.event.Type;
+import io.gravitee.am.common.event.Type;
 import io.gravitee.am.repository.management.api.EmailRepository;
 import io.gravitee.am.service.AuditService;
 import io.gravitee.am.service.EmailTemplateService;
diff --git a/gravitee-am-service/src/main/java/io/gravitee/am/service/impl/ExtensionGrantServiceImpl.java b/gravitee-am-service/src/main/java/io/gravitee/am/service/impl/ExtensionGrantServiceImpl.java
index c139d4d701..17f0f89bca 100644
--- a/gravitee-am-service/src/main/java/io/gravitee/am/service/impl/ExtensionGrantServiceImpl.java
+++ b/gravitee-am-service/src/main/java/io/gravitee/am/service/impl/ExtensionGrantServiceImpl.java
@@ -19,10 +19,10 @@ import io.gravitee.am.common.audit.EventType;
 import io.gravitee.am.common.utils.RandomString;
 import io.gravitee.am.identityprovider.api.User;
 import io.gravitee.am.model.ExtensionGrant;
-import io.gravitee.am.model.common.event.Action;
+import io.gravitee.am.common.event.Action;
 import io.gravitee.am.model.common.event.Event;
 import io.gravitee.am.model.common.event.Payload;
-import io.gravitee.am.model.common.event.Type;
+import io.gravitee.am.common.event.Type;
 import io.gravitee.am.repository.management.api.ExtensionGrantRepository;
 import io.gravitee.am.service.AuditService;
 import io.gravitee.am.service.ClientService;
diff --git a/gravitee-am-service/src/main/java/io/gravitee/am/service/impl/FormServiceImpl.java b/gravitee-am-service/src/main/java/io/gravitee/am/service/impl/FormServiceImpl.java
index 31eb289cc6..c4167af46a 100644
--- a/gravitee-am-service/src/main/java/io/gravitee/am/service/impl/FormServiceImpl.java
+++ b/gravitee-am-service/src/main/java/io/gravitee/am/service/impl/FormServiceImpl.java
@@ -16,14 +16,14 @@
 package io.gravitee.am.service.impl;
 
 import io.gravitee.am.common.audit.EventType;
+import io.gravitee.am.common.event.Action;
+import io.gravitee.am.common.event.Type;
 import io.gravitee.am.common.utils.RandomString;
 import io.gravitee.am.identityprovider.api.User;
 import io.gravitee.am.model.Form;
 import io.gravitee.am.model.Template;
-import io.gravitee.am.model.common.event.Action;
 import io.gravitee.am.model.common.event.Event;
 import io.gravitee.am.model.common.event.Payload;
-import io.gravitee.am.model.common.event.Type;
 import io.gravitee.am.repository.management.api.FormRepository;
 import io.gravitee.am.service.AuditService;
 import io.gravitee.am.service.EventService;
@@ -67,6 +67,17 @@ public class FormServiceImpl implements FormService {
     @Autowired
     private AuditService auditService;
 
+    @Override
+    public Maybe<Form> findById(String id) {
+        LOGGER.debug("Find form by id {}", id);
+        return formRepository.findById(id)
+                .onErrorResumeNext(ex -> {
+                    LOGGER.error("An error occurs while trying to find a form using its id {}", id, ex);
+                    return Maybe.error(new TechnicalManagementException(
+                            String.format("An error occurs while trying to find a form using its id %s", id), ex));
+                });
+    }
+
     @Override
     public Single<List<Form>> findByDomain(String domain) {
         LOGGER.debug("Find form by domain {}", domain);
@@ -74,7 +85,7 @@ public class FormServiceImpl implements FormService {
                 .onErrorResumeNext(ex -> {
                     LOGGER.error("An error occurs while trying to find a form using its domain {}", domain, ex);
                     return Single.error(new TechnicalManagementException(
-                            String.format("An error occurs while trying to find a role using its domain %s", domain), ex));
+                            String.format("An error occurs while trying to find a form using its domain %s", domain), ex));
                 });
     }
 
@@ -85,7 +96,7 @@ public class FormServiceImpl implements FormService {
                 .onErrorResumeNext(ex -> {
                     LOGGER.error("An error occurs while trying to find a form using its domain {} and its client {}", domain, client, ex);
                     return Single.error(new TechnicalManagementException(
-                            String.format("An error occurs while trying to find a role using its domain %s and client %s", domain, client), ex));
+                            String.format("An error occurs while trying to find a form using its domain %s and client %s", domain, client), ex));
                 });
     }
 
@@ -96,7 +107,7 @@ public class FormServiceImpl implements FormService {
                 .onErrorResumeNext(ex -> {
                     LOGGER.error("An error occurs while trying to find a form using its domain {} and template {}", domain, template, ex);
                     return Maybe.error(new TechnicalManagementException(
-                            String.format("An error occurs while trying to find a role using its domain %s and template %s", domain, template), ex));
+                            String.format("An error occurs while trying to find a form using its domain %s and template %s", domain, template), ex));
                 });
     }
 
diff --git a/gravitee-am-service/src/main/java/io/gravitee/am/service/impl/IdentityProviderServiceImpl.java b/gravitee-am-service/src/main/java/io/gravitee/am/service/impl/IdentityProviderServiceImpl.java
index 5984e7d649..c61aaeca4d 100644
--- a/gravitee-am-service/src/main/java/io/gravitee/am/service/impl/IdentityProviderServiceImpl.java
+++ b/gravitee-am-service/src/main/java/io/gravitee/am/service/impl/IdentityProviderServiceImpl.java
@@ -19,10 +19,10 @@ import io.gravitee.am.common.audit.EventType;
 import io.gravitee.am.common.utils.RandomString;
 import io.gravitee.am.identityprovider.api.User;
 import io.gravitee.am.model.IdentityProvider;
-import io.gravitee.am.model.common.event.Action;
+import io.gravitee.am.common.event.Action;
 import io.gravitee.am.model.common.event.Event;
 import io.gravitee.am.model.common.event.Payload;
-import io.gravitee.am.model.common.event.Type;
+import io.gravitee.am.common.event.Type;
 import io.gravitee.am.repository.management.api.IdentityProviderRepository;
 import io.gravitee.am.service.AuditService;
 import io.gravitee.am.service.ClientService;
diff --git a/gravitee-am-service/src/main/java/io/gravitee/am/service/impl/PolicyServiceImpl.java b/gravitee-am-service/src/main/java/io/gravitee/am/service/impl/PolicyServiceImpl.java
index d3226cc19d..64abb95850 100644
--- a/gravitee-am-service/src/main/java/io/gravitee/am/service/impl/PolicyServiceImpl.java
+++ b/gravitee-am-service/src/main/java/io/gravitee/am/service/impl/PolicyServiceImpl.java
@@ -19,10 +19,10 @@ import io.gravitee.am.common.audit.EventType;
 import io.gravitee.am.common.utils.RandomString;
 import io.gravitee.am.identityprovider.api.User;
 import io.gravitee.am.model.Policy;
-import io.gravitee.am.model.common.event.Action;
+import io.gravitee.am.common.event.Action;
 import io.gravitee.am.model.common.event.Event;
 import io.gravitee.am.model.common.event.Payload;
-import io.gravitee.am.model.common.event.Type;
+import io.gravitee.am.common.event.Type;
 import io.gravitee.am.repository.management.api.PolicyRepository;
 import io.gravitee.am.service.AuditService;
 import io.gravitee.am.service.EventService;
diff --git a/gravitee-am-service/src/main/java/io/gravitee/am/service/impl/ReporterServiceImpl.java b/gravitee-am-service/src/main/java/io/gravitee/am/service/impl/ReporterServiceImpl.java
index d502b3ba60..2d5006c6db 100644
--- a/gravitee-am-service/src/main/java/io/gravitee/am/service/impl/ReporterServiceImpl.java
+++ b/gravitee-am-service/src/main/java/io/gravitee/am/service/impl/ReporterServiceImpl.java
@@ -19,10 +19,10 @@ import io.gravitee.am.common.audit.EventType;
 import io.gravitee.am.common.utils.RandomString;
 import io.gravitee.am.identityprovider.api.User;
 import io.gravitee.am.model.Reporter;
-import io.gravitee.am.model.common.event.Action;
+import io.gravitee.am.common.event.Action;
 import io.gravitee.am.model.common.event.Event;
 import io.gravitee.am.model.common.event.Payload;
-import io.gravitee.am.model.common.event.Type;
+import io.gravitee.am.common.event.Type;
 import io.gravitee.am.repository.management.api.ReporterRepository;
 import io.gravitee.am.service.AuditService;
 import io.gravitee.am.service.EventService;
diff --git a/gravitee-am-service/src/main/java/io/gravitee/am/service/impl/ScopeServiceImpl.java b/gravitee-am-service/src/main/java/io/gravitee/am/service/impl/ScopeServiceImpl.java
index 99c839622d..e483151041 100644
--- a/gravitee-am-service/src/main/java/io/gravitee/am/service/impl/ScopeServiceImpl.java
+++ b/gravitee-am-service/src/main/java/io/gravitee/am/service/impl/ScopeServiceImpl.java
@@ -18,10 +18,10 @@ package io.gravitee.am.service.impl;
 import io.gravitee.am.common.audit.EventType;
 import io.gravitee.am.common.utils.RandomString;
 import io.gravitee.am.identityprovider.api.User;
-import io.gravitee.am.model.common.event.Action;
+import io.gravitee.am.common.event.Action;
 import io.gravitee.am.model.common.event.Event;
 import io.gravitee.am.model.common.event.Payload;
-import io.gravitee.am.model.common.event.Type;
+import io.gravitee.am.common.event.Type;
 import io.gravitee.am.model.oauth2.Scope;
 import io.gravitee.am.repository.management.api.ScopeRepository;
 import io.gravitee.am.repository.oauth2.api.ScopeApprovalRepository;
diff --git a/gravitee-am-service/src/main/java/io/gravitee/am/service/impl/UserServiceImpl.java b/gravitee-am-service/src/main/java/io/gravitee/am/service/impl/UserServiceImpl.java
index 446d6e198b..22403134d9 100644
--- a/gravitee-am-service/src/main/java/io/gravitee/am/service/impl/UserServiceImpl.java
+++ b/gravitee-am-service/src/main/java/io/gravitee/am/service/impl/UserServiceImpl.java
@@ -18,10 +18,10 @@ package io.gravitee.am.service.impl;
 import io.gravitee.am.common.utils.RandomString;
 import io.gravitee.am.model.User;
 import io.gravitee.am.model.common.Page;
-import io.gravitee.am.model.common.event.Action;
+import io.gravitee.am.common.event.Action;
 import io.gravitee.am.model.common.event.Event;
 import io.gravitee.am.model.common.event.Payload;
-import io.gravitee.am.model.common.event.Type;
+import io.gravitee.am.common.event.Type;
 import io.gravitee.am.repository.management.api.UserRepository;
 import io.gravitee.am.service.EventService;
 import io.gravitee.am.service.UserService;
diff --git a/gravitee-am-ui/package-lock.json b/gravitee-am-ui/package-lock.json
index 4c8aae990b..a2674bc620 100644
--- a/gravitee-am-ui/package-lock.json
+++ b/gravitee-am-ui/package-lock.json
@@ -1,6 +1,6 @@
 {
   "name": "gravitee-am-webui",
-  "version": "2.10.2",
+  "version": "2.10.3",
   "lockfileVersion": 1,
   "requires": true,
   "dependencies": {


Test patch:
diff --git a/gravitee-am-gateway/gravitee-am-gateway-handler/gravitee-am-gateway-handler-common/src/test/java/io/gravitee/am/gateway/handler/common/client/ClientSyncServiceTest.java b/gravitee-am-gateway/gravitee-am-gateway-handler/gravitee-am-gateway-handler-common/src/test/java/io/gravitee/am/gateway/handler/common/client/ClientSyncServiceTest.java
index 98dce7319f..7aac6b0f2a 100644
--- a/gravitee-am-gateway/gravitee-am-gateway-handler/gravitee-am-gateway-handler-common/src/test/java/io/gravitee/am/gateway/handler/common/client/ClientSyncServiceTest.java
+++ b/gravitee-am-gateway/gravitee-am-gateway-handler/gravitee-am-gateway-handler-common/src/test/java/io/gravitee/am/gateway/handler/common/client/ClientSyncServiceTest.java
@@ -15,16 +15,15 @@
  */
 package io.gravitee.am.gateway.handler.common.client;
 
-import io.gravitee.am.gateway.core.event.ClientEvent;
+import io.gravitee.am.common.event.ClientEvent;
 import io.gravitee.am.gateway.handler.common.client.impl.ClientSyncServiceImpl;
 import io.gravitee.am.model.Client;
 import io.gravitee.am.model.Domain;
-import io.gravitee.am.model.common.event.Action;
+import io.gravitee.am.common.event.Action;
 import io.gravitee.am.model.common.event.Payload;
 import io.gravitee.am.repository.management.api.ClientRepository;
 import io.gravitee.common.event.Event;
 import io.gravitee.common.event.EventListener;
-import io.gravitee.common.event.EventManager;
 import io.reactivex.Maybe;
 import io.reactivex.Single;
 import io.reactivex.observers.TestObserver;
diff --git a/gravitee-am-gateway/gravitee-am-gateway-handler/gravitee-am-gateway-handler-oidc/src/test/java/io/gravitee/am/gateway/handler/oauth2/service/request/AuthorizationRequestResolverTest.java b/gravitee-am-gateway/gravitee-am-gateway-handler/gravitee-am-gateway-handler-oidc/src/test/java/io/gravitee/am/gateway/handler/oauth2/service/request/AuthorizationRequestResolverTest.java
index fb7645c1f7..09f33c414b 100644
--- a/gravitee-am-gateway/gravitee-am-gateway-handler/gravitee-am-gateway-handler-oidc/src/test/java/io/gravitee/am/gateway/handler/oauth2/service/request/AuthorizationRequestResolverTest.java
+++ b/gravitee-am-gateway/gravitee-am-gateway-handler/gravitee-am-gateway-handler-oidc/src/test/java/io/gravitee/am/gateway/handler/oauth2/service/request/AuthorizationRequestResolverTest.java
@@ -22,9 +22,11 @@ import io.gravitee.am.model.User;
 import io.reactivex.observers.TestObserver;
 import org.junit.Test;
 
+import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collections;
 import java.util.HashSet;
+import java.util.List;
 
 /**
  * @author Titouan COMPIEGNE (titouan.compiegne at graviteesource.com)
@@ -111,13 +113,17 @@ public class AuthorizationRequestResolverTest {
     }
 
     @Test
-    public void shouldResolveAuthorizationRequest_userPermissions() {
+    public void shouldResolveAuthorizationRequest_userPermissionsRequestedAll() {
         final String scope = "read";
-        final String userScope = "user";
+        final List<String> userScopes = Arrays.asList("user1", "user2", "user3");
         final String redirectUri = "http://localhost:8080/callback";
+        
         AuthorizationRequest authorizationRequest = new AuthorizationRequest();
         authorizationRequest.setRedirectUri(redirectUri);
-        authorizationRequest.setScopes(new HashSet<>(Arrays.asList(scope, userScope)));
+        List<String> authScopes = new ArrayList<>();
+        authScopes.add(scope);
+        authScopes.addAll(userScopes);
+        authorizationRequest.setScopes(new HashSet<>(authScopes));
 
         Client client = new Client();
         client.setScopes(Collections.singletonList(scope));
@@ -125,11 +131,82 @@ public class AuthorizationRequestResolverTest {
 
         User user = new User();
         Role role = new Role();
-        role.setPermissions(Collections.singletonList(userScope));
+        role.setPermissions(userScopes);
         user.setRolesPermissions(Collections.singleton(role));
+        
+        TestObserver<AuthorizationRequest> testObserver = authorizationRequestResolver.resolve(authorizationRequest, client, user).test();
+        testObserver.assertComplete();
+        testObserver.assertNoErrors();
+        
+        // Request should have been enhanced with all of user's permissions, even though none of them has been requested
+        List<String> expectedScopes = new ArrayList<>();
+        expectedScopes.add(scope);
+        expectedScopes.addAll(userScopes);
+        testObserver.assertValue(request -> request.getScopes().containsAll(expectedScopes) && request.getScopes().contains(scope) && request.getScopes().size() == 4);
+    }
+    
+    @Test
+    public void shouldResolveAuthorizationRequest_userPermissionsRequestedAny() {
+    	final String scope = "read";
+        final List<String> userScopes = Arrays.asList("user1", "user2", "user3");
+        final String redirectUri = "http://localhost:8080/callback";
+        
+        AuthorizationRequest authorizationRequest = new AuthorizationRequest();
+        authorizationRequest.setRedirectUri(redirectUri);
+        List<String> authScopes = new ArrayList<>();
+        authScopes.add(scope);
+        authScopes.add(userScopes.get(1)); // Request only the second of the three user scopes
+        authorizationRequest.setScopes(new HashSet<>(authScopes));
 
+        Client client = new Client();
+        client.setScopes(Collections.singletonList(scope));
+        client.setEnhanceScopesWithUserPermissions(true);
+
+        User user = new User();
+        Role role = new Role();
+        role.setPermissions(userScopes);
+        user.setRolesPermissions(Collections.singleton(role));
+        
+        TestObserver<AuthorizationRequest> testObserver = authorizationRequestResolver.resolve(authorizationRequest, client, user).test();
+        testObserver.assertComplete();
+        testObserver.assertNoErrors();
+        
+        // Request should have been enhanced with all of user's permissions, even though only one has been requested
+        List<String> expectedScopes = new ArrayList<>();
+        expectedScopes.add(scope);
+        expectedScopes.addAll(userScopes);
+        testObserver.assertValue(request -> request.getScopes().containsAll(expectedScopes) && request.getScopes().contains(scope) && request.getScopes().size() == 4);
+    }
+    
+    @Test
+    public void shouldResolveAuthorizationRequest_userPermissionsRequestedNone() {
+    	final String scope = "read";
+        final List<String> userScopes = Arrays.asList("user1", "user2", "user3");
+        final String redirectUri = "http://localhost:8080/callback";
+        
+        AuthorizationRequest authorizationRequest = new AuthorizationRequest();
+        authorizationRequest.setRedirectUri(redirectUri);
+        // Request none of the three user scopes
+        authorizationRequest.setScopes(new HashSet<>(Arrays.asList(scope)));
+        
+        Client client = new Client();
+        client.setScopes(Collections.singletonList(scope));
+        client.setEnhanceScopesWithUserPermissions(true);
+        
+        User user = new User();
+        Role role = new Role();
+        role.setPermissions(userScopes);
+        user.setRolesPermissions(Collections.singleton(role));
+        
         TestObserver<AuthorizationRequest> testObserver = authorizationRequestResolver.resolve(authorizationRequest, client, user).test();
         testObserver.assertComplete();
         testObserver.assertNoErrors();
+        
+        List<String> expectedScopes = new ArrayList<>();
+        expectedScopes.add(scope);
+        expectedScopes.addAll(userScopes);
+        
+        // Request should have been enhanced with all of user's permissions, even though none of them has been requested
+        testObserver.assertValue(request -> request.getScopes().containsAll(expectedScopes) && request.getScopes().contains(scope) && request.getScopes().size() == 4);
     }
 }
diff --git a/gravitee-am-gateway/gravitee-am-gateway-handler/gravitee-am-gateway-handler-oidc/src/test/java/io/gravitee/am/gateway/handler/oauth2/service/request/TokenRequestResolverTest.java b/gravitee-am-gateway/gravitee-am-gateway-handler/gravitee-am-gateway-handler-oidc/src/test/java/io/gravitee/am/gateway/handler/oauth2/service/request/TokenRequestResolverTest.java
index 19b26bba74..0bc5fe3ffe 100644
--- a/gravitee-am-gateway/gravitee-am-gateway-handler/gravitee-am-gateway-handler-oidc/src/test/java/io/gravitee/am/gateway/handler/oauth2/service/request/TokenRequestResolverTest.java
+++ b/gravitee-am-gateway/gravitee-am-gateway-handler/gravitee-am-gateway-handler-oidc/src/test/java/io/gravitee/am/gateway/handler/oauth2/service/request/TokenRequestResolverTest.java
@@ -22,9 +22,11 @@ import io.gravitee.am.model.User;
 import io.reactivex.observers.TestObserver;
 import org.junit.Test;
 
+import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collections;
 import java.util.HashSet;
+import java.util.List;
 
 /**
  * @author Titouan COMPIEGNE (titouan.compiegne at graviteesource.com)
@@ -47,23 +49,95 @@ public class TokenRequestResolverTest {
     }
 
     @Test
-    public void shouldResolveTokenRequest_withUser() {
+    public void shouldResolveTokenRequest_withUser_permissionsRequestedAll() {
         final String scope = "read";
-        final String userScope = "user";
+        final List<String> userScopes = Arrays.asList("user1", "user2", "user3");
+        
         TokenRequest tokenRequest = new TokenRequest();
-        tokenRequest.setScopes(new HashSet<>(Arrays.asList(scope, userScope)));
+        List<String> reqScopes = new ArrayList<>();
+        reqScopes.add(scope);
+        reqScopes.addAll(userScopes);
+        tokenRequest.setScopes(new HashSet<>(reqScopes));
+        
         Client client = new Client();
         client.setEnhanceScopesWithUserPermissions(true);
         client.setScopes(Collections.singletonList(scope));
 
         User user = new User();
         Role role = new Role();
-        role.setPermissions(Collections.singletonList("user"));
+        role.setPermissions(userScopes);
+        user.setRolesPermissions(Collections.singleton(role));
+
+        TestObserver<TokenRequest> testObserver = tokenRequestResolver.resolve(tokenRequest, client, user).test();
+        testObserver.assertComplete();
+        testObserver.assertNoErrors();
+        
+        List<String> expectedScopes = new ArrayList<>();
+        expectedScopes.add(scope);
+        expectedScopes.addAll(userScopes);
+        testObserver.assertValue(request -> request.getScopes().containsAll(expectedScopes) && request.getScopes().contains(scope) && request.getScopes().size() == 4);
+    }
+    
+    @Test
+    public void shouldResolveTokenRequest_withUser_permissionsRequestedAny() {
+        final String scope = "read";
+        final List<String> userScopes = Arrays.asList("user1", "user2", "user3");
+        
+        TokenRequest tokenRequest = new TokenRequest();
+        List<String> reqScopes = new ArrayList<>();
+        reqScopes.add(scope);
+        reqScopes.add(userScopes.get(1)); // Request only the second of the three user scopes
+        tokenRequest.setScopes(new HashSet<>(reqScopes));
+        
+        Client client = new Client();
+        client.setEnhanceScopesWithUserPermissions(true);
+        client.setScopes(Collections.singletonList(scope));
+
+        User user = new User();
+        Role role = new Role();
+        role.setPermissions(userScopes);
+        user.setRolesPermissions(Collections.singleton(role));
+
+        TestObserver<TokenRequest> testObserver = tokenRequestResolver.resolve(tokenRequest, client, user).test();
+        testObserver.assertComplete();
+        testObserver.assertNoErrors();
+        
+        // Request should have been enhanced with all of user's permissions, even though only one has been requested
+        List<String> expectedScopes = new ArrayList<>();
+        expectedScopes.add(scope);
+        expectedScopes.addAll(userScopes);
+        testObserver.assertValue(request -> request.getScopes().containsAll(expectedScopes) && request.getScopes().contains(scope) && request.getScopes().size() == 4);
+    }
+    
+    @Test
+    public void shouldResolveTokenRequest_withUser_permissionsRequestedNone() {
+        final String scope = "read";
+        final List<String> userScopes = Arrays.asList("user1", "user2", "user3");
+        
+        TokenRequest tokenRequest = new TokenRequest();
+        List<String> reqScopes = new ArrayList<>();
+        reqScopes.add(scope);
+        // Request none of the three user scopes
+        tokenRequest.setScopes(new HashSet<>(reqScopes));
+        
+        Client client = new Client();
+        client.setEnhanceScopesWithUserPermissions(true);
+        client.setScopes(Collections.singletonList(scope));
+
+        User user = new User();
+        Role role = new Role();
+        role.setPermissions(userScopes);
         user.setRolesPermissions(Collections.singleton(role));
 
         TestObserver<TokenRequest> testObserver = tokenRequestResolver.resolve(tokenRequest, client, user).test();
         testObserver.assertComplete();
         testObserver.assertNoErrors();
+        
+        // Request should have been enhanced with all of user's permissions, even though none of them has been requested
+        List<String> expectedScopes = new ArrayList<>();
+        expectedScopes.add(scope);
+        expectedScopes.addAll(userScopes);
+        testObserver.assertValue(request -> request.getScopes().containsAll(expectedScopes) && request.getScopes().contains(scope) && request.getScopes().size() == 4);
     }
 
     @Test
@@ -139,4 +213,5 @@ public class TokenRequestResolverTest {
         testObserver.assertNoErrors();
         testObserver.assertValue(request -> request.getScopes().iterator().next().equals(scope));
     }
+    
 }
diff --git a/gravitee-am-gateway/gravitee-am-gateway-reactor/src/test/java/io/gravitee/am/gateway/reactor/SecurityDomainManagerTest.java b/gravitee-am-gateway/gravitee-am-gateway-reactor/src/test/java/io/gravitee/am/gateway/reactor/SecurityDomainManagerTest.java
index f16c2313dd..e6cb49494c 100644
--- a/gravitee-am-gateway/gravitee-am-gateway-reactor/src/test/java/io/gravitee/am/gateway/reactor/SecurityDomainManagerTest.java
+++ b/gravitee-am-gateway/gravitee-am-gateway-reactor/src/test/java/io/gravitee/am/gateway/reactor/SecurityDomainManagerTest.java
@@ -15,8 +15,8 @@
  */
 package io.gravitee.am.gateway.reactor;
 
-import io.gravitee.am.gateway.core.event.DomainEvent;
-import io.gravitee.am.gateway.core.event.EventManager;
+import io.gravitee.am.common.event.DomainEvent;
+import io.gravitee.am.common.event.EventManager;
 import io.gravitee.am.gateway.reactor.impl.DefaultSecurityDomainManager;
 import io.gravitee.am.model.Domain;
 import org.junit.Assert;
diff --git a/gravitee-am-gateway/gravitee-am-gateway-services/gravitee-am-gateway-services-sync/src/test/java/io/gravitee/am/gateway/services/sync/SyncManagerTest.java b/gravitee-am-gateway/gravitee-am-gateway-services/gravitee-am-gateway-services-sync/src/test/java/io/gravitee/am/gateway/services/sync/SyncManagerTest.java
index 32647746e6..6fecc4916c 100644
--- a/gravitee-am-gateway/gravitee-am-gateway-services/gravitee-am-gateway-services-sync/src/test/java/io/gravitee/am/gateway/services/sync/SyncManagerTest.java
+++ b/gravitee-am-gateway/gravitee-am-gateway-services/gravitee-am-gateway-services-sync/src/test/java/io/gravitee/am/gateway/services/sync/SyncManagerTest.java
@@ -17,10 +17,10 @@ package io.gravitee.am.gateway.services.sync;
 
 import io.gravitee.am.gateway.reactor.SecurityDomainManager;
 import io.gravitee.am.model.Domain;
-import io.gravitee.am.model.common.event.Action;
+import io.gravitee.am.common.event.Action;
 import io.gravitee.am.model.common.event.Event;
 import io.gravitee.am.model.common.event.Payload;
-import io.gravitee.am.model.common.event.Type;
+import io.gravitee.am.common.event.Type;
 import io.gravitee.am.repository.management.api.DomainRepository;
 import io.gravitee.am.repository.management.api.EventRepository;
 import io.gravitee.common.event.EventManager;
diff --git a/gravitee-am-repository/gravitee-am-repository-mongodb/src/test/java/io/gravitee/am/repository/mongodb/management/MongoEventRepositoryTest.java b/gravitee-am-repository/gravitee-am-repository-mongodb/src/test/java/io/gravitee/am/repository/mongodb/management/MongoEventRepositoryTest.java
index 701d3ef696..1b20ed188c 100644
--- a/gravitee-am-repository/gravitee-am-repository-mongodb/src/test/java/io/gravitee/am/repository/mongodb/management/MongoEventRepositoryTest.java
+++ b/gravitee-am-repository/gravitee-am-repository-mongodb/src/test/java/io/gravitee/am/repository/mongodb/management/MongoEventRepositoryTest.java
@@ -16,7 +16,7 @@
 package io.gravitee.am.repository.mongodb.management;
 
 import io.gravitee.am.model.common.event.Event;
-import io.gravitee.am.model.common.event.Type;
+import io.gravitee.am.common.event.Type;
 import io.gravitee.am.repository.exceptions.TechnicalException;
 import io.gravitee.am.repository.management.api.EventRepository;
 import io.reactivex.observers.TestObserver;