You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@syncope.apache.org by il...@apache.org on 2021/06/28 15:51:16 UTC

[syncope] branch 2_1_X updated: [SYNCOPE-129] Delegation (#274)

This is an automated email from the ASF dual-hosted git repository.

ilgrosso pushed a commit to branch 2_1_X
in repository https://gitbox.apache.org/repos/asf/syncope.git


The following commit(s) were added to refs/heads/2_1_X by this push:
     new dd3af2b  [SYNCOPE-129] Delegation (#274)
dd3af2b is described below

commit dd3af2b34051abdfaf17a9f40a6b9bee97592a9d
Author: Francesco Chicchiriccò <il...@users.noreply.github.com>
AuthorDate: Mon Jun 28 17:51:11 2021 +0200

    [SYNCOPE-129] Delegation (#274)
---
 .../client/console/SyncopeConsoleSession.java      |  27 +-
 .../syncope/client/console/commons/Constants.java  |   4 +-
 .../notifications/NotificationWizardBuilder.java   |  10 +-
 .../syncope/client/console/pages/BasePage.java     |  59 ++---
 .../syncope/client/console/pages/Security.java     |  55 +++--
 .../console/panels/ApplicationDirectoryPanel.java  |   1 -
 .../console/panels/DelegationDirectoryPanel.java   | 224 +++++++++++++++++
 .../console/panels/DelegationSelectionPanel.java   |  57 +++++
 .../console/panels/SecurityQuestionsPanel.java     |   6 +-
 .../console/panels/search/SearchClausePanel.java   |   4 +-
 .../client/console/rest/ApplicationRestClient.java |   1 -
 ...onRestClient.java => DelegationRestClient.java} |  25 +-
 .../client/console/rest/LoggerRestClient.java      |   6 +-
 .../repeater/data/table/AjaxFallbackDataTable.java |   4 +-
 .../markup/html/bootstrap/dialog/BaseModal.java    |   4 +-
 .../console/wizards/AjaxWizardMgtButtonBar.java    |   2 +-
 .../console/wizards/DelegationWizardBuilder.java   | 211 ++++++++++++++++
 .../UserSelectionWizardStep.java}                  |  75 +++---
 .../any}/MergeLinkedAccountsResourcesPanel.java    |  43 ++--
 .../any}/MergeLinkedAccountsReviewPanel.java       |  56 ++---
 .../any}/MergeLinkedAccountsSearchPanel.java       |  48 ++--
 .../any/MergeLinkedAccountsWizardBuilder.java      |   3 -
 .../client/console/wizards/any/Ownership.java      |   4 +-
 .../console/wizards/role/RoleWizardBuilder.java    |  13 +-
 .../console/SyncopeConsoleApplication.properties   |   1 +
 .../SyncopeConsoleApplication_fr_CA.properties     |   1 +
 .../SyncopeConsoleApplication_it.properties        |   1 +
 .../SyncopeConsoleApplication_ja.properties        |   1 +
 .../SyncopeConsoleApplication_pt_BR.properties     |   1 +
 .../SyncopeConsoleApplication_ru.properties        |   1 +
 .../syncope/client/console/pages/BasePage.html     |  15 ++
 .../client/console/pages/BasePage.properties       |   2 +
 .../client/console/pages/BasePage_fr_CA.properties |   8 +-
 .../client/console/pages/BasePage_it.properties    |   4 +-
 .../client/console/pages/BasePage_ja.properties    |   2 +
 .../client/console/pages/BasePage_pt_BR.properties |   2 +
 .../client/console/pages/BasePage_ru.properties    |   2 +
 .../client/console/pages/Security.properties       |   1 +
 .../client/console/pages/Security_fr_CA.properties |   9 +-
 .../client/console/pages/Security_it.properties    |   1 +
 .../client/console/pages/Security_ja.properties    |   1 +
 .../client/console/pages/Security_pt_BR.properties |   1 +
 .../client/console/pages/Security_ru.properties    |   1 +
 .../DelegationDirectoryPanel.properties}           |   7 +-
 ...s => DelegationDirectoryPanel_fr_CA.properties} |   8 +-
 ...ties => DelegationDirectoryPanel_it.properties} |   8 +-
 .../DelegationDirectoryPanel_ja.properties}        |   7 +-
 .../DelegationDirectoryPanel_pt_BR.properties}     |   7 +-
 .../DelegationDirectoryPanel_ru.properties}        |  17 +-
 ...cesPanel.html => DelegationSelectionPanel.html} |   7 +-
 .../tasks/ExecutionsDirectoryPanel_it.properties   |   4 +-
 .../markup/html/form/ActionsPanel_it.properties    |   2 +-
 .../DelegationWizardBuilder$Roles.html}            |   7 +-
 .../DelegationWizardBuilder$StartEnd.html}         |  10 +-
 .../DelegationWizardBuilder$Users.html}            |  10 +-
 .../UserSelectionWizardStep.html}                  |   8 +-
 .../any}/MergeLinkedAccountsResourcesPanel.html    |   0
 .../MergeLinkedAccountsResourcesPanel.properties   |   0
 ...geLinkedAccountsResourcesPanel_fr_CA.properties |   0
 ...MergeLinkedAccountsResourcesPanel_it.properties |   0
 ...MergeLinkedAccountsResourcesPanel_ja.properties |   0
 ...geLinkedAccountsResourcesPanel_pt_BR.properties |   0
 ...MergeLinkedAccountsResourcesPanel_ru.properties |   0
 .../any}/MergeLinkedAccountsReviewPanel.html       |   0
 .../any}/MergeLinkedAccountsReviewPanel.properties |   0
 ...MergeLinkedAccountsReviewPanel_fr_CA.properties |   0
 .../MergeLinkedAccountsReviewPanel_it.properties   |   0
 .../MergeLinkedAccountsReviewPanel_ja.properties   |   0
 ...MergeLinkedAccountsReviewPanel_pt_BR.properties |   0
 .../MergeLinkedAccountsReviewPanel_ru.properties   |   0
 .../any}/MergeLinkedAccountsSearchPanel.html       |   0
 .../any}/MergeLinkedAccountsSearchPanel.properties |   0
 ...MergeLinkedAccountsSearchPanel_fr_CA.properties |   0
 .../MergeLinkedAccountsSearchPanel_it.properties   |   0
 .../MergeLinkedAccountsSearchPanel_ja.properties   |   0
 ...MergeLinkedAccountsSearchPanel_pt_BR.properties |   0
 .../MergeLinkedAccountsSearchPanel_ru.properties   |   0
 .../syncope/client/console/AbstractTest.java       |   4 +-
 .../client/lib/AnonymousAuthenticationHandler.java |   1 -
 .../client/lib/BasicAuthenticationHandler.java     |   1 -
 .../apache/syncope/client/lib/SyncopeClient.java   |  30 ++-
 .../common/lib/to/AbstractStartEndBean.java        |   2 +-
 .../lib/to/{ExecTO.java => DelegationTO.java}      |  94 ++++---
 .../org/apache/syncope/common/lib/to/ExecTO.java   |   2 +-
 .../org/apache/syncope/common/lib/to/UserTO.java   |  24 ++
 .../common/lib/types/StandardEntitlement.java      |  10 +
 .../syncope/common/rest/api/RESTHeaders.java       |   4 +
 .../syncope/common/rest/api/beans/AuditQuery.java  |  10 +-
 .../common/rest/api/service/DelegationService.java | 122 ++++++++++
 .../common/rest/api/service/UserSelfService.java   |   5 +-
 .../syncope/core/logic/ApplicationLogic.java       |   1 -
 .../apache/syncope/core/logic/DelegationLogic.java | 164 +++++++++++++
 .../org/apache/syncope/core/logic/LoggerLogic.java |   2 +-
 .../syncope/core/logic/LogicInvocationHandler.java |   2 +-
 .../org/apache/syncope/core/logic/UserLogic.java   |  14 +-
 .../core/persistence/api/dao/DelegationDAO.java    |  37 +--
 .../core/persistence/api/dao/LoggerDAO.java        |  10 +-
 .../syncope/core/persistence/api/dao/UserDAO.java  |   2 +
 .../core/persistence/api/entity/Delegation.java}   |  32 ++-
 .../core/persistence/jpa/dao/JPADelegationDAO.java | 118 +++++++++
 .../core/persistence/jpa/dao/JPALoggerDAO.java     |  40 ++-
 .../core/persistence/jpa/dao/JPARoleDAO.java       |   6 +
 .../core/persistence/jpa/dao/JPAUserDAO.java       |  28 +++
 .../jpa/entity/AbstractSysInfoListener.java        |   5 +-
 .../core/persistence/jpa/entity/JPADelegation.java | 129 ++++++++++
 .../persistence/jpa/entity/JPAEntityFactory.java   |   3 +
 .../jpa/validation/entity/DelegationCheck.java     |  34 ++-
 .../jpa/validation/entity/DelegationValidator.java |  59 +++++
 .../core/persistence/jpa/inner/AnySearchTest.java  |   2 +-
 .../persistence/jpa/inner/ConnInstanceTest.java    |   2 +-
 .../persistence/jpa/inner/MultitenancyTest.java    |   2 +-
 .../core/persistence/jpa/inner/ResourceTest.java   |   2 +-
 .../persistence/jpa/outer/PlainSchemaTest.java     |   2 +-
 .../core/persistence/jpa/outer/RoleTest.java       |  34 +++
 .../core/persistence/jpa/outer/UserTest.java       |  39 +++
 .../api/data/DelegationDataBinder.java             |  17 +-
 .../java/data/ApplicationDataBinderImpl.java       |   4 +-
 .../java/data/DelegationDataBinderImpl.java        | 115 +++++++++
 .../provisioning/java/data/UserDataBinderImpl.java |  13 +-
 .../java/job/AbstractSchedTaskJobDelegate.java     |   6 +-
 .../DefaultNotificationJobDelegate.java            |   8 +-
 .../AbstractPropagationTaskExecutor.java           |   4 +-
 .../DefaultPropagationTaskCallable.java            |   5 +-
 .../java/pushpull/AbstractPullResultHandler.java   |   4 +-
 .../java/pushpull/AbstractPushResultHandler.java   |   2 +-
 .../pushpull/DefaultRealmPullResultHandler.java    |   4 +-
 .../pushpull/DefaultRealmPushResultHandler.java    |   2 +-
 .../java/data/ResourceDataBinderTest.java          |   2 +-
 .../core/rest/cxf/SyncopeOpenApiCustomizer.java    |  24 +-
 .../rest/cxf/service/ApplicationServiceImpl.java   |   1 -
 ...ServiceImpl.java => DelegationServiceImpl.java} |  27 +-
 .../core/rest/cxf/service/UserSelfServiceImpl.java |   7 +-
 .../core/spring/security/AuthContextUtils.java     |  53 ++--
 .../core/spring/security/AuthDataAccessor.java     | 189 +++++++++-----
 .../spring/security/JWTAuthenticationProvider.java |   2 +-
 .../security/SyncopeAuthenticationDetails.java     |  13 +-
 .../SyncopeAuthenticationDetailsSource.java        |   1 -
 .../UsernamePasswordAuthenticationProvider.java    |  73 +++---
 .../apache/syncope/core/logic/OIDCClientLogic.java |   2 +-
 .../apache/syncope/core/logic/SAML2SPLogic.java    |   6 +-
 .../apache/syncope/core/logic/SCIMDataBinder.java  |   2 +-
 .../normalization/NormalizationInterceptor.java    |   1 +
 .../fit/core/reference/CustomJWTSSOProvider.java   |   2 +-
 .../org/apache/syncope/fit/AbstractITCase.java     |  21 ++
 .../fit/console/SecurityQuestionsITCase.java       |   4 +-
 .../org/apache/syncope/fit/core/AuditITCase.java   |  63 ++---
 .../syncope/fit/core/AuthenticationITCase.java     |  14 +-
 .../apache/syncope/fit/core/DelegationITCase.java  | 271 +++++++++++++++++++++
 .../org/apache/syncope/fit/core/JWTITCase.java     |   5 +-
 .../apache/syncope/fit/core/PullTaskITCase.java    |   8 +-
 .../org/apache/syncope/fit/core/UserITCase.java    |   4 +-
 .../apache/syncope/fit/core/UserIssuesITCase.java  |   4 +-
 .../apache/syncope/fit/core/UserSelfITCase.java    |  10 +-
 .../asciidoc/reference-guide/concepts/roles.adoc   |  20 ++
 .../workingwithapachesyncope/restfulservices.adoc  |  10 +
 155 files changed, 2572 insertions(+), 628 deletions(-)

diff --git a/client/console/src/main/java/org/apache/syncope/client/console/SyncopeConsoleSession.java b/client/console/src/main/java/org/apache/syncope/client/console/SyncopeConsoleSession.java
index 6a57dcc..c759953 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/SyncopeConsoleSession.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/SyncopeConsoleSession.java
@@ -41,7 +41,7 @@ import org.apache.commons.lang3.ArrayUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.commons.lang3.exception.ExceptionUtils;
 import org.apache.commons.lang3.time.FastDateFormat;
-import org.apache.commons.lang3.tuple.Pair;
+import org.apache.commons.lang3.tuple.Triple;
 import org.apache.cxf.jaxrs.client.WebClient;
 import org.apache.syncope.client.console.commons.Constants;
 import org.apache.syncope.client.console.commons.RealmsUtils;
@@ -114,6 +114,10 @@ public class SyncopeConsoleSession extends AuthenticatedWebSession {
 
     protected Map<String, Set<String>> auth;
 
+    protected List<String> delegations;
+
+    protected String delegatedBy;
+
     protected Roles roles;
 
     public static SyncopeConsoleSession get() {
@@ -263,6 +267,8 @@ public class SyncopeConsoleSession extends AuthenticatedWebSession {
     public void cleanup() {
         client = null;
         auth = null;
+        delegations = null;
+        delegatedBy = null;
         selfTO = null;
         services.clear();
     }
@@ -347,10 +353,27 @@ public class SyncopeConsoleSession extends AuthenticatedWebSession {
         return roles;
     }
 
+    public List<String> getDelegations() {
+        return delegations;
+    }
+
+    public String getDelegatedBy() {
+        return delegatedBy;
+    }
+
+    public void setDelegatedBy(final String delegatedBy) {
+        this.delegatedBy = delegatedBy;
+
+        this.client.delegatedBy(delegatedBy);
+
+        refreshAuth(null);
+    }
+
     public void refreshAuth(final String username) {
         try {
-            Pair<Map<String, Set<String>>, UserTO> self = client.self();
+            Triple<Map<String, Set<String>>, List<String>, UserTO> self = client.self();
             auth = self.getLeft();
+            delegations = self.getMiddle();
             selfTO = self.getRight();
             roles = null;
         } catch (ForbiddenException e) {
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/commons/Constants.java b/client/console/src/main/java/org/apache/syncope/client/console/commons/Constants.java
index 69579df..f57ab76 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/commons/Constants.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/commons/Constants.java
@@ -80,7 +80,7 @@ public final class Constants {
     public static final String OUTER = "outer";
 
     public static final String ACTION = "action";
-    
+
     public static final String CONFIRM_DELETE = "confirmDelete";
 
     public static final String BEFORE_LOGOUT_PAGE = "beforeLogoutPage";
@@ -179,6 +179,8 @@ public final class Constants {
 
     public static final String PREF_TYPE_EXTENSIONS_PAGINATOR_ROWS = "typeextensions.paginator.rows";
 
+    public static final String PREF_DELEGATION_PAGINATOR_ROWS = "delegation.paginator.rows";
+
     public static final String PREF_TODO_PAGINATOR_ROWS = "todo.paginator.rows";
 
     public static final String PREF_REPORT_PAGINATOR_ROWS = "report.paginator.rows";
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/notifications/NotificationWizardBuilder.java b/client/console/src/main/java/org/apache/syncope/client/console/notifications/NotificationWizardBuilder.java
index 733aaab..b623346 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/notifications/NotificationWizardBuilder.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/notifications/NotificationWizardBuilder.java
@@ -199,7 +199,7 @@ public class NotificationWizardBuilder extends AjaxWizardBuilder<NotificationWra
             super(id, model);
             setOutputMarkupId(true);
 
-            final AjaxDropDownChoicePanel<String> type =
+            AjaxDropDownChoicePanel<String> type =
                     new AjaxDropDownChoicePanel<>("about", "anyType", new Model<String>() {
 
                         private static final long serialVersionUID = -2350296434572623272L;
@@ -213,13 +213,12 @@ public class NotificationWizardBuilder extends AjaxWizardBuilder<NotificationWra
                         public void setObject(final String object) {
                             model.setObject(Pair.of(object, model.getObject().getRight()));
                         }
-
                     });
             type.setChoices(new AnyTypeRestClient().list());
             type.addRequiredLabel();
             add(type);
 
-            final ListModel<SearchClause> clauseModel = new ListModel<SearchClause>() {
+            ListModel<SearchClause> clauseModel = new ListModel<SearchClause>() {
 
                 private static final long serialVersionUID = 3769540249683319782L;
 
@@ -232,10 +231,9 @@ public class NotificationWizardBuilder extends AjaxWizardBuilder<NotificationWra
                 public void setObject(final List<SearchClause> object) {
                     model.getObject().setValue(object);
                 }
-
             };
 
-            final WebMarkupContainer searchContainer = new WebMarkupContainer("search");
+            WebMarkupContainer searchContainer = new WebMarkupContainer("search");
             add(searchContainer.setOutputMarkupId(true));
 
             searchContainer.add(getClauseBuilder(model.getObject().getLeft(), clauseModel).build("clauses"));
@@ -283,7 +281,7 @@ public class NotificationWizardBuilder extends AjaxWizardBuilder<NotificationWra
         public Abouts(final NotificationWrapper modelObject) {
             setTitleModel(new ResourceModel("about"));
 
-            final WebMarkupContainer aboutContainer = new WebMarkupContainer("about");
+            WebMarkupContainer aboutContainer = new WebMarkupContainer("about");
             aboutContainer.setOutputMarkupId(true);
             add(aboutContainer);
 
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/pages/BasePage.java b/client/console/src/main/java/org/apache/syncope/client/console/pages/BasePage.java
index cd92494..a464a11 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/pages/BasePage.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/pages/BasePage.java
@@ -30,12 +30,13 @@ import org.apache.syncope.client.console.commons.Constants;
 import org.apache.syncope.client.console.commons.HttpResourceStream;
 import org.apache.syncope.client.console.init.ClassPathScanImplementationLookup;
 import org.apache.syncope.client.console.init.ConsoleInitializer;
+import org.apache.syncope.client.console.panels.DelegationSelectionPanel;
 import org.apache.syncope.client.console.panels.NotificationPanel;
 import org.apache.syncope.client.console.rest.ConfRestClient;
 import org.apache.syncope.client.console.rest.ResponseHolder;
 import org.apache.syncope.client.console.topology.Topology;
 import org.apache.syncope.client.console.wicket.markup.head.MetaHeaderItem;
-import org.apache.syncope.client.console.wicket.markup.html.bootstrap.dialog.BaseModal;
+import org.apache.syncope.client.console.wicket.markup.html.form.IndicatingOnConfirmAjaxLink;
 import org.apache.syncope.client.console.widgets.ExtAlertWidget;
 import org.apache.syncope.client.console.widgets.RemediationsWidget;
 import org.apache.syncope.common.lib.info.PlatformInfo;
@@ -53,7 +54,6 @@ import org.apache.wicket.ajax.markup.html.AjaxLink;
 import org.apache.wicket.authroles.authorization.strategies.role.metadata.MetaDataRoleAuthorizationStrategy;
 import org.apache.wicket.behavior.AttributeAppender;
 import org.apache.wicket.behavior.Behavior;
-import org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow;
 import org.apache.wicket.markup.ComponentTag;
 import org.apache.wicket.markup.head.HeaderItem;
 import org.apache.wicket.markup.head.IHeaderResponse;
@@ -65,6 +65,7 @@ import org.apache.wicket.markup.html.link.BookmarkablePageLink;
 import org.apache.wicket.markup.html.link.Link;
 import org.apache.wicket.markup.html.list.ListItem;
 import org.apache.wicket.markup.html.list.ListView;
+import org.apache.wicket.model.ResourceModel;
 import org.apache.wicket.request.handler.resource.ResourceStreamRequestHandler;
 import org.apache.wicket.request.mapper.parameter.PageParameters;
 import org.apache.wicket.request.resource.ContentDisposition;
@@ -104,7 +105,11 @@ public class BasePage extends WebPage implements IAjaxIndicatorAware {
         body.addOrReplace(notificationPanel.setOutputMarkupId(true));
 
         // header, footer
-        body.add(new Label("username", SyncopeConsoleSession.get().getSelfTO().getUsername()));
+        String username = SyncopeConsoleSession.get().getSelfTO().getUsername();
+        if (SyncopeConsoleSession.get().getDelegatedBy() != null) {
+            username += " (" + SyncopeConsoleSession.get().getDelegatedBy() + ")";
+        }
+        body.add(new Label("username", username));
 
         remediationWidget = new RemediationsWidget("remediationWidget", getPageReference());
         body.add(remediationWidget.setRenderBodyOnly(true));
@@ -213,10 +218,6 @@ public class BasePage extends WebPage implements IAjaxIndicatorAware {
         liContainer = new WebMarkupContainer(getLIContainerId("security"));
         confULContainer.add(liContainer);
         link = BookmarkablePageLinkBuilder.build("security", Security.class);
-        MetaDataRoleAuthorizationStrategy.authorize(link, WebPage.RENDER,
-                String.format("%s,%s",
-                        StandardEntitlement.ROLE_LIST,
-                        StandardEntitlement.APPLICATION_LIST));
         liContainer.add(link);
 
         liContainer = new WebMarkupContainer(getLIContainerId("policies"));
@@ -251,8 +252,30 @@ public class BasePage extends WebPage implements IAjaxIndicatorAware {
         });
         body.add(new Label("domain", SyncopeConsoleSession.get().getDomain()));
 
+        WebMarkupContainer delegationsContainer = new WebMarkupContainer("delegationsContainer");
+        body.add(delegationsContainer.setOutputMarkupPlaceholderTag(true).
+                setVisible(!SyncopeConsoleSession.get().getDelegations().isEmpty()));
+        delegationsContainer.add(new Label("delegationsHeader", new ResourceModel("delegations")));
+        delegationsContainer.add(new ListView<String>("delegations", SyncopeConsoleSession.get().getDelegations()) {
+
+            @Override
+            protected void populateItem(final ListItem<String> item) {
+                item.add(new DelegationSelectionPanel("delegation", item.getModelObject()));
+            }
+        });
+
+        body.add(new IndicatingOnConfirmAjaxLink<String>("endDelegation", "confirmDelegation", true) {
+
+            @Override
+            public void onClick(final AjaxRequestTarget target) {
+                SyncopeConsoleSession.get().setDelegatedBy(null);
+                setResponsePage(Dashboard.class);
+            }
+        }.setOutputMarkupId(true).setOutputMarkupPlaceholderTag(true).
+                setVisible(SyncopeConsoleSession.get().getDelegatedBy() != null));
+
         @SuppressWarnings("unchecked")
-        final Class<? extends WebPage> beforeLogout = (Class<? extends WebPage>) SyncopeConsoleSession.get().
+        Class<? extends WebPage> beforeLogout = (Class<? extends WebPage>) SyncopeConsoleSession.get().
                 getAttribute(Constants.BEFORE_LOGOUT_PAGE);
         if (beforeLogout == null) {
             body.add(new BookmarkablePageLink<>("logout", Logout.class));
@@ -444,24 +467,4 @@ public class BasePage extends WebPage implements IAjaxIndicatorAware {
     public RemediationsWidget getRemediationWidget() {
         return remediationWidget;
     }
-
-    /**
-     * Set a WindowClosedCallback for a Modal instance.
-     *
-     * @param modal window
-     * @param container container
-     */
-    public void setWindowClosedCallback(final BaseModal<?> modal, final WebMarkupContainer container) {
-        modal.setWindowClosedCallback(new ModalWindow.WindowClosedCallback() {
-
-            private static final long serialVersionUID = 8804221891699487139L;
-
-            @Override
-            public void onClose(final AjaxRequestTarget target) {
-                if (container != null) {
-                    target.add(container);
-                }
-            }
-        });
-    }
 }
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/pages/Security.java b/client/console/src/main/java/org/apache/syncope/client/console/pages/Security.java
index 56efb31..1a0b7a1 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/pages/Security.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/pages/Security.java
@@ -22,12 +22,17 @@ import de.agilecoders.wicket.core.markup.html.bootstrap.tabs.AjaxBootstrapTabbed
 import java.util.ArrayList;
 import java.util.List;
 import org.apache.syncope.client.console.BookmarkablePageLinkBuilder;
+import org.apache.syncope.client.console.SyncopeConsoleSession;
 import org.apache.syncope.client.console.panels.ApplicationDirectoryPanel;
+import org.apache.syncope.client.console.panels.DelegationDirectoryPanel;
 import org.apache.syncope.client.console.panels.DynRealmDirectoryPanel;
 import org.apache.syncope.client.console.panels.RoleDirectoryPanel;
 import org.apache.syncope.client.console.panels.SecurityQuestionsPanel;
+import org.apache.syncope.client.console.wizards.DelegationWizardBuilder;
 import org.apache.syncope.client.console.wizards.role.RoleWizardBuilder;
+import org.apache.syncope.common.lib.to.DelegationTO;
 import org.apache.syncope.common.lib.to.RoleTO;
+import org.apache.syncope.common.lib.types.StandardEntitlement;
 import org.apache.wicket.extensions.markup.html.tabs.AbstractTab;
 import org.apache.wicket.extensions.markup.html.tabs.ITab;
 import org.apache.wicket.markup.html.WebMarkupContainer;
@@ -51,19 +56,37 @@ public class Security extends BasePage {
     }
 
     private List<ITab> buildTabList() {
-        final List<ITab> tabs = new ArrayList<>();
+        List<ITab> tabs = new ArrayList<>();
 
-        tabs.add(new AbstractTab(new ResourceModel("roles")) {
+        if (SyncopeConsoleSession.get().owns(StandardEntitlement.ROLE_LIST)) {
+            tabs.add(new AbstractTab(new ResourceModel("roles")) {
 
-            private static final long serialVersionUID = -6815067322125799251L;
+                private static final long serialVersionUID = -6815067322125799251L;
+
+                @Override
+                public Panel getPanel(final String panelId) {
+                    return new RoleDirectoryPanel.Builder(getPageReference()) {
+
+                        private static final long serialVersionUID = -5960765294082359003L;
+
+                    }.addNewItemPanelBuilder(new RoleWizardBuilder(new RoleTO(), getPageReference()), true).build(
+                            panelId);
+                }
+            });
+        }
+
+        tabs.add(new AbstractTab(new ResourceModel("delegations")) {
+
+            private static final long serialVersionUID = 29722178554609L;
 
             @Override
             public Panel getPanel(final String panelId) {
-                return new RoleDirectoryPanel.Builder(getPageReference()) {
+                return new DelegationDirectoryPanel.Builder(getPageReference()) {
 
-                    private static final long serialVersionUID = -5960765294082359003L;
+                    private static final long serialVersionUID = 30231721305047L;
 
-                }.addNewItemPanelBuilder(new RoleWizardBuilder(new RoleTO(), getPageReference()), true).build(panelId);
+                }.addNewItemPanelBuilder(
+                        new DelegationWizardBuilder(new DelegationTO(), getPageReference()), true).build(panelId);
             }
         });
 
@@ -81,19 +104,21 @@ public class Security extends BasePage {
             }
         });
 
-        tabs.add(new AbstractTab(new ResourceModel("applications")) {
+        if (SyncopeConsoleSession.get().owns(StandardEntitlement.APPLICATION_LIST)) {
+            tabs.add(new AbstractTab(new ResourceModel("applications")) {
 
-            private static final long serialVersionUID = -6815067322125799251L;
+                private static final long serialVersionUID = -6815067322125799251L;
 
-            @Override
-            public Panel getPanel(final String panelId) {
-                return new ApplicationDirectoryPanel.Builder(getPageReference()) {
+                @Override
+                public Panel getPanel(final String panelId) {
+                    return new ApplicationDirectoryPanel.Builder(getPageReference()) {
 
-                    private static final long serialVersionUID = -5960765294082359003L;
+                        private static final long serialVersionUID = -5960765294082359003L;
 
-                }.build(panelId);
-            }
-        });
+                    }.build(panelId);
+                }
+            });
+        }
 
         tabs.add(new AbstractTab(new ResourceModel("securityQuestions")) {
 
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/ApplicationDirectoryPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/ApplicationDirectoryPanel.java
index 24f246c..3a70ffd 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/ApplicationDirectoryPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/ApplicationDirectoryPanel.java
@@ -72,7 +72,6 @@ public class ApplicationDirectoryPanel extends
             super.onConfigure();
             setFooterVisible(false);
         }
-
     };
 
     protected ApplicationDirectoryPanel(final String id, final Builder builder) {
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/DelegationDirectoryPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/DelegationDirectoryPanel.java
new file mode 100644
index 0000000..96d6b6e
--- /dev/null
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/DelegationDirectoryPanel.java
@@ -0,0 +1,224 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.syncope.client.console.panels;
+
+import de.agilecoders.wicket.core.markup.html.bootstrap.dialog.Modal;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.syncope.client.console.SyncopeConsoleSession;
+import org.apache.syncope.client.console.commons.Constants;
+import org.apache.syncope.client.console.commons.DirectoryDataProvider;
+import org.apache.syncope.client.console.commons.SortableDataProviderComparator;
+import org.apache.syncope.client.console.pages.BasePage;
+import org.apache.syncope.client.console.panels.DelegationDirectoryPanel.DelegationDataProvider;
+import org.apache.syncope.client.console.rest.DelegationRestClient;
+import org.apache.syncope.client.console.rest.UserRestClient;
+import org.apache.syncope.client.console.wicket.extensions.markup.html.repeater.data.table.DatePropertyColumn;
+import org.apache.syncope.client.console.wicket.extensions.markup.html.repeater.data.table.KeyPropertyColumn;
+import org.apache.syncope.client.console.wicket.markup.html.form.ActionLink;
+import org.apache.syncope.client.console.wicket.markup.html.form.ActionsPanel;
+import org.apache.syncope.client.console.wizards.AjaxWizard;
+import org.apache.syncope.client.console.wizards.WizardMgtPanel;
+import org.apache.syncope.common.lib.to.DelegationTO;
+import org.apache.syncope.common.lib.types.StandardEntitlement;
+import org.apache.wicket.PageReference;
+import org.apache.wicket.ajax.AjaxRequestTarget;
+import org.apache.wicket.event.Broadcast;
+import org.apache.wicket.extensions.markup.html.repeater.data.grid.ICellPopulator;
+import org.apache.wicket.extensions.markup.html.repeater.data.table.AbstractColumn;
+import org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn;
+import org.apache.wicket.extensions.markup.html.repeater.data.table.PropertyColumn;
+import org.apache.wicket.markup.html.basic.Label;
+import org.apache.wicket.markup.repeater.Item;
+import org.apache.wicket.model.CompoundPropertyModel;
+import org.apache.wicket.model.IModel;
+import org.apache.wicket.model.ResourceModel;
+import org.apache.wicket.model.StringResourceModel;
+
+public class DelegationDirectoryPanel extends
+        DirectoryPanel<DelegationTO, DelegationTO, DelegationDataProvider, DelegationRestClient> {
+
+    private static final long serialVersionUID = 28300423726398L;
+
+    private final UserRestClient userRestClient = new UserRestClient();
+
+    protected DelegationDirectoryPanel(final String id, final Builder builder) {
+        super(id, builder);
+
+        disableCheckBoxes();
+        setShowResultPage(true);
+
+        modal.size(Modal.Size.Large);
+        initResultTable();
+    }
+
+    @Override
+    protected DelegationDataProvider dataProvider() {
+        return new DelegationDataProvider(rows);
+    }
+
+    @Override
+    protected String paginatorRowsKey() {
+        return Constants.PREF_DELEGATION_PAGINATOR_ROWS;
+    }
+
+    @Override
+    protected Collection<ActionLink.ActionType> getBatches() {
+        return Collections.emptyList();
+    }
+
+    @Override
+    protected List<IColumn<DelegationTO, String>> getColumns() {
+        List<IColumn<DelegationTO, String>> columns = new ArrayList<>();
+
+        columns.add(new KeyPropertyColumn<>(
+                new ResourceModel(Constants.KEY_FIELD_NAME), Constants.KEY_FIELD_NAME, Constants.KEY_FIELD_NAME));
+
+        columns.add(new AbstractColumn<DelegationTO, String>(new ResourceModel("delegating"), "delegating") {
+
+            @Override
+            public void populateItem(
+                    final Item<ICellPopulator<DelegationTO>> cellItem,
+                    final String componentId,
+                    final IModel<DelegationTO> rowModel) {
+
+                String delegating = rowModel.getObject().getDelegating();
+                if (SyncopeConsoleSession.get().owns(StandardEntitlement.USER_READ)) {
+                    delegating = userRestClient.read(delegating).getUsername();
+                } else if (SyncopeConsoleSession.get().getSelfTO().getKey().equals(delegating)) {
+                    delegating = SyncopeConsoleSession.get().getSelfTO().getUsername();
+                }
+
+                cellItem.add(new Label(componentId, delegating));
+            }
+        });
+
+        columns.add(new AbstractColumn<DelegationTO, String>(new ResourceModel("delegated"), "delegated") {
+
+            @Override
+            public void populateItem(
+                    final Item<ICellPopulator<DelegationTO>> cellItem,
+                    final String componentId,
+                    final IModel<DelegationTO> rowModel) {
+
+                String delegated = rowModel.getObject().getDelegated();
+                if (SyncopeConsoleSession.get().owns(StandardEntitlement.USER_READ)) {
+                    delegated = userRestClient.read(delegated).getUsername();
+                } else if (SyncopeConsoleSession.get().getSelfTO().getKey().equals(delegated)) {
+                    delegated = SyncopeConsoleSession.get().getSelfTO().getUsername();
+                }
+
+                cellItem.add(new Label(componentId, delegated));
+            }
+        });
+
+        columns.add(new DatePropertyColumn<>(new StringResourceModel("start", this), "start", "start"));
+
+        columns.add(new DatePropertyColumn<>(new StringResourceModel("end", this), "end", "end"));
+
+        columns.add(new PropertyColumn<>(new ResourceModel("roles"), null, "roles"));
+
+        return columns;
+    }
+
+    @Override
+    public ActionsPanel<DelegationTO> getActions(final IModel<DelegationTO> model) {
+        ActionsPanel<DelegationTO> panel = super.getActions(model);
+
+        panel.add(new ActionLink<DelegationTO>() {
+
+            private static final long serialVersionUID = -3722207913631435501L;
+
+            @Override
+            public void onClick(final AjaxRequestTarget target, final DelegationTO ignore) {
+                send(DelegationDirectoryPanel.this, Broadcast.EXACT,
+                        new AjaxWizard.EditItemActionEvent<>(model.getObject(), target));
+            }
+        }, ActionLink.ActionType.EDIT, StringUtils.EMPTY);
+        panel.add(new ActionLink<DelegationTO>() {
+
+            private static final long serialVersionUID = -3722207913631435501L;
+
+            @Override
+            public void onClick(final AjaxRequestTarget target, final DelegationTO ignore) {
+                try {
+                    restClient.delete(model.getObject().getKey());
+                    SyncopeConsoleSession.get().success(getString(Constants.OPERATION_SUCCEEDED));
+                    target.add(container);
+                } catch (Exception e) {
+                    LOG.error("While deleting {}", model.getObject(), e);
+                    SyncopeConsoleSession.get().onException(e);
+                }
+                ((BasePage) pageRef.getPage()).getNotificationPanel().refresh(target);
+            }
+        }, ActionLink.ActionType.DELETE, StringUtils.EMPTY, true);
+
+        return panel;
+    }
+
+    public abstract static class Builder
+            extends DirectoryPanel.Builder<DelegationTO, DelegationTO, DelegationRestClient> {
+
+        private static final long serialVersionUID = 5530948153889495221L;
+
+        public Builder(final PageReference pageRef) {
+            super(new DelegationRestClient(), pageRef);
+        }
+
+        @Override
+        protected WizardMgtPanel<DelegationTO> newInstance(final String id, final boolean wizardInModal) {
+            return new DelegationDirectoryPanel(id, this);
+        }
+    }
+
+    protected class DelegationDataProvider extends DirectoryDataProvider<DelegationTO> {
+
+        private static final long serialVersionUID = 28297380054779L;
+
+        private final SortableDataProviderComparator<DelegationTO> comparator;
+
+        private final DelegationRestClient restClient = new DelegationRestClient();
+
+        public DelegationDataProvider(final int paginatorRows) {
+            super(paginatorRows);
+            this.comparator = new SortableDataProviderComparator<>(this);
+        }
+
+        @Override
+        public Iterator<DelegationTO> iterator(final long first, final long count) {
+            List<DelegationTO> result = restClient.list();
+            Collections.sort(result, comparator);
+            return result.subList((int) first, (int) first + (int) count).iterator();
+        }
+
+        @Override
+        public long size() {
+            return restClient.list().size();
+        }
+
+        @Override
+        public IModel<DelegationTO> model(final DelegationTO object) {
+            return new CompoundPropertyModel<>(object);
+        }
+    }
+}
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/DelegationSelectionPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/DelegationSelectionPanel.java
new file mode 100644
index 0000000..680d8fe
--- /dev/null
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/DelegationSelectionPanel.java
@@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.syncope.client.console.panels;
+
+import org.apache.syncope.client.console.SyncopeConsoleSession;
+import org.apache.syncope.client.console.pages.Dashboard;
+import org.apache.syncope.client.console.wicket.markup.html.form.IndicatingOnConfirmAjaxLink;
+import org.apache.wicket.ajax.AjaxRequestTarget;
+import org.apache.wicket.markup.ComponentTag;
+import org.apache.wicket.markup.html.basic.Label;
+import org.apache.wicket.markup.html.panel.Panel;
+
+public class DelegationSelectionPanel extends Panel {
+
+    private static final long serialVersionUID = 5820439948762L;
+
+    public DelegationSelectionPanel(final String id, final String delegating) {
+        super(id);
+
+        IndicatingOnConfirmAjaxLink<String> link =
+                new IndicatingOnConfirmAjaxLink<String>("link", "confirmDelegation", true) {
+
+            @Override
+            public void onClick(final AjaxRequestTarget target) {
+                SyncopeConsoleSession.get().setDelegatedBy(delegating);
+                setResponsePage(Dashboard.class);
+            }
+
+            @Override
+            protected void onComponentTag(final ComponentTag tag) {
+                super.onComponentTag(tag);
+                if (delegating.equals(SyncopeConsoleSession.get().getDelegatedBy())) {
+                    tag.append("class", "disabled", " ");
+                }
+            }
+        };
+        add(link);
+        link.setOutputMarkupId(true);
+        link.add(new Label("label", delegating));
+    }
+}
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/SecurityQuestionsPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/SecurityQuestionsPanel.java
index ad94d82..a84bf25 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/SecurityQuestionsPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/SecurityQuestionsPanel.java
@@ -104,7 +104,7 @@ public class SecurityQuestionsPanel extends DirectoryPanel<
 
     @Override
     protected Collection<ActionLink.ActionType> getBatches() {
-        return Collections.<ActionLink.ActionType>emptyList();
+        return Collections.emptyList();
     }
 
     @Override
@@ -121,7 +121,7 @@ public class SecurityQuestionsPanel extends DirectoryPanel<
 
     @Override
     public ActionsPanel<SecurityQuestionTO> getActions(final IModel<SecurityQuestionTO> model) {
-        final ActionsPanel<SecurityQuestionTO> panel = super.getActions(model);
+        ActionsPanel<SecurityQuestionTO> panel = super.getActions(model);
 
         panel.add(new ActionLink<SecurityQuestionTO>() {
 
@@ -149,7 +149,7 @@ public class SecurityQuestionsPanel extends DirectoryPanel<
                 }
                 ((BasePage) pageRef.getPage()).getNotificationPanel().refresh(target);
             }
-        }, ActionLink.ActionType.DELETE, StandardEntitlement.TASK_DELETE, true);
+        }, ActionLink.ActionType.DELETE, StandardEntitlement.SECURITY_QUESTION_DELETE, true);
 
         return panel;
     }
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/search/SearchClausePanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/search/SearchClausePanel.java
index 8bb6722..c79169b 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/search/SearchClausePanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/search/SearchClausePanel.java
@@ -413,7 +413,7 @@ public class SearchClausePanel extends FieldPanel<SearchClause> {
                 CheckBox checkBox = super.newCheckBox(id, model);
                 checkBox.add(new IndicatorAjaxFormComponentUpdatingBehavior(Constants.ON_CHANGE) {
 
-                    private static final long serialVersionUID = 1L;
+                    private static final long serialVersionUID = 18266219802290L;
 
                     @Override
                     protected void onUpdate(final AjaxRequestTarget target) {
@@ -456,7 +456,7 @@ public class SearchClausePanel extends FieldPanel<SearchClause> {
                             inputValue = "*" + inputValue;
                         }
                         if (!inputValue.endsWith("*")) {
-                            inputValue = inputValue + "*";
+                            inputValue += "*";
                         }
                         property.setChoices(groupRestClient.search(
                                 SyncopeConstants.ROOT_REALM,
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/rest/ApplicationRestClient.java b/client/console/src/main/java/org/apache/syncope/client/console/rest/ApplicationRestClient.java
index 0c765f8..e70b90d 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/rest/ApplicationRestClient.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/rest/ApplicationRestClient.java
@@ -45,5 +45,4 @@ public class ApplicationRestClient extends BaseRestClient {
     public List<ApplicationTO> list() {
         return getService(ApplicationService.class).list();
     }
-
 }
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/rest/ApplicationRestClient.java b/client/console/src/main/java/org/apache/syncope/client/console/rest/DelegationRestClient.java
similarity index 59%
copy from client/console/src/main/java/org/apache/syncope/client/console/rest/ApplicationRestClient.java
copy to client/console/src/main/java/org/apache/syncope/client/console/rest/DelegationRestClient.java
index 0c765f8..3928a24 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/rest/ApplicationRestClient.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/rest/DelegationRestClient.java
@@ -19,31 +19,30 @@
 package org.apache.syncope.client.console.rest;
 
 import java.util.List;
-import org.apache.syncope.common.lib.to.ApplicationTO;
-import org.apache.syncope.common.rest.api.service.ApplicationService;
+import org.apache.syncope.common.lib.to.DelegationTO;
+import org.apache.syncope.common.rest.api.service.DelegationService;
 
-public class ApplicationRestClient extends BaseRestClient {
+public class DelegationRestClient extends BaseRestClient {
 
     private static final long serialVersionUID = -381814125643246243L;
 
     public void delete(final String key) {
-        getService(ApplicationService.class).delete(key);
+        getService(DelegationService.class).delete(key);
     }
 
-    public ApplicationTO read(final String key) {
-        return getService(ApplicationService.class).read(key);
+    public DelegationTO read(final String key) {
+        return getService(DelegationService.class).read(key);
     }
 
-    public void update(final ApplicationTO applicationTO) {
-        getService(ApplicationService.class).update(applicationTO);
+    public void update(final DelegationTO applicationTO) {
+        getService(DelegationService.class).update(applicationTO);
     }
 
-    public void create(final ApplicationTO applicationTO) {
-        getService(ApplicationService.class).create(applicationTO);
+    public void create(final DelegationTO applicationTO) {
+        getService(DelegationService.class).create(applicationTO);
     }
 
-    public List<ApplicationTO> list() {
-        return getService(ApplicationService.class).list();
+    public List<DelegationTO> list() {
+        return getService(DelegationService.class).list();
     }
-
 }
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/rest/LoggerRestClient.java b/client/console/src/main/java/org/apache/syncope/client/console/rest/LoggerRestClient.java
index 51ecb7a..e070d52 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/rest/LoggerRestClient.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/rest/LoggerRestClient.java
@@ -122,7 +122,8 @@ public class LoggerRestClient extends BaseRestClient {
             final AuditElements.Result result,
             final SortParam<String> sort) {
 
-        AuditQuery query = new AuditQuery.Builder(key).
+        AuditQuery query = new AuditQuery.Builder().
+                entityKey(key).
                 size(size).
                 page(page).
                 type(type).
@@ -142,7 +143,8 @@ public class LoggerRestClient extends BaseRestClient {
             final List<String> events,
             final AuditElements.Result result) {
 
-        AuditQuery query = new AuditQuery.Builder(key).
+        AuditQuery query = new AuditQuery.Builder().
+                entityKey(key).
                 page(1).
                 size(0).
                 type(type).
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/wicket/extensions/markup/html/repeater/data/table/AjaxFallbackDataTable.java b/client/console/src/main/java/org/apache/syncope/client/console/wicket/extensions/markup/html/repeater/data/table/AjaxFallbackDataTable.java
index a85941d..7482998 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/wicket/extensions/markup/html/repeater/data/table/AjaxFallbackDataTable.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/wicket/extensions/markup/html/repeater/data/table/AjaxFallbackDataTable.java
@@ -46,7 +46,7 @@ import org.apache.wicket.model.Model;
 
 public class AjaxFallbackDataTable<T extends Serializable, S> extends DataTable<T, S> {
 
-    private static final long serialVersionUID = 6861105496141602937L;
+    private static final long serialVersionUID = 18103848201505L;
 
     private ActionLinksTogglePanel<T> togglePanel;
 
@@ -95,7 +95,7 @@ public class AjaxFallbackDataTable<T extends Serializable, S> extends DataTable<
                     final String borderId, final S property, final ISortStateLocator<S> locator) {
                 return new AjaxFallbackOrderByBorder<S>(borderId, property, locator) {
 
-                    private static final long serialVersionUID = 1L;
+                    private static final long serialVersionUID = 18100257555728L;
 
                     @Override
                     protected void onAjaxClick(final AjaxRequestTarget target) {
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/bootstrap/dialog/BaseModal.java b/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/bootstrap/dialog/BaseModal.java
index d8be8d1..76cc962 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/bootstrap/dialog/BaseModal.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/bootstrap/dialog/BaseModal.java
@@ -52,7 +52,7 @@ import org.apache.wicket.markup.head.OnDomReadyHeaderItem;
 
 public class BaseModal<T extends Serializable> extends Modal<T> {
 
-    private static final long serialVersionUID = -6142277554912316095L;
+    private static final long serialVersionUID = 18135548644909L;
 
     protected static final Logger LOG = LoggerFactory.getLogger(BaseModal.class);
 
@@ -90,7 +90,7 @@ public class BaseModal<T extends Serializable> extends Modal<T> {
 
         content = new AbstractModalPanel<T>(this, null) {
 
-            private static final long serialVersionUID = 1L;
+            private static final long serialVersionUID = -6142277554912316095L;
 
         };
 
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/wizards/AjaxWizardMgtButtonBar.java b/client/console/src/main/java/org/apache/syncope/client/console/wizards/AjaxWizardMgtButtonBar.java
index cbedd48..a041000 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/wizards/AjaxWizardMgtButtonBar.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/wizards/AjaxWizardMgtButtonBar.java
@@ -60,7 +60,7 @@ public class AjaxWizardMgtButtonBar<T extends Serializable> extends WizardButton
     private void ajaxify(final WizardButton button) {
         button.add(new AjaxFormSubmitBehavior("click") {
 
-            private static final long serialVersionUID = 1L;
+            private static final long serialVersionUID = 18163421824742L;
 
             @Override
             protected void updateAjaxAttributes(final AjaxRequestAttributes attributes) {
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/wizards/DelegationWizardBuilder.java b/client/console/src/main/java/org/apache/syncope/client/console/wizards/DelegationWizardBuilder.java
new file mode 100644
index 0000000..d18eb6a
--- /dev/null
+++ b/client/console/src/main/java/org/apache/syncope/client/console/wizards/DelegationWizardBuilder.java
@@ -0,0 +1,211 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.syncope.client.console.wizards;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.stream.Collectors;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.syncope.client.console.SyncopeConsoleSession;
+import org.apache.syncope.client.console.commons.Constants;
+import org.apache.syncope.client.console.rest.DelegationRestClient;
+import org.apache.syncope.client.console.rest.UserRestClient;
+import org.apache.syncope.client.console.wicket.markup.html.form.AjaxDateTimeFieldPanel;
+import org.apache.syncope.client.console.wicket.markup.html.form.AjaxPalettePanel;
+import org.apache.syncope.client.console.wicket.markup.html.form.AjaxTextFieldPanel;
+import org.apache.syncope.common.lib.SyncopeConstants;
+import org.apache.syncope.common.lib.to.DelegationTO;
+import org.apache.syncope.common.lib.types.StandardEntitlement;
+import org.apache.wicket.PageReference;
+import org.apache.wicket.extensions.wizard.WizardModel;
+import org.apache.wicket.extensions.wizard.WizardStep;
+import org.apache.wicket.model.IModel;
+import org.apache.wicket.model.Model;
+import org.apache.wicket.model.PropertyModel;
+import org.apache.wicket.model.ResourceModel;
+
+public class DelegationWizardBuilder extends AjaxWizardBuilder<DelegationTO> {
+
+    private static final long serialVersionUID = 16656970898539L;
+
+    private final DelegationRestClient restClient = new DelegationRestClient();
+
+    private final UserRestClient userRestClient = new UserRestClient();
+
+    public DelegationWizardBuilder(final DelegationTO defaultItem, final PageReference pageRef) {
+        super(defaultItem, pageRef);
+    }
+
+    @Override
+    protected Serializable onApplyInternal(final DelegationTO modelObject) {
+        if (getOriginalItem() == null || StringUtils.isBlank(getOriginalItem().getKey())) {
+            restClient.create(modelObject);
+        } else {
+            restClient.update(modelObject);
+        }
+        return null;
+    }
+
+    @Override
+    protected WizardModel buildModelSteps(final DelegationTO modelObject, final WizardModel wizardModel) {
+        if (getOriginalItem() == null || StringUtils.isBlank(getOriginalItem().getKey())
+                && SyncopeConsoleSession.get().owns(StandardEntitlement.USER_SEARCH)
+                && SyncopeConsoleSession.get().owns(StandardEntitlement.DELEGATION_CREATE)) {
+
+            wizardModel.add(new UserSelectionWizardStep(
+                    new ResourceModel("delegating"), new PropertyModel<>(modelObject, "delegating"), pageRef));
+            wizardModel.add(new UserSelectionWizardStep(
+                    new ResourceModel("delegated"), new PropertyModel<>(modelObject, "delegated"), pageRef));
+        } else {
+            wizardModel.add(new Users(modelObject));
+        }
+
+        wizardModel.add(new StartEnd(modelObject));
+        wizardModel.add(new Roles(modelObject));
+
+        return wizardModel;
+    }
+
+    private class Users extends WizardStep {
+
+        private static final long serialVersionUID = 33859341441696L;
+
+        Users(final DelegationTO modelObject) {
+            super();
+
+            setTitleModel(new ResourceModel("users"));
+
+            IModel<String> delegating = new PropertyModel<>(modelObject, "delegating");
+            IModel<String> delegated = new PropertyModel<>(modelObject, "delegated");
+
+            boolean isNew = getOriginalItem() == null || StringUtils.isBlank(getOriginalItem().getKey());
+            if (!isNew) {
+                if (SyncopeConsoleSession.get().owns(StandardEntitlement.USER_READ)) {
+                    delegating = Model.of(userRestClient.read(delegating.getObject()).getUsername());
+                    delegated = Model.of(userRestClient.read(delegated.getObject()).getUsername());
+                } else {
+                    if (SyncopeConsoleSession.get().getSelfTO().getKey().equals(delegating)) {
+                        delegating = Model.of(SyncopeConsoleSession.get().getSelfTO().getUsername());
+                    }
+                    if (SyncopeConsoleSession.get().getSelfTO().getKey().equals(delegated)) {
+                        delegated = Model.of(SyncopeConsoleSession.get().getSelfTO().getUsername());
+                    }
+                }
+            }
+
+            boolean isSelfOnly = !SyncopeConsoleSession.get().owns(StandardEntitlement.DELEGATION_CREATE);
+            if (isSelfOnly) {
+                modelObject.setDelegating(SyncopeConsoleSession.get().getSelfTO().getUsername());
+            }
+
+            add(new AjaxTextFieldPanel(
+                    "delegating",
+                    "delegating",
+                    delegating,
+                    false).addRequiredLabel().
+                    setEnabled(isNew && !isSelfOnly));
+            add(new AjaxTextFieldPanel(
+                    "delegated",
+                    "delegated",
+                    delegated,
+                    false).addRequiredLabel().
+                    setEnabled(isNew));
+        }
+    }
+
+    private class StartEnd extends WizardStep {
+
+        private static final long serialVersionUID = 16957451737824L;
+
+        StartEnd(final DelegationTO modelObject) {
+            super();
+
+            setTitleModel(new ResourceModel("validity"));
+
+            add(new AjaxDateTimeFieldPanel(
+                    "start",
+                    "start",
+                    new PropertyModel<>(modelObject, "start"),
+                    SyncopeConstants.DEFAULT_DATE_PATTERN).
+                    addRequiredLabel());
+
+            add(new AjaxDateTimeFieldPanel(
+                    "end",
+                    "end",
+                    new PropertyModel<>(modelObject, "end"),
+                    SyncopeConstants.DEFAULT_DATE_PATTERN));
+        }
+    }
+
+    private class Roles extends WizardStep implements WizardModel.ICondition {
+
+        private static final long serialVersionUID = 16957451737824L;
+
+        private final List<String> allRoles = new ArrayList<>();
+
+        private final DelegationTO modelObject;
+
+        Roles(final DelegationTO modelObject) {
+            super();
+            this.modelObject = modelObject;
+
+            setTitleModel(new ResourceModel("roles"));
+
+            add(new AjaxPalettePanel.Builder<String>().
+                    withFilter().
+                    setAllowOrder(true).
+                    build("roles",
+                            new PropertyModel<>(modelObject, "roles"),
+                            new AjaxPalettePanel.Builder.Query<String>() {
+
+                        private static final long serialVersionUID = 3900199363626636719L;
+
+                        @Override
+                        public List<String> execute(final String filter) {
+                            if (StringUtils.isEmpty(filter) || "*".equals(filter)) {
+                                return allRoles.size() > Constants.MAX_ROLE_LIST_SIZE
+                                        ? allRoles.subList(0, Constants.MAX_ROLE_LIST_SIZE)
+                                        : allRoles;
+
+                            }
+                            return allRoles.stream().
+                                    filter(role -> StringUtils.containsIgnoreCase(role, filter)).
+                                    collect(Collectors.toList());
+                        }
+                    }).
+                    hideLabel().
+                    setOutputMarkupId(true));
+        }
+
+        @Override
+        public boolean evaluate() {
+            if (modelObject.getDelegating() != null) {
+                allRoles.clear();
+
+                if (SyncopeConsoleSession.get().owns(StandardEntitlement.USER_READ)) {
+                    allRoles.addAll(userRestClient.read(modelObject.getDelegating()).getRoles());
+                } else if (SyncopeConsoleSession.get().getSelfTO().getKey().equals(modelObject.getDelegating())) {
+                    allRoles.addAll(SyncopeConsoleSession.get().getSelfTO().getRoles());
+                }
+            }
+            return true;
+        }
+    }
+}
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/MergeLinkedAccountsSearchPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/wizards/UserSelectionWizardStep.java
similarity index 53%
copy from client/console/src/main/java/org/apache/syncope/client/console/panels/MergeLinkedAccountsSearchPanel.java
copy to client/console/src/main/java/org/apache/syncope/client/console/wizards/UserSelectionWizardStep.java
index 5e8d55a..1cfb036 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/MergeLinkedAccountsSearchPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/wizards/UserSelectionWizardStep.java
@@ -16,8 +16,9 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.syncope.client.console.panels;
+package org.apache.syncope.client.console.wizards;
 
+import java.util.ArrayList;
 import org.apache.syncope.client.console.panels.search.AnySelectionDirectoryPanel;
 import org.apache.syncope.client.console.panels.search.SearchClausePanel;
 import org.apache.syncope.client.console.panels.search.SearchUtils;
@@ -25,87 +26,73 @@ import org.apache.syncope.client.console.panels.search.UserSearchPanel;
 import org.apache.syncope.client.console.panels.search.UserSelectionDirectoryPanel;
 import org.apache.syncope.client.console.rest.AnyTypeClassRestClient;
 import org.apache.syncope.client.console.rest.AnyTypeRestClient;
-import org.apache.syncope.client.console.rest.UserRestClient;
-import org.apache.syncope.client.console.wizards.any.MergeLinkedAccountsWizardModel;
 import org.apache.syncope.client.lib.SyncopeClient;
-import org.apache.syncope.common.lib.to.AnyTO;
 import org.apache.syncope.common.lib.to.AnyTypeTO;
+import org.apache.syncope.common.lib.to.UserTO;
 import org.apache.syncope.common.lib.types.AnyTypeKind;
 import org.apache.wicket.Component;
 import org.apache.wicket.PageReference;
 import org.apache.wicket.ajax.AjaxRequestTarget;
 import org.apache.wicket.event.IEvent;
 import org.apache.wicket.extensions.wizard.WizardStep;
-import org.apache.wicket.markup.html.WebMarkupContainer;
-import org.apache.wicket.markup.html.panel.Fragment;
-import org.apache.wicket.model.Model;
-import org.apache.wicket.model.StringResourceModel;
+import org.apache.wicket.model.IModel;
 import org.apache.wicket.model.util.ListModel;
 
-import java.util.ArrayList;
-
-public class MergeLinkedAccountsSearchPanel extends WizardStep {
-    private static final long serialVersionUID = 1221037007528732347L;
+public class UserSelectionWizardStep extends WizardStep {
 
-    private final WebMarkupContainer ownerContainer;
-
-    private final UserSearchPanel userSearchPanel;
+    private static final long serialVersionUID = 36221031226727L;
 
     private final AnyTypeClassRestClient anyTypeClassRestClient = new AnyTypeClassRestClient();
 
     private final AnyTypeRestClient anyTypeRestClient = new AnyTypeRestClient();
 
-    private final UserSelectionDirectoryPanel userDirectoryPanel;
+    private final IModel<String> model;
 
-    private final Fragment userSearchFragment;
+    private final UserSearchPanel userSearchPanel;
 
-    private final MergeLinkedAccountsWizardModel wizardModel;
+    private final UserSelectionDirectoryPanel userDirectoryPanel;
+
+    public UserSelectionWizardStep(
+            final IModel<String> title, final IModel<String> model, final PageReference pageRef) {
 
-    public MergeLinkedAccountsSearchPanel(final MergeLinkedAccountsWizardModel model, final PageReference pageRef) {
         super();
         setOutputMarkupId(true);
 
-        this.wizardModel = model;
-        setTitleModel(new StringResourceModel("mergeLinkedAccounts.searchUser", Model.of(model.getBaseUser())));
-        ownerContainer = new WebMarkupContainer("ownerContainer");
-        ownerContainer.setOutputMarkupId(true);
-        add(ownerContainer);
+        this.model = model;
+        setTitleModel(title);
 
-        userSearchFragment = new Fragment("search", "userSearchFragment", this);
         userSearchPanel = UserSearchPanel.class.cast(new UserSearchPanel.Builder(
-            new ListModel<>(new ArrayList<>())).required(false).enableSearch(MergeLinkedAccountsSearchPanel.this).
-            build("usersearch"));
-        userSearchFragment.add(userSearchPanel);
+                new ListModel<>(new ArrayList<>())).required(false).enableSearch(UserSelectionWizardStep.this).
+                build("usersearch"));
+        add(userSearchPanel);
 
         AnyTypeTO anyTypeTO = anyTypeRestClient.read(AnyTypeKind.USER.name());
         userDirectoryPanel = UserSelectionDirectoryPanel.class.cast(new UserSelectionDirectoryPanel.Builder(
-            anyTypeClassRestClient.list(anyTypeTO.getClasses()), anyTypeTO.getKey(), pageRef).
-            build("searchResult"));
-
-        userSearchFragment.add(userDirectoryPanel);
-        ownerContainer.add(userSearchFragment);
+                anyTypeClassRestClient.list(anyTypeTO.getClasses()), anyTypeTO.getKey(), pageRef).
+                build("searchResult"));
+        add(userDirectoryPanel);
     }
 
     @Override
     public void onEvent(final IEvent<?> event) {
         if (event.getPayload() instanceof SearchClausePanel.SearchEvent) {
-            final AjaxRequestTarget target = SearchClausePanel.SearchEvent.class.cast(event.getPayload()).getTarget();
-            final String fiql = "username!~" + this.wizardModel.getBaseUser().getUsername() + ';'
-                + SearchUtils.buildFIQL(userSearchPanel.getModel().getObject(),
-                SyncopeClient.getUserSearchConditionBuilder());
+            AjaxRequestTarget target = SearchClausePanel.SearchEvent.class.cast(event.getPayload()).getTarget();
+            String fiql = SearchUtils.buildFIQL(
+                    userSearchPanel.getModel().getObject(), SyncopeClient.getUserSearchConditionBuilder());
             userDirectoryPanel.search(fiql, target);
         } else if (event.getPayload() instanceof AnySelectionDirectoryPanel.ItemSelection) {
-            AnySelectionDirectoryPanel.ItemSelection payload =
-                (AnySelectionDirectoryPanel.ItemSelection) event.getPayload();
+            @SuppressWarnings("unchecked")
+            AnySelectionDirectoryPanel.ItemSelection<UserTO> payload =
+                    (AnySelectionDirectoryPanel.ItemSelection<UserTO>) event.getPayload();
 
-            final AnyTO sel = payload.getSelection();
-            this.wizardModel.setMergingUser(new UserRestClient().read(sel.getKey()));
+            UserTO selected = payload.getSelection();
+            this.model.setObject(selected.getKey());
 
             String tableId = ((Component) event.getSource()).
-                get("container:content:searchContainer:resultTable:tablePanel:groupForm:checkgroup:dataTable").
-                getMarkupId();
+                    get("container:content:searchContainer:resultTable:tablePanel:groupForm:checkgroup:dataTable").
+                    getMarkupId();
             String js = "$('#" + tableId + " tr').removeClass('active');";
-            js += "$('#" + tableId + " td[title=" + sel.getKey() + "]').parent().addClass('active');";
+            js += "$('#" + tableId + " td[title=" + selected.getKey() + "]').parent().addClass('active');";
             payload.getTarget().prependJavaScript(js);
         }
     }
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/MergeLinkedAccountsResourcesPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/MergeLinkedAccountsResourcesPanel.java
similarity index 88%
rename from client/console/src/main/java/org/apache/syncope/client/console/panels/MergeLinkedAccountsResourcesPanel.java
rename to client/console/src/main/java/org/apache/syncope/client/console/wizards/any/MergeLinkedAccountsResourcesPanel.java
index 628b1a6..d4e6e15 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/MergeLinkedAccountsResourcesPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/MergeLinkedAccountsResourcesPanel.java
@@ -16,18 +16,23 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.syncope.client.console.panels;
+package org.apache.syncope.client.console.wizards.any;
 
 import de.agilecoders.wicket.core.markup.html.bootstrap.dialog.Modal;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
 import org.apache.syncope.client.console.SyncopeConsoleApplication;
 import org.apache.syncope.client.console.commons.Constants;
 import org.apache.syncope.client.console.commons.DirectoryDataProvider;
 import org.apache.syncope.client.console.commons.SortableDataProviderComparator;
 import org.apache.syncope.client.console.pages.BasePage;
+import org.apache.syncope.client.console.panels.DirectoryPanel;
 import org.apache.syncope.client.console.rest.ResourceRestClient;
 import org.apache.syncope.client.console.wicket.markup.html.form.ActionLink;
 import org.apache.syncope.client.console.wicket.markup.html.form.ActionsPanel;
-import org.apache.syncope.client.console.wizards.any.MergeLinkedAccountsWizardModel;
 import org.apache.syncope.common.lib.to.ResourceTO;
 import org.apache.syncope.common.lib.types.StandardEntitlement;
 import org.apache.wicket.PageReference;
@@ -43,19 +48,14 @@ import org.apache.wicket.model.Model;
 import org.apache.wicket.model.ResourceModel;
 import org.apache.wicket.model.StringResourceModel;
 
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-
 public class MergeLinkedAccountsResourcesPanel extends WizardStep implements ICondition {
+
     private static final long serialVersionUID = 1221037007528732347L;
 
     private final MergeLinkedAccountsWizardModel wizardModel;
 
     public MergeLinkedAccountsResourcesPanel(final MergeLinkedAccountsWizardModel wizardModel,
-                                             final PageReference pageReference) {
+            final PageReference pageReference) {
         super();
         setOutputMarkupId(true);
         this.wizardModel = wizardModel;
@@ -65,20 +65,20 @@ public class MergeLinkedAccountsResourcesPanel extends WizardStep implements ICo
     @Override
     public boolean evaluate() {
         return SyncopeConsoleApplication.get().getSecuritySettings().getAuthorizationStrategy().
-            isActionAuthorized(this, RENDER);
+                isActionAuthorized(this, RENDER);
     }
 
     @Override
     public String getTitle() {
         setSummaryModel(new StringResourceModel("mergeLinkedAccounts.searchResource.summary",
-            Model.of(wizardModel.getMergingUser())));
+                Model.of(wizardModel.getMergingUser())));
         setTitleModel(new StringResourceModel("mergeLinkedAccounts.searchResource.title",
-            Model.of(wizardModel.getMergingUser())));
+                Model.of(wizardModel.getMergingUser())));
         return super.getTitle();
     }
 
     private class ResourceSelectionDirectoryPanel extends
-        DirectoryPanel<ResourceTO, ResourceTO,
+            DirectoryPanel<ResourceTO, ResourceTO, 
             ResourceSelectionDirectoryPanel.ResourcesDataProvider, ResourceRestClient> {
 
         private static final long serialVersionUID = 6005711052393825472L;
@@ -114,25 +114,26 @@ public class MergeLinkedAccountsResourcesPanel extends WizardStep implements ICo
         protected ActionsPanel<ResourceTO> getActions(final IModel<ResourceTO> model) {
             final ActionsPanel<ResourceTO> panel = super.getActions(model);
             panel.add(new ActionLink<ResourceTO>() {
+
                 private static final long serialVersionUID = -7978723352517770644L;
 
                 @Override
                 public void onClick(final AjaxRequestTarget target, final ResourceTO resource) {
                     MergeLinkedAccountsWizardModel model = MergeLinkedAccountsResourcesPanel.this.wizardModel;
                     String connObjectKeyValue = restClient.getConnObjectKeyValue(
-                        resource.getKey(),
-                        model.getMergingUser().getType(),
-                        model.getMergingUser().getKey());
+                            resource.getKey(),
+                            model.getMergingUser().getType(),
+                            model.getMergingUser().getKey());
                     if (connObjectKeyValue != null) {
                         model.setResource(resource);
                         String tableId = MergeLinkedAccountsResourcesPanel.this.
-                            get("resources:container:content:searchContainer:resultTable"
-                                + ":tablePanel:groupForm:checkgroup:dataTable").
-                            getMarkupId();
+                                get("resources:container:content:searchContainer:resultTable"
+                                        + ":tablePanel:groupForm:checkgroup:dataTable").
+                                getMarkupId();
                         String js = "$('#" + tableId + "').removeClass('active');";
                         js += "$('#" + tableId + " tbody tr td div').filter(function() "
-                            + "{return $(this).text() === \"" + resource.getKey() + "\";})"
-                            + ".parent().parent().addClass('active');";
+                                + "{return $(this).text() === \"" + resource.getKey() + "\";})"
+                                + ".parent().parent().addClass('active');";
                         target.prependJavaScript(js);
 
                     } else {
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/MergeLinkedAccountsReviewPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/MergeLinkedAccountsReviewPanel.java
similarity index 83%
rename from client/console/src/main/java/org/apache/syncope/client/console/panels/MergeLinkedAccountsReviewPanel.java
rename to client/console/src/main/java/org/apache/syncope/client/console/wizards/any/MergeLinkedAccountsReviewPanel.java
index 73ab52a..1c63126 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/MergeLinkedAccountsReviewPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/MergeLinkedAccountsReviewPanel.java
@@ -16,15 +16,21 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.syncope.client.console.panels;
+package org.apache.syncope.client.console.wizards.any;
 
 import de.agilecoders.wicket.core.markup.html.bootstrap.dialog.Modal;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+import java.util.stream.Collectors;
 import org.apache.syncope.client.console.commons.DirectoryDataProvider;
 import org.apache.syncope.client.console.commons.SortableDataProviderComparator;
+import org.apache.syncope.client.console.panels.DirectoryPanel;
 import org.apache.syncope.client.console.rest.ResourceRestClient;
 import org.apache.syncope.client.console.wicket.extensions.markup.html.repeater.data.table.BooleanPropertyColumn;
 import org.apache.syncope.client.console.wicket.markup.html.form.ActionLink;
-import org.apache.syncope.client.console.wizards.any.MergeLinkedAccountsWizardModel;
 import org.apache.syncope.common.lib.to.LinkedAccountTO;
 import org.apache.syncope.common.lib.to.UserTO;
 import org.apache.wicket.PageReference;
@@ -37,18 +43,12 @@ import org.apache.wicket.model.IModel;
 import org.apache.wicket.model.ResourceModel;
 import org.apache.wicket.model.StringResourceModel;
 
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-import java.util.stream.Collectors;
-
 public class MergeLinkedAccountsReviewPanel extends WizardStep {
+
     private static final long serialVersionUID = 1221037007528732347L;
 
     public MergeLinkedAccountsReviewPanel(final MergeLinkedAccountsWizardModel wizardModel,
-                                          final PageReference pageReference) {
+            final PageReference pageReference) {
         super();
         setOutputMarkupId(true);
         setTitleModel(new StringResourceModel("mergeLinkedAccounts.reviewAccounts.title"));
@@ -56,7 +56,7 @@ public class MergeLinkedAccountsReviewPanel extends WizardStep {
     }
 
     private static class LinkedAccountsReviewDirectoryPanel extends
-        DirectoryPanel<LinkedAccountTO, LinkedAccountTO,
+            DirectoryPanel<LinkedAccountTO, LinkedAccountTO, 
             LinkedAccountsReviewDirectoryPanel.LinkedAccountsDataProvider, ResourceRestClient> {
 
         private static final String PAGINATOR_ROWS = "linked.account.review.paginator.rows";
@@ -66,7 +66,7 @@ public class MergeLinkedAccountsReviewPanel extends WizardStep {
         private final MergeLinkedAccountsWizardModel wizardModel;
 
         LinkedAccountsReviewDirectoryPanel(final String id, final PageReference pageReference,
-                                           final MergeLinkedAccountsWizardModel wizardModel) {
+                final MergeLinkedAccountsWizardModel wizardModel) {
             super(id, pageReference, true);
             this.restClient = new ResourceRestClient();
             this.wizardModel = wizardModel;
@@ -91,11 +91,11 @@ public class MergeLinkedAccountsReviewPanel extends WizardStep {
             List<IColumn<LinkedAccountTO, String>> columns = new ArrayList<>();
             columns.add(new PropertyColumn<>(new ResourceModel("resource"), "resource", "resource"));
             columns.add(new PropertyColumn<>(
-                new ResourceModel("connObjectKeyValue"), "connObjectKeyValue", "connObjectKeyValue"));
+                    new ResourceModel("connObjectKeyValue"), "connObjectKeyValue", "connObjectKeyValue"));
             columns.add(new PropertyColumn<>(
-                new ResourceModel("username"), "username", "username"));
+                    new ResourceModel("username"), "username", "username"));
             columns.add(new BooleanPropertyColumn<>(
-                new ResourceModel("suspended"), "suspended", "suspended"));
+                    new ResourceModel("suspended"), "suspended", "suspended"));
             return columns;
         }
 
@@ -110,11 +110,11 @@ public class MergeLinkedAccountsReviewPanel extends WizardStep {
             // Move linked accounts into the target/base user as linked accounts
             List<LinkedAccountTO> accounts = mergingUser.getLinkedAccounts().stream().map(acct -> {
                 LinkedAccountTO linkedAccount =
-                    new LinkedAccountTO.Builder(acct.getResource(), acct.getConnObjectKeyValue())
-                        .password(acct.getPassword())
-                        .suspended(acct.isSuspended())
-                        .username(acct.getUsername())
-                        .build();
+                        new LinkedAccountTO.Builder(acct.getResource(), acct.getConnObjectKeyValue())
+                                .password(acct.getPassword())
+                                .suspended(acct.isSuspended())
+                                .username(acct.getUsername())
+                                .build();
                 linkedAccount.getPlainAttrs().addAll(acct.getPlainAttrs());
                 linkedAccount.getPrivileges().addAll(acct.getPrivileges());
                 return linkedAccount;
@@ -123,20 +123,20 @@ public class MergeLinkedAccountsReviewPanel extends WizardStep {
             // Move merging user's resources into the target/base user as a linked account
             accounts.addAll(mergingUser.getResources().stream().map(resource -> {
                 String connObjectKeyValue = restClient.getConnObjectKeyValue(resource,
-                    mergingUser.getType(), mergingUser.getKey());
+                        mergingUser.getType(), mergingUser.getKey());
                 return new LinkedAccountTO.Builder(resource, connObjectKeyValue).build();
             }).collect(Collectors.toList()));
 
             // Move merging user into target/base user as a linked account
             String connObjectKeyValue = restClient.getConnObjectKeyValue(
-                wizardModel.getResource().getKey(),
-                mergingUser.getType(), mergingUser.getKey());
+                    wizardModel.getResource().getKey(),
+                    mergingUser.getType(), mergingUser.getKey());
             LinkedAccountTO linkedAccount =
-                new LinkedAccountTO.Builder(wizardModel.getResource().getKey(), connObjectKeyValue)
-                    .password(mergingUser.getPassword())
-                    .suspended(mergingUser.isSuspended())
-                    .username(mergingUser.getUsername())
-                    .build();
+                    new LinkedAccountTO.Builder(wizardModel.getResource().getKey(), connObjectKeyValue)
+                            .password(mergingUser.getPassword())
+                            .suspended(mergingUser.isSuspended())
+                            .username(mergingUser.getUsername())
+                            .build();
             linkedAccount.getPlainAttrs().addAll(mergingUser.getPlainAttrs());
             linkedAccount.getPrivileges().addAll(mergingUser.getPrivileges());
             accounts.add(linkedAccount);
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/MergeLinkedAccountsSearchPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/MergeLinkedAccountsSearchPanel.java
similarity index 76%
rename from client/console/src/main/java/org/apache/syncope/client/console/panels/MergeLinkedAccountsSearchPanel.java
rename to client/console/src/main/java/org/apache/syncope/client/console/wizards/any/MergeLinkedAccountsSearchPanel.java
index 5e8d55a..64b9d4a 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/MergeLinkedAccountsSearchPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/MergeLinkedAccountsSearchPanel.java
@@ -16,8 +16,9 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.syncope.client.console.panels;
+package org.apache.syncope.client.console.wizards.any;
 
+import java.util.ArrayList;
 import org.apache.syncope.client.console.panels.search.AnySelectionDirectoryPanel;
 import org.apache.syncope.client.console.panels.search.SearchClausePanel;
 import org.apache.syncope.client.console.panels.search.SearchUtils;
@@ -26,10 +27,9 @@ import org.apache.syncope.client.console.panels.search.UserSelectionDirectoryPan
 import org.apache.syncope.client.console.rest.AnyTypeClassRestClient;
 import org.apache.syncope.client.console.rest.AnyTypeRestClient;
 import org.apache.syncope.client.console.rest.UserRestClient;
-import org.apache.syncope.client.console.wizards.any.MergeLinkedAccountsWizardModel;
 import org.apache.syncope.client.lib.SyncopeClient;
-import org.apache.syncope.common.lib.to.AnyTO;
 import org.apache.syncope.common.lib.to.AnyTypeTO;
+import org.apache.syncope.common.lib.to.UserTO;
 import org.apache.syncope.common.lib.types.AnyTypeKind;
 import org.apache.wicket.Component;
 import org.apache.wicket.PageReference;
@@ -42,19 +42,18 @@ import org.apache.wicket.model.Model;
 import org.apache.wicket.model.StringResourceModel;
 import org.apache.wicket.model.util.ListModel;
 
-import java.util.ArrayList;
-
 public class MergeLinkedAccountsSearchPanel extends WizardStep {
-    private static final long serialVersionUID = 1221037007528732347L;
-
-    private final WebMarkupContainer ownerContainer;
 
-    private final UserSearchPanel userSearchPanel;
+    private static final long serialVersionUID = 1221037007528732347L;
 
     private final AnyTypeClassRestClient anyTypeClassRestClient = new AnyTypeClassRestClient();
 
     private final AnyTypeRestClient anyTypeRestClient = new AnyTypeRestClient();
 
+    private final WebMarkupContainer ownerContainer;
+
+    private final UserSearchPanel userSearchPanel;
+
     private final UserSelectionDirectoryPanel userDirectoryPanel;
 
     private final Fragment userSearchFragment;
@@ -73,14 +72,14 @@ public class MergeLinkedAccountsSearchPanel extends WizardStep {
 
         userSearchFragment = new Fragment("search", "userSearchFragment", this);
         userSearchPanel = UserSearchPanel.class.cast(new UserSearchPanel.Builder(
-            new ListModel<>(new ArrayList<>())).required(false).enableSearch(MergeLinkedAccountsSearchPanel.this).
-            build("usersearch"));
+                new ListModel<>(new ArrayList<>())).required(false).enableSearch(MergeLinkedAccountsSearchPanel.this).
+                build("usersearch"));
         userSearchFragment.add(userSearchPanel);
 
         AnyTypeTO anyTypeTO = anyTypeRestClient.read(AnyTypeKind.USER.name());
         userDirectoryPanel = UserSelectionDirectoryPanel.class.cast(new UserSelectionDirectoryPanel.Builder(
-            anyTypeClassRestClient.list(anyTypeTO.getClasses()), anyTypeTO.getKey(), pageRef).
-            build("searchResult"));
+                anyTypeClassRestClient.list(anyTypeTO.getClasses()), anyTypeTO.getKey(), pageRef).
+                build("searchResult"));
 
         userSearchFragment.add(userDirectoryPanel);
         ownerContainer.add(userSearchFragment);
@@ -89,23 +88,24 @@ public class MergeLinkedAccountsSearchPanel extends WizardStep {
     @Override
     public void onEvent(final IEvent<?> event) {
         if (event.getPayload() instanceof SearchClausePanel.SearchEvent) {
-            final AjaxRequestTarget target = SearchClausePanel.SearchEvent.class.cast(event.getPayload()).getTarget();
-            final String fiql = "username!~" + this.wizardModel.getBaseUser().getUsername() + ';'
-                + SearchUtils.buildFIQL(userSearchPanel.getModel().getObject(),
-                SyncopeClient.getUserSearchConditionBuilder());
+            AjaxRequestTarget target = SearchClausePanel.SearchEvent.class.cast(event.getPayload()).getTarget();
+            String fiql = "username!~" + this.wizardModel.getBaseUser().getUsername() + ';'
+                    + SearchUtils.buildFIQL(userSearchPanel.getModel().getObject(),
+                            SyncopeClient.getUserSearchConditionBuilder());
             userDirectoryPanel.search(fiql, target);
         } else if (event.getPayload() instanceof AnySelectionDirectoryPanel.ItemSelection) {
-            AnySelectionDirectoryPanel.ItemSelection payload =
-                (AnySelectionDirectoryPanel.ItemSelection) event.getPayload();
+            @SuppressWarnings("unchecked")
+            AnySelectionDirectoryPanel.ItemSelection<UserTO> payload =
+                    (AnySelectionDirectoryPanel.ItemSelection<UserTO>) event.getPayload();
 
-            final AnyTO sel = payload.getSelection();
-            this.wizardModel.setMergingUser(new UserRestClient().read(sel.getKey()));
+            UserTO selected = payload.getSelection();
+            this.wizardModel.setMergingUser(new UserRestClient().read(selected.getKey()));
 
             String tableId = ((Component) event.getSource()).
-                get("container:content:searchContainer:resultTable:tablePanel:groupForm:checkgroup:dataTable").
-                getMarkupId();
+                    get("container:content:searchContainer:resultTable:tablePanel:groupForm:checkgroup:dataTable").
+                    getMarkupId();
             String js = "$('#" + tableId + " tr').removeClass('active');";
-            js += "$('#" + tableId + " td[title=" + sel.getKey() + "]').parent().addClass('active');";
+            js += "$('#" + tableId + " td[title=" + selected.getKey() + "]').parent().addClass('active');";
             payload.getTarget().prependJavaScript(js);
         }
     }
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/MergeLinkedAccountsWizardBuilder.java b/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/MergeLinkedAccountsWizardBuilder.java
index b17ba5f..841cd64 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/MergeLinkedAccountsWizardBuilder.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/MergeLinkedAccountsWizardBuilder.java
@@ -29,9 +29,6 @@ import javax.ws.rs.core.MediaType;
 import org.apache.syncope.client.console.SyncopeConsoleSession;
 import org.apache.syncope.client.console.commons.Constants;
 import org.apache.syncope.client.console.pages.BasePage;
-import org.apache.syncope.client.console.panels.MergeLinkedAccountsResourcesPanel;
-import org.apache.syncope.client.console.panels.MergeLinkedAccountsReviewPanel;
-import org.apache.syncope.client.console.panels.MergeLinkedAccountsSearchPanel;
 import org.apache.syncope.client.console.panels.UserDirectoryPanel;
 import org.apache.syncope.client.console.rest.ResourceRestClient;
 import org.apache.syncope.client.console.rest.UserRestClient;
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/Ownership.java b/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/Ownership.java
index 6e9a892..7ca98cd 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/Ownership.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/Ownership.java
@@ -103,7 +103,7 @@ public class Ownership extends WizardStep implements ICondition {
         // -----------------------------------------------------------------
         // Pre-Authorizations
         // -----------------------------------------------------------------
-        final ActionPermissions permissions = new ActionPermissions();
+        ActionPermissions permissions = new ActionPermissions();
         setMetaData(MetaDataRoleAuthorizationStrategy.ACTION_PERMISSIONS, permissions);
         permissions.authorize(RENDER, new Roles(StandardEntitlement.USER_SEARCH));
         // -----------------------------------------------------------------
@@ -145,7 +145,7 @@ public class Ownership extends WizardStep implements ICondition {
                 final CheckBox checkBox = super.newCheckBox(id, model);
                 checkBox.add(new IndicatorAjaxFormComponentUpdatingBehavior(Constants.ON_CHANGE) {
 
-                    private static final long serialVersionUID = 1L;
+                    private static final long serialVersionUID = 18235445704320L;
 
                     @Override
                     protected void onUpdate(final AjaxRequestTarget target) {
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/wizards/role/RoleWizardBuilder.java b/client/console/src/main/java/org/apache/syncope/client/console/wizards/role/RoleWizardBuilder.java
index 99d7671..8df8cdd 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/wizards/role/RoleWizardBuilder.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/wizards/role/RoleWizardBuilder.java
@@ -52,7 +52,7 @@ public class RoleWizardBuilder extends AjaxWizardBuilder<RoleWrapper> {
 
     private static final long serialVersionUID = 5945391813567245081L;
 
-    private final RoleRestClient groupRestClient = new RoleRestClient();
+    private final RoleRestClient restClient = new RoleRestClient();
 
     /**
      * Construct.
@@ -73,9 +73,9 @@ public class RoleWizardBuilder extends AjaxWizardBuilder<RoleWrapper> {
      */
     @Override
     public AjaxWizardBuilder<RoleWrapper> setItem(final RoleWrapper item) {
-        return (AjaxWizardBuilder<RoleWrapper>) (item != null
-                ? super.setItem(new RoleWrapper(item.getInnerObject()))
-                : super.setItem(null));
+        return (AjaxWizardBuilder<RoleWrapper>) (item == null
+                ? super.setItem(null)
+                : super.setItem(new RoleWrapper(item.getInnerObject())));
     }
 
     @Override
@@ -83,9 +83,10 @@ public class RoleWizardBuilder extends AjaxWizardBuilder<RoleWrapper> {
         modelObject.fillDynamicConditions();
         if (getOriginalItem() == null || getOriginalItem().getInnerObject() == null
                 || StringUtils.isBlank(getOriginalItem().getInnerObject().getKey())) {
-            groupRestClient.create(modelObject.getInnerObject());
+
+            restClient.create(modelObject.getInnerObject());
         } else {
-            groupRestClient.update(modelObject.getInnerObject());
+            restClient.update(modelObject.getInnerObject());
         }
         return null;
     }
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/SyncopeConsoleApplication.properties b/client/console/src/main/resources/org/apache/syncope/client/console/SyncopeConsoleApplication.properties
index aadbb1d..634b6f4 100644
--- a/client/console/src/main/resources/org/apache/syncope/client/console/SyncopeConsoleApplication.properties
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/SyncopeConsoleApplication.properties
@@ -77,3 +77,4 @@ before=Before
 after=After
 nomatch=No matches found
 tooLargeFile=File is too large, max upload file size is ${maxUploadSizeB} bytes (${maxUploadSizeMB} MB). 
+confirmDelegation=Do you really want to switch user?
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/SyncopeConsoleApplication_fr_CA.properties b/client/console/src/main/resources/org/apache/syncope/client/console/SyncopeConsoleApplication_fr_CA.properties
index 2e37055..e370dc4 100644
--- a/client/console/src/main/resources/org/apache/syncope/client/console/SyncopeConsoleApplication_fr_CA.properties
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/SyncopeConsoleApplication_fr_CA.properties
@@ -75,3 +75,4 @@ before=Avant
 after=Apr\u00e8s
 nomatch=Aucune correspondance trouv\u00e9e
 tooLargeFile=Fichier trop volumineux, la taille maximale autoris\u00e9e est de $ {maxUploadSizeB} octets ($ {maxUploadSizeMB} Mo).
+confirmDelegation=Do you really want to switch user?
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/SyncopeConsoleApplication_it.properties b/client/console/src/main/resources/org/apache/syncope/client/console/SyncopeConsoleApplication_it.properties
index c86cc23..3794be7 100644
--- a/client/console/src/main/resources/org/apache/syncope/client/console/SyncopeConsoleApplication_it.properties
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/SyncopeConsoleApplication_it.properties
@@ -77,3 +77,4 @@ before=Prima
 after=Dopo
 nomatch=Nessun risultato trovato
 tooLargeFile=File troppo grande, la dimensione massima ammessa \u00e8 ${maxUploadSizeB} bytes (${maxUploadSizeMB} MB). 
+confirmDelegation=Vuoi davvero cambiare utenza?
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/SyncopeConsoleApplication_ja.properties b/client/console/src/main/resources/org/apache/syncope/client/console/SyncopeConsoleApplication_ja.properties
index aa66bf1..afc0458 100644
--- a/client/console/src/main/resources/org/apache/syncope/client/console/SyncopeConsoleApplication_ja.properties
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/SyncopeConsoleApplication_ja.properties
@@ -75,3 +75,4 @@ before=\u524d
 after=\u5f8c
 nomatch=No matches found
 tooLargeFile=File is too large, max upload file size is ${maxUploadSizeB} bytes (${maxUploadSizeMB} MB). 
+confirmDelegation=Do you really want to switch user?
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/SyncopeConsoleApplication_pt_BR.properties b/client/console/src/main/resources/org/apache/syncope/client/console/SyncopeConsoleApplication_pt_BR.properties
index f34817c..fa90aa8 100644
--- a/client/console/src/main/resources/org/apache/syncope/client/console/SyncopeConsoleApplication_pt_BR.properties
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/SyncopeConsoleApplication_pt_BR.properties
@@ -77,3 +77,4 @@ before=Before
 after=After
 nomatch=Nenhuma correspond\u00eancia encontrada
 tooLargeFile=File is too large, max upload file size is ${maxUploadSizeB} bytes (${maxUploadSizeMB} MB). 
+confirmDelegation=Do you really want to switch user?
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/SyncopeConsoleApplication_ru.properties b/client/console/src/main/resources/org/apache/syncope/client/console/SyncopeConsoleApplication_ru.properties
index f49e8e1..3123da4 100644
--- a/client/console/src/main/resources/org/apache/syncope/client/console/SyncopeConsoleApplication_ru.properties
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/SyncopeConsoleApplication_ru.properties
@@ -76,3 +76,4 @@ before=Before
 after=After
 nomatch=No matches found
 tooLargeFile=File is too large, max upload file size is ${maxUploadSizeB} bytes (${maxUploadSizeMB} MB). 
+confirmDelegation=Do you really want to switch user?
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/pages/BasePage.html b/client/console/src/main/resources/org/apache/syncope/client/console/pages/BasePage.html
index 2cf1e85..78b77e9 100644
--- a/client/console/src/main/resources/org/apache/syncope/client/console/pages/BasePage.html
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/pages/BasePage.html
@@ -86,8 +86,23 @@ under the License.
                       </div>
                     </div>
                   </li>
+                  <li class="user-body" wicket:id="delegationsContainer">
+                    <div class="row">
+                      <div class="col-xs-12 text-center">
+                        <div class="box box-primary">
+                          <div class="box-header">
+                            <h3 class="box-title" wicket:id="delegationsHeader"/>
+                          </div>
+                        </div>
+                      </div>
+                      <span wicket:id="delegations">
+                        <span wicket:id="delegation"/>
+                      </span>
+                    </div>
+                  </li>
                   <li class="user-footer">
                     <div class="pull-left">
+                      <a href="#" class="btn btn-default btn-flat" wicket:id="endDelegation"><wicket:message key="endDelegation"/></a>
                     </div>
                     <div class="pull-right">
                       <a href="#" class="btn btn-default btn-flat" wicket:id="logout"><wicket:message key="logout"/></a>
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/pages/BasePage.properties b/client/console/src/main/resources/org/apache/syncope/client/console/pages/BasePage.properties
index 6bfa175..83e32e7 100644
--- a/client/console/src/main/resources/org/apache/syncope/client/console/pages/BasePage.properties
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/pages/BasePage.properties
@@ -23,3 +23,5 @@ hostname=Host Name
 processors=Available Processors
 os=Operating System
 jvm=JVM
+delegations=Delegations
+endDelegation=End Delegation
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/pages/BasePage_fr_CA.properties b/client/console/src/main/resources/org/apache/syncope/client/console/pages/BasePage_fr_CA.properties
index 955b91c..a7d7e6b 100644
--- a/client/console/src/main/resources/org/apache/syncope/client/console/pages/BasePage_fr_CA.properties
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/pages/BasePage_fr_CA.properties
@@ -17,8 +17,10 @@
 home=Accueil
 version=Version
 domain=Domaine
-systemInfo=Information sur le syst�me
-hostname=Nom d'h�te
+systemInfo=Information sur le syst\u00e8me
+hostname=Nom d'h\u00f4te
 processors=Processeurs disponibles
-os=Syst�me d'exploitation
+os=Syst\u00e8me d'exploitation
 jvm=JVM
+delegations=Delegations
+endDelegation=End Delegation
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/pages/BasePage_it.properties b/client/console/src/main/resources/org/apache/syncope/client/console/pages/BasePage_it.properties
index fe10072..848a14b 100644
--- a/client/console/src/main/resources/org/apache/syncope/client/console/pages/BasePage_it.properties
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/pages/BasePage_it.properties
@@ -16,10 +16,12 @@
 # under the License.
 home=Home
 version=Versione
-domain=Dom\u00ednio
+domain=Dominio
 
 systemInfo=Informazioni di Sistema
 hostname=Nome Host
 processors=Processori Disponibili
 os=Sistema Operativo
 jvm=JVM
+delegations=Deleghe
+endDelegation=Termina Delega
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/pages/BasePage_ja.properties b/client/console/src/main/resources/org/apache/syncope/client/console/pages/BasePage_ja.properties
index a1e527e..aef6d11 100644
--- a/client/console/src/main/resources/org/apache/syncope/client/console/pages/BasePage_ja.properties
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/pages/BasePage_ja.properties
@@ -23,3 +23,5 @@ hostname=\u30db\u30b9\u30c8\u540d
 processors=\u5229\u7528\u53ef\u80fd\u306a\u30d7\u30ed\u30bb\u30c3\u30b5\u30fc
 os=\u30aa\u30da\u30ec\u30fc\u30c6\u30a3\u30f3\u30b0\u30b7\u30b9\u30c6\u30e0
 jvm=JVM
+delegations=Delegations
+endDelegation=End Delegation
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/pages/BasePage_pt_BR.properties b/client/console/src/main/resources/org/apache/syncope/client/console/pages/BasePage_pt_BR.properties
index 0c2da70..88b9897 100644
--- a/client/console/src/main/resources/org/apache/syncope/client/console/pages/BasePage_pt_BR.properties
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/pages/BasePage_pt_BR.properties
@@ -23,3 +23,5 @@ hostname=Host Name
 processors=Available Processors
 os=Operating System
 jvm=JVM
+delegations=Delegations
+endDelegation=End Delegation
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/pages/BasePage_ru.properties b/client/console/src/main/resources/org/apache/syncope/client/console/pages/BasePage_ru.properties
index e6c6105..ac5c1f2 100644
--- a/client/console/src/main/resources/org/apache/syncope/client/console/pages/BasePage_ru.properties
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/pages/BasePage_ru.properties
@@ -23,3 +23,5 @@ hostname=\u0418\u043c\u044f \u0445\u043e\u0441\u0442\u0430
 processors=\u041f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u044b
 os=\u041e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u0430\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u0430
 jvm=JVM
+delegations=Delegations
+endDelegation=End Delegation
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/pages/Security.properties b/client/console/src/main/resources/org/apache/syncope/client/console/pages/Security.properties
index 3bba56c..3132aad 100644
--- a/client/console/src/main/resources/org/apache/syncope/client/console/pages/Security.properties
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/pages/Security.properties
@@ -19,3 +19,4 @@ dynRealms=Dynamic Realms
 privileges=Privileges
 applications=Applications
 securityQuestions=Security Questions
+delegations=Delegations
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/pages/Security_fr_CA.properties b/client/console/src/main/resources/org/apache/syncope/client/console/pages/Security_fr_CA.properties
index abc9e64..92d8be6 100644
--- a/client/console/src/main/resources/org/apache/syncope/client/console/pages/Security_fr_CA.properties
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/pages/Security_fr_CA.properties
@@ -14,8 +14,9 @@
 # KIND, either express or implied.  See the License for the
 # specific language governing permissions and limitations
 # under the License.
-add=Cr�er nouveau r�le
-Domaines dynamiques=Domaines dynamiques
-privileges=Privil�ges
+add=Cr\u00e9er nouveau r\u00f4le
+dynRealms=Domaines dynamiques
+privileges=Privil\u00e8ges
 applications=Applications
-securityQuestions=Questions de s�curit�
+securityQuestions=Questions de s\u00e9curit\u00e9
+delegations=Delegations
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/pages/Security_it.properties b/client/console/src/main/resources/org/apache/syncope/client/console/pages/Security_it.properties
index a8e66ca..1a116a3 100644
--- a/client/console/src/main/resources/org/apache/syncope/client/console/pages/Security_it.properties
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/pages/Security_it.properties
@@ -19,3 +19,4 @@ dynRealms=Realm dinamici
 privileges=Privilegi
 applications=Applicazioni
 securityQuestions=Domande di sicurezza
+delegations=Deleghe
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/pages/Security_ja.properties b/client/console/src/main/resources/org/apache/syncope/client/console/pages/Security_ja.properties
index fbbf749..e9892b7 100644
--- a/client/console/src/main/resources/org/apache/syncope/client/console/pages/Security_ja.properties
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/pages/Security_ja.properties
@@ -19,3 +19,4 @@ dynRealms=\u52d5\u7684\u30ec\u30eb\u30e0
 privileges=\u6a29\u9650
 applications=\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3
 securityQuestions=\u79d8\u5bc6\u306e\u8cea\u554f
+delegations=Delegations
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/pages/Security_pt_BR.properties b/client/console/src/main/resources/org/apache/syncope/client/console/pages/Security_pt_BR.properties
index f6e211a..b0ff8d8 100644
--- a/client/console/src/main/resources/org/apache/syncope/client/console/pages/Security_pt_BR.properties
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/pages/Security_pt_BR.properties
@@ -19,3 +19,4 @@ dynRealms=Realm din\u00e2micos
 privileges=Privileges
 applications=Applications
 securityQuestions=Perguntas de seguran\u00e7a
+delegations=Delegations
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/pages/Security_ru.properties b/client/console/src/main/resources/org/apache/syncope/client/console/pages/Security_ru.properties
index 6a5c308..7e98f88 100644
--- a/client/console/src/main/resources/org/apache/syncope/client/console/pages/Security_ru.properties
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/pages/Security_ru.properties
@@ -20,3 +20,4 @@ dynRealms=Dynamic Realms
 privileges=Privileges
 applications=Applications
 securityQuestions=\u041a\u043e\u043d\u0442\u0440\u043e\u043b\u044c\u043d\u044b\u0435 \u0432\u043e\u043f\u0440\u043e\u0441\u044b
+delegations=Delegations
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/tasks/ExecutionsDirectoryPanel_it.properties b/client/console/src/main/resources/org/apache/syncope/client/console/panels/DelegationDirectoryPanel.properties
similarity index 87%
copy from client/console/src/main/resources/org/apache/syncope/client/console/tasks/ExecutionsDirectoryPanel_it.properties
copy to client/console/src/main/resources/org/apache/syncope/client/console/panels/DelegationDirectoryPanel.properties
index 3c525b7..4449fb4 100644
--- a/client/console/src/main/resources/org/apache/syncope/client/console/tasks/ExecutionsDirectoryPanel_it.properties
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/panels/DelegationDirectoryPanel.properties
@@ -14,7 +14,10 @@
 # KIND, either express or implied.  See the License for the
 # specific language governing permissions and limitations
 # under the License.
+any.edit=Edit Delegation ${key}
+any.new=New Delegation
+delegating=Delegating
+delegated=Delegated
 start=Start
 end=End
-status=Stato
-execution.view=Risultato dello stato dell'esecuzione '${key}'
+validity=Validity
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/panels/MergeLinkedAccountsSearchPanel_fr_CA.properties b/client/console/src/main/resources/org/apache/syncope/client/console/panels/DelegationDirectoryPanel_fr_CA.properties
similarity index 84%
copy from client/console/src/main/resources/org/apache/syncope/client/console/panels/MergeLinkedAccountsSearchPanel_fr_CA.properties
copy to client/console/src/main/resources/org/apache/syncope/client/console/panels/DelegationDirectoryPanel_fr_CA.properties
index 5d25d9c..2c80111 100644
--- a/client/console/src/main/resources/org/apache/syncope/client/console/panels/MergeLinkedAccountsSearchPanel_fr_CA.properties
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/panels/DelegationDirectoryPanel_fr_CA.properties
@@ -14,4 +14,10 @@
 # KIND, either express or implied.  See the License for the
 # specific language governing permissions and limitations
 # under the License.
-mergeLinkedAccounts.searchUser=Select user to merge
+any.edit=Edit Delegation ${key}
+any.new=New Delegation
+delegating=Delegating
+delegated=Delegated
+start=D\u00e9but
+end=Fin
+validity=Validity
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/panels/MergeLinkedAccountsSearchPanel_fr_CA.properties b/client/console/src/main/resources/org/apache/syncope/client/console/panels/DelegationDirectoryPanel_it.properties
similarity index 85%
copy from client/console/src/main/resources/org/apache/syncope/client/console/panels/MergeLinkedAccountsSearchPanel_fr_CA.properties
copy to client/console/src/main/resources/org/apache/syncope/client/console/panels/DelegationDirectoryPanel_it.properties
index 5d25d9c..89de8bf 100644
--- a/client/console/src/main/resources/org/apache/syncope/client/console/panels/MergeLinkedAccountsSearchPanel_fr_CA.properties
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/panels/DelegationDirectoryPanel_it.properties
@@ -14,4 +14,10 @@
 # KIND, either express or implied.  See the License for the
 # specific language governing permissions and limitations
 # under the License.
-mergeLinkedAccounts.searchUser=Select user to merge
+any.edit=Modifica Delega ${key}
+any.new=Nuova Delega
+delegating=Delegante
+delegated=Delegato
+start=Inizio
+end=Fine
+validity=Validit\u00e0
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/tasks/ExecutionsDirectoryPanel_it.properties b/client/console/src/main/resources/org/apache/syncope/client/console/panels/DelegationDirectoryPanel_ja.properties
similarity index 87%
copy from client/console/src/main/resources/org/apache/syncope/client/console/tasks/ExecutionsDirectoryPanel_it.properties
copy to client/console/src/main/resources/org/apache/syncope/client/console/panels/DelegationDirectoryPanel_ja.properties
index 3c525b7..4449fb4 100644
--- a/client/console/src/main/resources/org/apache/syncope/client/console/tasks/ExecutionsDirectoryPanel_it.properties
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/panels/DelegationDirectoryPanel_ja.properties
@@ -14,7 +14,10 @@
 # KIND, either express or implied.  See the License for the
 # specific language governing permissions and limitations
 # under the License.
+any.edit=Edit Delegation ${key}
+any.new=New Delegation
+delegating=Delegating
+delegated=Delegated
 start=Start
 end=End
-status=Stato
-execution.view=Risultato dello stato dell'esecuzione '${key}'
+validity=Validity
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/tasks/ExecutionsDirectoryPanel_it.properties b/client/console/src/main/resources/org/apache/syncope/client/console/panels/DelegationDirectoryPanel_pt_BR.properties
similarity index 87%
copy from client/console/src/main/resources/org/apache/syncope/client/console/tasks/ExecutionsDirectoryPanel_it.properties
copy to client/console/src/main/resources/org/apache/syncope/client/console/panels/DelegationDirectoryPanel_pt_BR.properties
index 3c525b7..4449fb4 100644
--- a/client/console/src/main/resources/org/apache/syncope/client/console/tasks/ExecutionsDirectoryPanel_it.properties
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/panels/DelegationDirectoryPanel_pt_BR.properties
@@ -14,7 +14,10 @@
 # KIND, either express or implied.  See the License for the
 # specific language governing permissions and limitations
 # under the License.
+any.edit=Edit Delegation ${key}
+any.new=New Delegation
+delegating=Delegating
+delegated=Delegated
 start=Start
 end=End
-status=Stato
-execution.view=Risultato dello stato dell'esecuzione '${key}'
+validity=Validity
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/pages/BasePage.properties b/client/console/src/main/resources/org/apache/syncope/client/console/panels/DelegationDirectoryPanel_ru.properties
similarity index 78%
copy from client/console/src/main/resources/org/apache/syncope/client/console/pages/BasePage.properties
copy to client/console/src/main/resources/org/apache/syncope/client/console/panels/DelegationDirectoryPanel_ru.properties
index 6bfa175..2438784 100644
--- a/client/console/src/main/resources/org/apache/syncope/client/console/pages/BasePage.properties
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/panels/DelegationDirectoryPanel_ru.properties
@@ -14,12 +14,11 @@
 # KIND, either express or implied.  See the License for the
 # specific language governing permissions and limitations
 # under the License.
-home=Home
-version=Version
-domain=Domain
-
-systemInfo=System Information
-hostname=Host Name
-processors=Available Processors
-os=Operating System
-jvm=JVM
+#
+any.edit=Edit Delegation ${key}
+any.new=New Delegation
+delegating=Delegating
+delegated=Delegated
+start=\u041d\u0430\u0447\u0430\u043b\u043e
+end=\u041e\u043a\u043e\u043d\u0447\u0430\u043d\u0438\u0435
+validity=Validity
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/panels/MergeLinkedAccountsResourcesPanel.html b/client/console/src/main/resources/org/apache/syncope/client/console/panels/DelegationSelectionPanel.html
similarity index 86%
copy from client/console/src/main/resources/org/apache/syncope/client/console/panels/MergeLinkedAccountsResourcesPanel.html
copy to client/console/src/main/resources/org/apache/syncope/client/console/panels/DelegationSelectionPanel.html
index c8f3ec9..587f971 100644
--- a/client/console/src/main/resources/org/apache/syncope/client/console/panels/MergeLinkedAccountsResourcesPanel.html
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/panels/DelegationSelectionPanel.html
@@ -17,8 +17,7 @@ specific language governing permissions and limitations
 under the License.
 -->
 <html xmlns="http://www.w3.org/1999/xhtml" xmlns:wicket="http://wicket.apache.org">
-<wicket:panel>
-    <div wicket:id="resources">
-    </div>
-</wicket:panel>
+  <wicket:panel>
+    <a wicket:id="link" class="btn btn-app"><i class="fa fa-user"></i><span wicket:id="label"/></a>
+  </wicket:panel>
 </html>
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/tasks/ExecutionsDirectoryPanel_it.properties b/client/console/src/main/resources/org/apache/syncope/client/console/tasks/ExecutionsDirectoryPanel_it.properties
index 3c525b7..327b67c 100644
--- a/client/console/src/main/resources/org/apache/syncope/client/console/tasks/ExecutionsDirectoryPanel_it.properties
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/tasks/ExecutionsDirectoryPanel_it.properties
@@ -14,7 +14,7 @@
 # KIND, either express or implied.  See the License for the
 # specific language governing permissions and limitations
 # under the License.
-start=Start
-end=End
+start=Inizio
+end=Fine
 status=Stato
 execution.view=Risultato dello stato dell'esecuzione '${key}'
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/wicket/markup/html/form/ActionsPanel_it.properties b/client/console/src/main/resources/org/apache/syncope/client/console/wicket/markup/html/form/ActionsPanel_it.properties
index c6e88ca..377b547 100644
--- a/client/console/src/main/resources/org/apache/syncope/client/console/wicket/markup/html/form/ActionsPanel_it.properties
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/wicket/markup/html/form/ActionsPanel_it.properties
@@ -151,7 +151,7 @@ claim.title=claim
 claim.alt=claim icon
 
 select.class=glyphicon glyphicon-ok
-select.title=select
+select.title=seleziona
 select.alt=select icon
 
 close.class=fa fa-sign-out
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/panels/MergeLinkedAccountsResourcesPanel.html b/client/console/src/main/resources/org/apache/syncope/client/console/wizards/DelegationWizardBuilder$Roles.html
similarity index 90%
copy from client/console/src/main/resources/org/apache/syncope/client/console/panels/MergeLinkedAccountsResourcesPanel.html
copy to client/console/src/main/resources/org/apache/syncope/client/console/wizards/DelegationWizardBuilder$Roles.html
index c8f3ec9..2926df2 100644
--- a/client/console/src/main/resources/org/apache/syncope/client/console/panels/MergeLinkedAccountsResourcesPanel.html
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/wizards/DelegationWizardBuilder$Roles.html
@@ -17,8 +17,9 @@ specific language governing permissions and limitations
 under the License.
 -->
 <html xmlns="http://www.w3.org/1999/xhtml" xmlns:wicket="http://wicket.apache.org">
-<wicket:panel>
-    <div wicket:id="resources">
+  <wicket:panel>
+    <div class="form-group">
+      <span wicket:id="roles"/>
     </div>
-</wicket:panel>
+  </wicket:panel>
 </html>
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/panels/MergeLinkedAccountsResourcesPanel.html b/client/console/src/main/resources/org/apache/syncope/client/console/wizards/DelegationWizardBuilder$StartEnd.html
similarity index 83%
copy from client/console/src/main/resources/org/apache/syncope/client/console/panels/MergeLinkedAccountsResourcesPanel.html
copy to client/console/src/main/resources/org/apache/syncope/client/console/wizards/DelegationWizardBuilder$StartEnd.html
index c8f3ec9..654eca0 100644
--- a/client/console/src/main/resources/org/apache/syncope/client/console/panels/MergeLinkedAccountsResourcesPanel.html
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/wizards/DelegationWizardBuilder$StartEnd.html
@@ -17,8 +17,12 @@ specific language governing permissions and limitations
 under the License.
 -->
 <html xmlns="http://www.w3.org/1999/xhtml" xmlns:wicket="http://wicket.apache.org">
-<wicket:panel>
-    <div wicket:id="resources">
+  <wicket:panel>
+    <div class="form-group">
+      <span wicket:id="start"/>
     </div>
-</wicket:panel>
+    <div class="form-group">
+      <span wicket:id="end"/>
+    </div>
+  </wicket:panel>
 </html>
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/panels/MergeLinkedAccountsResourcesPanel.html b/client/console/src/main/resources/org/apache/syncope/client/console/wizards/DelegationWizardBuilder$Users.html
similarity index 83%
copy from client/console/src/main/resources/org/apache/syncope/client/console/panels/MergeLinkedAccountsResourcesPanel.html
copy to client/console/src/main/resources/org/apache/syncope/client/console/wizards/DelegationWizardBuilder$Users.html
index c8f3ec9..8a731d8 100644
--- a/client/console/src/main/resources/org/apache/syncope/client/console/panels/MergeLinkedAccountsResourcesPanel.html
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/wizards/DelegationWizardBuilder$Users.html
@@ -17,8 +17,12 @@ specific language governing permissions and limitations
 under the License.
 -->
 <html xmlns="http://www.w3.org/1999/xhtml" xmlns:wicket="http://wicket.apache.org">
-<wicket:panel>
-    <div wicket:id="resources">
+  <wicket:panel>
+    <div class="form-group">
+      <span wicket:id="delegating"/>
     </div>
-</wicket:panel>
+    <div class="form-group">
+      <span wicket:id="delegated"/>
+    </div>
+  </wicket:panel>
 </html>
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/panels/MergeLinkedAccountsResourcesPanel.html b/client/console/src/main/resources/org/apache/syncope/client/console/wizards/UserSelectionWizardStep.html
similarity index 82%
copy from client/console/src/main/resources/org/apache/syncope/client/console/panels/MergeLinkedAccountsResourcesPanel.html
copy to client/console/src/main/resources/org/apache/syncope/client/console/wizards/UserSelectionWizardStep.html
index c8f3ec9..157d5d8 100644
--- a/client/console/src/main/resources/org/apache/syncope/client/console/panels/MergeLinkedAccountsResourcesPanel.html
+++ b/client/console/src/main/resources/org/apache/syncope/client/console/wizards/UserSelectionWizardStep.html
@@ -17,8 +17,10 @@ specific language governing permissions and limitations
 under the License.
 -->
 <html xmlns="http://www.w3.org/1999/xhtml" xmlns:wicket="http://wicket.apache.org">
-<wicket:panel>
-    <div wicket:id="resources">
+  <wicket:panel>
+    <span wicket:id="usersearch">[USER SEARCH]</span>
+    <div class="searchResult">
+      <span wicket:id="searchResult">[USER SEARCH RESULT]</span>
     </div>
-</wicket:panel>
+  </wicket:panel>
 </html>
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/panels/MergeLinkedAccountsResourcesPanel.html b/client/console/src/main/resources/org/apache/syncope/client/console/wizards/any/MergeLinkedAccountsResourcesPanel.html
similarity index 100%
rename from client/console/src/main/resources/org/apache/syncope/client/console/panels/MergeLinkedAccountsResourcesPanel.html
rename to client/console/src/main/resources/org/apache/syncope/client/console/wizards/any/MergeLinkedAccountsResourcesPanel.html
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/panels/MergeLinkedAccountsResourcesPanel.properties b/client/console/src/main/resources/org/apache/syncope/client/console/wizards/any/MergeLinkedAccountsResourcesPanel.properties
similarity index 100%
rename from client/console/src/main/resources/org/apache/syncope/client/console/panels/MergeLinkedAccountsResourcesPanel.properties
rename to client/console/src/main/resources/org/apache/syncope/client/console/wizards/any/MergeLinkedAccountsResourcesPanel.properties
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/panels/MergeLinkedAccountsResourcesPanel_fr_CA.properties b/client/console/src/main/resources/org/apache/syncope/client/console/wizards/any/MergeLinkedAccountsResourcesPanel_fr_CA.properties
similarity index 100%
rename from client/console/src/main/resources/org/apache/syncope/client/console/panels/MergeLinkedAccountsResourcesPanel_fr_CA.properties
rename to client/console/src/main/resources/org/apache/syncope/client/console/wizards/any/MergeLinkedAccountsResourcesPanel_fr_CA.properties
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/panels/MergeLinkedAccountsResourcesPanel_it.properties b/client/console/src/main/resources/org/apache/syncope/client/console/wizards/any/MergeLinkedAccountsResourcesPanel_it.properties
similarity index 100%
rename from client/console/src/main/resources/org/apache/syncope/client/console/panels/MergeLinkedAccountsResourcesPanel_it.properties
rename to client/console/src/main/resources/org/apache/syncope/client/console/wizards/any/MergeLinkedAccountsResourcesPanel_it.properties
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/panels/MergeLinkedAccountsResourcesPanel_ja.properties b/client/console/src/main/resources/org/apache/syncope/client/console/wizards/any/MergeLinkedAccountsResourcesPanel_ja.properties
similarity index 100%
rename from client/console/src/main/resources/org/apache/syncope/client/console/panels/MergeLinkedAccountsResourcesPanel_ja.properties
rename to client/console/src/main/resources/org/apache/syncope/client/console/wizards/any/MergeLinkedAccountsResourcesPanel_ja.properties
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/panels/MergeLinkedAccountsResourcesPanel_pt_BR.properties b/client/console/src/main/resources/org/apache/syncope/client/console/wizards/any/MergeLinkedAccountsResourcesPanel_pt_BR.properties
similarity index 100%
rename from client/console/src/main/resources/org/apache/syncope/client/console/panels/MergeLinkedAccountsResourcesPanel_pt_BR.properties
rename to client/console/src/main/resources/org/apache/syncope/client/console/wizards/any/MergeLinkedAccountsResourcesPanel_pt_BR.properties
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/panels/MergeLinkedAccountsResourcesPanel_ru.properties b/client/console/src/main/resources/org/apache/syncope/client/console/wizards/any/MergeLinkedAccountsResourcesPanel_ru.properties
similarity index 100%
rename from client/console/src/main/resources/org/apache/syncope/client/console/panels/MergeLinkedAccountsResourcesPanel_ru.properties
rename to client/console/src/main/resources/org/apache/syncope/client/console/wizards/any/MergeLinkedAccountsResourcesPanel_ru.properties
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/panels/MergeLinkedAccountsReviewPanel.html b/client/console/src/main/resources/org/apache/syncope/client/console/wizards/any/MergeLinkedAccountsReviewPanel.html
similarity index 100%
rename from client/console/src/main/resources/org/apache/syncope/client/console/panels/MergeLinkedAccountsReviewPanel.html
rename to client/console/src/main/resources/org/apache/syncope/client/console/wizards/any/MergeLinkedAccountsReviewPanel.html
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/panels/MergeLinkedAccountsReviewPanel.properties b/client/console/src/main/resources/org/apache/syncope/client/console/wizards/any/MergeLinkedAccountsReviewPanel.properties
similarity index 100%
rename from client/console/src/main/resources/org/apache/syncope/client/console/panels/MergeLinkedAccountsReviewPanel.properties
rename to client/console/src/main/resources/org/apache/syncope/client/console/wizards/any/MergeLinkedAccountsReviewPanel.properties
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/panels/MergeLinkedAccountsReviewPanel_fr_CA.properties b/client/console/src/main/resources/org/apache/syncope/client/console/wizards/any/MergeLinkedAccountsReviewPanel_fr_CA.properties
similarity index 100%
rename from client/console/src/main/resources/org/apache/syncope/client/console/panels/MergeLinkedAccountsReviewPanel_fr_CA.properties
rename to client/console/src/main/resources/org/apache/syncope/client/console/wizards/any/MergeLinkedAccountsReviewPanel_fr_CA.properties
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/panels/MergeLinkedAccountsReviewPanel_it.properties b/client/console/src/main/resources/org/apache/syncope/client/console/wizards/any/MergeLinkedAccountsReviewPanel_it.properties
similarity index 100%
rename from client/console/src/main/resources/org/apache/syncope/client/console/panels/MergeLinkedAccountsReviewPanel_it.properties
rename to client/console/src/main/resources/org/apache/syncope/client/console/wizards/any/MergeLinkedAccountsReviewPanel_it.properties
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/panels/MergeLinkedAccountsReviewPanel_ja.properties b/client/console/src/main/resources/org/apache/syncope/client/console/wizards/any/MergeLinkedAccountsReviewPanel_ja.properties
similarity index 100%
rename from client/console/src/main/resources/org/apache/syncope/client/console/panels/MergeLinkedAccountsReviewPanel_ja.properties
rename to client/console/src/main/resources/org/apache/syncope/client/console/wizards/any/MergeLinkedAccountsReviewPanel_ja.properties
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/panels/MergeLinkedAccountsReviewPanel_pt_BR.properties b/client/console/src/main/resources/org/apache/syncope/client/console/wizards/any/MergeLinkedAccountsReviewPanel_pt_BR.properties
similarity index 100%
rename from client/console/src/main/resources/org/apache/syncope/client/console/panels/MergeLinkedAccountsReviewPanel_pt_BR.properties
rename to client/console/src/main/resources/org/apache/syncope/client/console/wizards/any/MergeLinkedAccountsReviewPanel_pt_BR.properties
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/panels/MergeLinkedAccountsReviewPanel_ru.properties b/client/console/src/main/resources/org/apache/syncope/client/console/wizards/any/MergeLinkedAccountsReviewPanel_ru.properties
similarity index 100%
rename from client/console/src/main/resources/org/apache/syncope/client/console/panels/MergeLinkedAccountsReviewPanel_ru.properties
rename to client/console/src/main/resources/org/apache/syncope/client/console/wizards/any/MergeLinkedAccountsReviewPanel_ru.properties
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/panels/MergeLinkedAccountsSearchPanel.html b/client/console/src/main/resources/org/apache/syncope/client/console/wizards/any/MergeLinkedAccountsSearchPanel.html
similarity index 100%
rename from client/console/src/main/resources/org/apache/syncope/client/console/panels/MergeLinkedAccountsSearchPanel.html
rename to client/console/src/main/resources/org/apache/syncope/client/console/wizards/any/MergeLinkedAccountsSearchPanel.html
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/panels/MergeLinkedAccountsSearchPanel.properties b/client/console/src/main/resources/org/apache/syncope/client/console/wizards/any/MergeLinkedAccountsSearchPanel.properties
similarity index 100%
rename from client/console/src/main/resources/org/apache/syncope/client/console/panels/MergeLinkedAccountsSearchPanel.properties
rename to client/console/src/main/resources/org/apache/syncope/client/console/wizards/any/MergeLinkedAccountsSearchPanel.properties
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/panels/MergeLinkedAccountsSearchPanel_fr_CA.properties b/client/console/src/main/resources/org/apache/syncope/client/console/wizards/any/MergeLinkedAccountsSearchPanel_fr_CA.properties
similarity index 100%
rename from client/console/src/main/resources/org/apache/syncope/client/console/panels/MergeLinkedAccountsSearchPanel_fr_CA.properties
rename to client/console/src/main/resources/org/apache/syncope/client/console/wizards/any/MergeLinkedAccountsSearchPanel_fr_CA.properties
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/panels/MergeLinkedAccountsSearchPanel_it.properties b/client/console/src/main/resources/org/apache/syncope/client/console/wizards/any/MergeLinkedAccountsSearchPanel_it.properties
similarity index 100%
rename from client/console/src/main/resources/org/apache/syncope/client/console/panels/MergeLinkedAccountsSearchPanel_it.properties
rename to client/console/src/main/resources/org/apache/syncope/client/console/wizards/any/MergeLinkedAccountsSearchPanel_it.properties
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/panels/MergeLinkedAccountsSearchPanel_ja.properties b/client/console/src/main/resources/org/apache/syncope/client/console/wizards/any/MergeLinkedAccountsSearchPanel_ja.properties
similarity index 100%
rename from client/console/src/main/resources/org/apache/syncope/client/console/panels/MergeLinkedAccountsSearchPanel_ja.properties
rename to client/console/src/main/resources/org/apache/syncope/client/console/wizards/any/MergeLinkedAccountsSearchPanel_ja.properties
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/panels/MergeLinkedAccountsSearchPanel_pt_BR.properties b/client/console/src/main/resources/org/apache/syncope/client/console/wizards/any/MergeLinkedAccountsSearchPanel_pt_BR.properties
similarity index 100%
rename from client/console/src/main/resources/org/apache/syncope/client/console/panels/MergeLinkedAccountsSearchPanel_pt_BR.properties
rename to client/console/src/main/resources/org/apache/syncope/client/console/wizards/any/MergeLinkedAccountsSearchPanel_pt_BR.properties
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/panels/MergeLinkedAccountsSearchPanel_ru.properties b/client/console/src/main/resources/org/apache/syncope/client/console/wizards/any/MergeLinkedAccountsSearchPanel_ru.properties
similarity index 100%
rename from client/console/src/main/resources/org/apache/syncope/client/console/panels/MergeLinkedAccountsSearchPanel_ru.properties
rename to client/console/src/main/resources/org/apache/syncope/client/console/wizards/any/MergeLinkedAccountsSearchPanel_ru.properties
diff --git a/client/console/src/test/java/org/apache/syncope/client/console/AbstractTest.java b/client/console/src/test/java/org/apache/syncope/client/console/AbstractTest.java
index 4b81f7b..2d17637 100644
--- a/client/console/src/test/java/org/apache/syncope/client/console/AbstractTest.java
+++ b/client/console/src/test/java/org/apache/syncope/client/console/AbstractTest.java
@@ -31,7 +31,7 @@ import java.util.List;
 import java.util.Properties;
 import java.util.stream.Stream;
 import javax.servlet.ServletContext;
-import org.apache.commons.lang3.tuple.Pair;
+import org.apache.commons.lang3.tuple.Triple;
 import org.apache.cxf.jaxrs.client.Client;
 import org.apache.syncope.client.console.init.ClassPathScanImplementationLookup;
 import org.apache.syncope.client.console.init.ConsoleInitializer;
@@ -163,7 +163,7 @@ public abstract class AbstractTest {
         public SyncopeClientFactoryBean newClientFactory() {
             SyncopeClient client = mock(SyncopeClient.class);
 
-            when(client.self()).thenReturn(Pair.of(new HashMap<>(), getUserTO()));
+            when(client.self()).thenReturn(Triple.of(new HashMap<>(), Collections.emptyList(), getUserTO()));
 
             SyncopeService syncopeService = getSyncopeService();
             when(client.getService(SyncopeService.class)).thenReturn(syncopeService);
diff --git a/client/lib/src/main/java/org/apache/syncope/client/lib/AnonymousAuthenticationHandler.java b/client/lib/src/main/java/org/apache/syncope/client/lib/AnonymousAuthenticationHandler.java
index b34be66..59345bd 100644
--- a/client/lib/src/main/java/org/apache/syncope/client/lib/AnonymousAuthenticationHandler.java
+++ b/client/lib/src/main/java/org/apache/syncope/client/lib/AnonymousAuthenticationHandler.java
@@ -26,5 +26,4 @@ public class AnonymousAuthenticationHandler extends BasicAuthenticationHandler i
     public AnonymousAuthenticationHandler(final String username, final String password) {
         super(username, password);
     }
-
 }
diff --git a/client/lib/src/main/java/org/apache/syncope/client/lib/BasicAuthenticationHandler.java b/client/lib/src/main/java/org/apache/syncope/client/lib/BasicAuthenticationHandler.java
index ff1452e..94a1f6a 100644
--- a/client/lib/src/main/java/org/apache/syncope/client/lib/BasicAuthenticationHandler.java
+++ b/client/lib/src/main/java/org/apache/syncope/client/lib/BasicAuthenticationHandler.java
@@ -39,5 +39,4 @@ public class BasicAuthenticationHandler implements AuthenticationHandler {
     public String getPassword() {
         return password;
     }
-
 }
diff --git a/client/lib/src/main/java/org/apache/syncope/client/lib/SyncopeClient.java b/client/lib/src/main/java/org/apache/syncope/client/lib/SyncopeClient.java
index 3666d11..1c72fea 100644
--- a/client/lib/src/main/java/org/apache/syncope/client/lib/SyncopeClient.java
+++ b/client/lib/src/main/java/org/apache/syncope/client/lib/SyncopeClient.java
@@ -31,7 +31,7 @@ import javax.ws.rs.core.EntityTag;
 import javax.ws.rs.core.HttpHeaders;
 import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.Response;
-import org.apache.commons.lang3.tuple.Pair;
+import org.apache.commons.lang3.tuple.Triple;
 import org.apache.cxf.configuration.jsse.TLSClientParameters;
 import org.apache.cxf.jaxrs.client.Client;
 import org.apache.cxf.jaxrs.client.ClientConfiguration;
@@ -119,7 +119,9 @@ public class SyncopeClient {
             restClientFactory.setPassword(((BasicAuthenticationHandler) handler).getPassword());
 
             String jwt = getService(AccessTokenService.class).login().getHeaderString(RESTHeaders.TOKEN);
-            restClientFactory.getHeaders().put(HttpHeaders.AUTHORIZATION, Collections.singletonList("Bearer " + jwt));
+            restClientFactory.getHeaders().put(
+                    HttpHeaders.AUTHORIZATION,
+                    Collections.singletonList("Bearer " + jwt));
 
             restClientFactory.setUsername(null);
             restClientFactory.setPassword(null);
@@ -132,11 +134,27 @@ public class SyncopeClient {
 
     protected void cleanup() {
         restClientFactory.getHeaders().remove(HttpHeaders.AUTHORIZATION);
+        restClientFactory.getHeaders().remove(RESTHeaders.DELEGATED_BY);
         restClientFactory.setUsername(null);
         restClientFactory.setPassword(null);
     }
 
     /**
+     * Requests to invoke services as delegating user.
+     *
+     * @param delegating delegating username
+     * @return this instance, for fluent usage
+     */
+    public SyncopeClient delegatedBy(final String delegating) {
+        if (delegating == null) {
+            restClientFactory.getHeaders().remove(RESTHeaders.DELEGATED_BY);
+        } else {
+            restClientFactory.getHeaders().put(RESTHeaders.DELEGATED_BY, Collections.singletonList(delegating));
+        }
+        return this;
+    }
+
+    /**
      * Attempts to extend the lifespan of the JWT currently in use.
      */
     public void refresh() {
@@ -272,7 +290,7 @@ public class SyncopeClient {
         }
     }
 
-    public Pair<Map<String, Set<String>>, UserTO> self() {
+    public Triple<Map<String, Set<String>>, List<String>, UserTO> self() {
         // Explicitly disable header value split because it interferes with JSON deserialization below
         UserSelfService service = getService(UserSelfService.class);
         WebClient.getConfig(WebClient.client(service)).getRequestContext().put(HEADER_SPLIT_PROPERTY, false);
@@ -286,11 +304,15 @@ public class SyncopeClient {
         }
 
         try {
-            return Pair.of(
+            return Triple.of(
                     OBJECT_MAPPER.readValue(
                             response.getHeaderString(RESTHeaders.OWNED_ENTITLEMENTS),
                             new TypeReference<Map<String, Set<String>>>() {
                     }),
+                    OBJECT_MAPPER.readValue(
+                            response.getHeaderString(RESTHeaders.DELEGATIONS),
+                            new TypeReference<List<String>>() {
+                    }),
                     response.readEntity(UserTO.class));
         } catch (IOException e) {
             throw new IllegalStateException(e);
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/to/AbstractStartEndBean.java b/common/lib/src/main/java/org/apache/syncope/common/lib/to/AbstractStartEndBean.java
index 29e60c4..85d3ab8 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/to/AbstractStartEndBean.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/to/AbstractStartEndBean.java
@@ -27,7 +27,7 @@ import org.apache.commons.lang3.builder.HashCodeBuilder;
 import org.apache.syncope.common.lib.BaseBean;
 
 @XmlType
-@XmlSeeAlso({ ExecTO.class, ReportTO.class, TaskTO.class })
+@XmlSeeAlso({ ExecTO.class, ReportTO.class, TaskTO.class, DelegationTO.class })
 public class AbstractStartEndBean extends BaseBean {
 
     private static final long serialVersionUID = 2399577415544539917L;
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/to/ExecTO.java b/common/lib/src/main/java/org/apache/syncope/common/lib/to/DelegationTO.java
similarity index 52%
copy from common/lib/src/main/java/org/apache/syncope/common/lib/to/ExecTO.java
copy to common/lib/src/main/java/org/apache/syncope/common/lib/to/DelegationTO.java
index 7ff6e99..322bc98 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/to/ExecTO.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/to/DelegationTO.java
@@ -18,78 +18,78 @@
  */
 package org.apache.syncope.common.lib.to;
 
+import com.fasterxml.jackson.annotation.JsonProperty;
+import io.swagger.v3.oas.annotations.media.Schema;
+import java.util.Date;
+import java.util.HashSet;
+import java.util.Set;
+import javax.ws.rs.PathParam;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlElementWrapper;
 import javax.xml.bind.annotation.XmlRootElement;
 import javax.xml.bind.annotation.XmlType;
 import org.apache.commons.lang3.builder.EqualsBuilder;
 import org.apache.commons.lang3.builder.HashCodeBuilder;
-import org.apache.syncope.common.lib.types.JobType;
 
-@XmlRootElement(name = "exec")
-@XmlType()
-public class ExecTO extends AbstractStartEndBean implements EntityTO {
+@XmlRootElement(name = "delegation")
+@XmlType
+public class DelegationTO extends AbstractStartEndBean implements EntityTO {
 
-    private static final long serialVersionUID = -4621191979198357081L;
+    private static final long serialVersionUID = 18031949556054L;
 
     private String key;
 
-    private JobType jobType;
+    private String delegating;
 
-    private String refKey;
+    private String delegated;
 
-    private String refDesc;
-
-    private String status;
-
-    private String message;
+    private final Set<String> roles = new HashSet<>();
 
+    @Schema(accessMode = Schema.AccessMode.READ_ONLY)
     @Override
     public String getKey() {
         return key;
     }
 
+    @PathParam("key")
     @Override
     public void setKey(final String key) {
         this.key = key;
     }
 
-    public JobType getJobType() {
-        return jobType;
-    }
-
-    public void setJobType(final JobType jobType) {
-        this.jobType = jobType;
-    }
-
-    public String getRefKey() {
-        return refKey;
-    }
-
-    public void setRefKey(final String refKey) {
-        this.refKey = refKey;
+    public String getDelegating() {
+        return delegating;
     }
 
-    public String getRefDesc() {
-        return refDesc;
+    public void setDelegating(final String delegating) {
+        this.delegating = delegating;
     }
 
-    public void setRefDesc(final String refDesc) {
-        this.refDesc = refDesc;
+    public String getDelegated() {
+        return delegated;
     }
 
-    public String getMessage() {
-        return message;
+    public void setDelegated(final String delegated) {
+        this.delegated = delegated;
     }
 
-    public void setMessage(final String message) {
-        this.message = message;
+    @XmlElementWrapper(name = "roles")
+    @XmlElement(name = "role")
+    @JsonProperty("roles")
+    public Set<String> getRoles() {
+        return roles;
     }
 
-    public String getStatus() {
-        return status;
+    @Schema(accessMode = Schema.AccessMode.READ_WRITE)
+    @Override
+    public Date getStart() {
+        return super.getStart();
     }
 
-    public void setStatus(final String status) {
-        this.status = status;
+    @Schema(accessMode = Schema.AccessMode.READ_WRITE)
+    @Override
+    public Date getEnd() {
+        return super.getEnd();
     }
 
     @Override
@@ -97,11 +97,9 @@ public class ExecTO extends AbstractStartEndBean implements EntityTO {
         return new HashCodeBuilder().
                 appendSuper(super.hashCode()).
                 append(key).
-                append(jobType).
-                append(refKey).
-                append(refDesc).
-                append(status).
-                append(message).
+                append(delegating).
+                append(delegated).
+                append(roles).
                 build();
     }
 
@@ -116,15 +114,13 @@ public class ExecTO extends AbstractStartEndBean implements EntityTO {
         if (getClass() != obj.getClass()) {
             return false;
         }
-        final ExecTO other = (ExecTO) obj;
+        final DelegationTO other = (DelegationTO) obj;
         return new EqualsBuilder().
                 appendSuper(super.equals(obj)).
                 append(key, other.key).
-                append(jobType, other.jobType).
-                append(refKey, other.refKey).
-                append(refDesc, other.refDesc).
-                append(status, other.status).
-                append(message, other.message).
+                append(delegating, other.delegating).
+                append(delegated, other.delegated).
+                append(roles, other.roles).
                 build();
     }
 }
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/to/ExecTO.java b/common/lib/src/main/java/org/apache/syncope/common/lib/to/ExecTO.java
index 7ff6e99..dffa5f1 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/to/ExecTO.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/to/ExecTO.java
@@ -25,7 +25,7 @@ import org.apache.commons.lang3.builder.HashCodeBuilder;
 import org.apache.syncope.common.lib.types.JobType;
 
 @XmlRootElement(name = "exec")
-@XmlType()
+@XmlType
 public class ExecTO extends AbstractStartEndBean implements EntityTO {
 
     private static final long serialVersionUID = -4621191979198357081L;
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/to/UserTO.java b/common/lib/src/main/java/org/apache/syncope/common/lib/to/UserTO.java
index 87c028e..5c3d17b 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/to/UserTO.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/to/UserTO.java
@@ -78,6 +78,10 @@ public class UserTO extends AnyTO implements GroupableRelatableTO {
 
     private final List<LinkedAccountTO> linkedAccounts = new ArrayList<>();
 
+    private final List<String> delegatingDelegations = new ArrayList<>();
+
+    private final List<String> delegatedDelegations = new ArrayList<>();
+
     @JsonProperty("@class")
     @Schema(name = "@class", required = true, example = "org.apache.syncope.common.lib.to.UserTO")
     @Override
@@ -281,6 +285,22 @@ public class UserTO extends AnyTO implements GroupableRelatableTO {
         return linkedAccounts;
     }
 
+    @Schema(accessMode = Schema.AccessMode.READ_ONLY)
+    @XmlElementWrapper(name = "delegatingDelegations")
+    @XmlElement(name = "delegatingDelegation")
+    @JsonProperty("delegatingDelegations")
+    public List<String> getDelegatingDelegations() {
+        return delegatingDelegations;
+    }
+
+    @Schema(accessMode = Schema.AccessMode.READ_ONLY)
+    @XmlElementWrapper(name = "delegatedDelegations")
+    @XmlElement(name = "delegatedDelegation")
+    @JsonProperty("delegatedDelegations")
+    public List<String> getDelegatedDelegations() {
+        return delegatedDelegations;
+    }
+
     @Override
     public int hashCode() {
         return new HashCodeBuilder().
@@ -302,6 +322,8 @@ public class UserTO extends AnyTO implements GroupableRelatableTO {
                 append(memberships).
                 append(dynMemberships).
                 append(linkedAccounts).
+                append(delegatingDelegations).
+                append(delegatedDelegations).
                 build();
     }
 
@@ -336,6 +358,8 @@ public class UserTO extends AnyTO implements GroupableRelatableTO {
                 append(memberships, other.memberships).
                 append(dynMemberships, other.dynMemberships).
                 append(linkedAccounts, other.linkedAccounts).
+                append(delegatingDelegations, other.delegatingDelegations).
+                append(delegatedDelegations, other.delegatedDelegations).
                 build();
     }
 }
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/types/StandardEntitlement.java b/common/lib/src/main/java/org/apache/syncope/common/lib/types/StandardEntitlement.java
index a68c69f..bc69d7e 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/types/StandardEntitlement.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/types/StandardEntitlement.java
@@ -280,6 +280,16 @@ public final class StandardEntitlement {
 
     public static final String REMEDIATION_DELETE = "REMEDIATION_DELETE";
 
+    public static final String DELEGATION_LIST = "DELEGATION_LIST";
+
+    public static final String DELEGATION_CREATE = "DELEGATION_CREATE";
+
+    public static final String DELEGATION_READ = "DELEGATION_READ";
+
+    public static final String DELEGATION_UPDATE = "DELEGATION_UPDATE";
+
+    public static final String DELEGATION_DELETE = "DELEGATION_DELETE";
+
     private static final Set<String> VALUES;
 
     static {
diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/RESTHeaders.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/RESTHeaders.java
index b5f67c6..39bb52a 100644
--- a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/RESTHeaders.java
+++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/RESTHeaders.java
@@ -33,6 +33,10 @@ public final class RESTHeaders {
 
     public static final String OWNED_ENTITLEMENTS = "X-Syncope-Entitlements";
 
+    public static final String DELEGATED_BY = "X-Syncope-Delegated-By";
+
+    public static final String DELEGATIONS = "X-Syncope-Delegations";
+
     public static final String RESOURCE_KEY = "X-Syncope-Key";
 
     public static final String CONNOBJECT_KEY = "X-Syncope-ConnObject-Key";
diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/beans/AuditQuery.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/beans/AuditQuery.java
index 5992024..71814c3 100644
--- a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/beans/AuditQuery.java
+++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/beans/AuditQuery.java
@@ -34,16 +34,16 @@ public class AuditQuery extends AbstractQuery {
 
     public static class Builder extends AbstractQuery.Builder<AuditQuery, Builder> {
 
-        public Builder(final String entityKey) {
-            super();
-            getInstance().setEntityKey(entityKey);
-        }
-
         @Override
         protected AuditQuery newInstance() {
             return new AuditQuery();
         }
 
+        public Builder entityKey(final String entityKey) {
+            getInstance().setEntityKey(entityKey);
+            return this;
+        }
+
         public Builder type(final AuditElements.EventCategoryType type) {
             getInstance().setType(type);
             return this;
diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/DelegationService.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/DelegationService.java
new file mode 100644
index 0000000..f1e1854
--- /dev/null
+++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/DelegationService.java
@@ -0,0 +1,122 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.syncope.common.rest.api.service;
+
+import io.swagger.v3.oas.annotations.Parameter;
+import io.swagger.v3.oas.annotations.enums.ParameterIn;
+import io.swagger.v3.oas.annotations.headers.Header;
+import io.swagger.v3.oas.annotations.media.Schema;
+import io.swagger.v3.oas.annotations.responses.ApiResponse;
+import io.swagger.v3.oas.annotations.responses.ApiResponses;
+import io.swagger.v3.oas.annotations.security.SecurityRequirement;
+import io.swagger.v3.oas.annotations.security.SecurityRequirements;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import java.util.List;
+import javax.validation.constraints.NotNull;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.PUT;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.HttpHeaders;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import org.apache.syncope.common.lib.to.DelegationTO;
+import org.apache.syncope.common.rest.api.RESTHeaders;
+
+/**
+ * REST operations for delegations.
+ */
+@Tag(name = "Delegations")
+@SecurityRequirements({
+    @SecurityRequirement(name = "BasicAuthentication"),
+    @SecurityRequirement(name = "Bearer") })
+@Path("delegations")
+public interface DelegationService extends JAXRSService {
+
+    /**
+     * Returns a list of all delegations.
+     *
+     * @return list of all delegations.
+     */
+    @GET
+    @Produces({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML })
+    List<DelegationTO> list();
+
+    /**
+     * Returns delegation with matching key.
+     *
+     * @param key delegation key to be read
+     * @return delegation with matching key
+     */
+    @GET
+    @Path("{key}")
+    @Produces({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML })
+    DelegationTO read(@NotNull @PathParam("key") String key);
+
+    /**
+     * Creates a new delegation.
+     *
+     * @param delegationTO delegation to be created
+     * @return Response object featuring Location header of created delegation
+     */
+    @ApiResponses(
+            @ApiResponse(responseCode = "201",
+                    description = "Delegation successfully created", headers = {
+                @Header(name = RESTHeaders.RESOURCE_KEY, schema =
+                        @Schema(type = "string"),
+                        description = "Key value for the entity created"),
+                @Header(name = HttpHeaders.LOCATION, schema =
+                        @Schema(type = "string"),
+                        description = "URL of the entity created") }))
+    @POST
+    @Consumes({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML })
+    @Produces({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML })
+    Response create(@NotNull DelegationTO delegationTO);
+
+    /**
+     * Updates the delegation matching the provided key.
+     *
+     * @param delegationTO delegation to be stored
+     */
+    @Parameter(name = "key", description = "Delegation's key", in = ParameterIn.PATH, schema =
+            @Schema(type = "string"))
+    @ApiResponses(
+            @ApiResponse(responseCode = "204", description = "Operation was successful"))
+    @PUT
+    @Path("{key}")
+    @Consumes({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML })
+    @Produces({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML })
+    void update(@NotNull DelegationTO delegationTO);
+
+    /**
+     * Deletes the delegation matching the provided key.
+     *
+     * @param key delegation key to be deleted
+     */
+    @ApiResponses(
+            @ApiResponse(responseCode = "204", description = "Operation was successful"))
+    @DELETE
+    @Path("{key}")
+    @Produces({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML })
+    void delete(@NotNull @PathParam("key") String key);
+}
diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/UserSelfService.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/UserSelfService.java
index b655e8b..e793016 100644
--- a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/UserSelfService.java
+++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/UserSelfService.java
@@ -58,13 +58,14 @@ public interface UserSelfService extends JAXRSService {
     /**
      * Returns the user making the service call.
      *
-     * @return calling user data, including own UUID and entitlements
+     * @return calling user data, including own UUID, entitlements and delegations
      */
     @Operation(security = {
         @SecurityRequirement(name = "BasicAuthentication"),
         @SecurityRequirement(name = "Bearer") })
     @ApiResponses(
-            @ApiResponse(responseCode = "200", description = "Calling user data, including own UUID and entitlements",
+            @ApiResponse(responseCode = "200",
+                    description = "Calling user data, including own UUID, entitlements and delegations",
                     content =
                     @Content(schema =
                             @Schema(implementation = UserTO.class)), headers = {
diff --git a/core/logic/src/main/java/org/apache/syncope/core/logic/ApplicationLogic.java b/core/logic/src/main/java/org/apache/syncope/core/logic/ApplicationLogic.java
index 50495ca..c5f06c6 100644
--- a/core/logic/src/main/java/org/apache/syncope/core/logic/ApplicationLogic.java
+++ b/core/logic/src/main/java/org/apache/syncope/core/logic/ApplicationLogic.java
@@ -133,5 +133,4 @@ public class ApplicationLogic extends AbstractTransactionalLogic<ApplicationTO>
 
         throw new UnresolvedReferenceException();
     }
-
 }
diff --git a/core/logic/src/main/java/org/apache/syncope/core/logic/DelegationLogic.java b/core/logic/src/main/java/org/apache/syncope/core/logic/DelegationLogic.java
new file mode 100644
index 0000000..81ab982
--- /dev/null
+++ b/core/logic/src/main/java/org/apache/syncope/core/logic/DelegationLogic.java
@@ -0,0 +1,164 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.syncope.core.logic;
+
+import java.lang.reflect.Method;
+import java.util.List;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+import org.apache.commons.lang3.ArrayUtils;
+import org.apache.syncope.common.lib.SyncopeConstants;
+import org.apache.syncope.common.lib.to.DelegationTO;
+import org.apache.syncope.common.lib.types.AnyTypeKind;
+import org.apache.syncope.common.lib.types.StandardEntitlement;
+import org.apache.syncope.core.persistence.api.dao.DelegationDAO;
+import org.apache.syncope.core.persistence.api.dao.NotFoundException;
+import org.apache.syncope.core.persistence.api.dao.UserDAO;
+import org.apache.syncope.core.persistence.api.entity.Delegation;
+import org.apache.syncope.core.provisioning.api.data.DelegationDataBinder;
+import org.apache.syncope.core.spring.security.AuthContextUtils;
+import org.apache.syncope.core.spring.security.DelegatedAdministrationException;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.stereotype.Component;
+import org.springframework.transaction.annotation.Transactional;
+
+@Component
+public class DelegationLogic extends AbstractTransactionalLogic<DelegationTO> {
+
+    @Autowired
+    private DelegationDataBinder binder;
+
+    @Autowired
+    private DelegationDAO delegationDAO;
+
+    @Autowired
+    private UserDAO userDAO;
+
+    private void securityChecks(final String delegating, final String entitlement) {
+        if (!AuthContextUtils.getAuthorizations().keySet().contains(entitlement)
+                && (delegating == null || !delegating.equals(userDAO.findKey(AuthContextUtils.getUsername())))) {
+
+            throw new DelegatedAdministrationException(
+                    SyncopeConstants.ROOT_REALM, AnyTypeKind.USER.name(), delegating);
+        }
+    }
+
+    @PreAuthorize("isAuthenticated()")
+    @Transactional(readOnly = true)
+    public DelegationTO read(final String key) {
+        Delegation delegation = delegationDAO.find(key);
+        if (delegation == null) {
+            LOG.error("Could not find delegation '" + key + "'");
+            throw new NotFoundException(key);
+        }
+
+        securityChecks(delegation.getDelegating().getKey(), StandardEntitlement.DELEGATION_READ);
+
+        return binder.getDelegationTO(delegation);
+    }
+
+    @PreAuthorize("isAuthenticated()")
+    @Transactional(readOnly = true)
+    public List<DelegationTO> list() {
+        Stream<DelegationTO> delegations = delegationDAO.findAll().stream().map(binder::getDelegationTO);
+
+        if (!AuthContextUtils.getAuthorizations().keySet().contains(StandardEntitlement.DELEGATION_LIST)) {
+            String authUserKey = userDAO.findKey(AuthContextUtils.getUsername());
+            delegations = delegations.filter(delegation -> delegation.getDelegating().equals(authUserKey));
+        }
+
+        return delegations.collect(Collectors.toList());
+    }
+
+    @PreAuthorize("isAuthenticated()")
+    public DelegationTO create(final DelegationTO delegationTO) {
+        if (delegationTO.getDelegating() != null
+                && !SyncopeConstants.UUID_PATTERN.matcher(delegationTO.getDelegating()).matches()) {
+
+            delegationTO.setDelegating(userDAO.findKey(delegationTO.getDelegating()));
+        }
+        if (delegationTO.getDelegated() != null
+                && !SyncopeConstants.UUID_PATTERN.matcher(delegationTO.getDelegated()).matches()) {
+
+            delegationTO.setDelegated(userDAO.findKey(delegationTO.getDelegated()));
+        }
+
+        securityChecks(delegationTO.getDelegating(), StandardEntitlement.DELEGATION_CREATE);
+
+        return binder.getDelegationTO(delegationDAO.save(binder.create(delegationTO)));
+    }
+
+    @PreAuthorize("isAuthenticated()")
+    public DelegationTO update(final DelegationTO delegationTO) {
+        Delegation delegation = delegationDAO.find(delegationTO.getKey());
+        if (delegation == null) {
+            LOG.error("Could not find delegation '" + delegationTO.getKey() + "'");
+            throw new NotFoundException(delegationTO.getKey());
+        }
+
+        securityChecks(delegation.getDelegating().getKey(), StandardEntitlement.DELEGATION_UPDATE);
+
+        return binder.getDelegationTO(delegationDAO.save(binder.update(delegation, delegationTO)));
+    }
+
+    @PreAuthorize("isAuthenticated()")
+    public DelegationTO delete(final String key) {
+        Delegation delegation = delegationDAO.find(key);
+        if (delegation == null) {
+            LOG.error("Could not find delegation '" + key + "'");
+
+            throw new NotFoundException(key);
+        }
+
+        securityChecks(delegation.getDelegating().getKey(), StandardEntitlement.DELEGATION_DELETE);
+
+        DelegationTO deleted = binder.getDelegationTO(delegation);
+        delegationDAO.delete(key);
+        return deleted;
+    }
+
+    @Override
+    protected DelegationTO resolveReference(final Method method, final Object... args)
+            throws UnresolvedReferenceException {
+
+        String key = null;
+
+        if (ArrayUtils.isNotEmpty(args)) {
+            for (int i = 0; key == null && i < args.length; i++) {
+                if (args[i] instanceof String) {
+                    key = (String) args[i];
+                } else if (args[i] instanceof DelegationTO) {
+                    key = ((DelegationTO) args[i]).getKey();
+                }
+            }
+        }
+
+        if (key != null) {
+            try {
+                return binder.getDelegationTO(delegationDAO.find(key));
+            } catch (Throwable ignore) {
+                LOG.debug("Unresolved reference", ignore);
+                throw new UnresolvedReferenceException(ignore);
+            }
+        }
+
+        throw new UnresolvedReferenceException();
+    }
+}
diff --git a/core/logic/src/main/java/org/apache/syncope/core/logic/LoggerLogic.java b/core/logic/src/main/java/org/apache/syncope/core/logic/LoggerLogic.java
index e935a00..0938462 100644
--- a/core/logic/src/main/java/org/apache/syncope/core/logic/LoggerLogic.java
+++ b/core/logic/src/main/java/org/apache/syncope/core/logic/LoggerLogic.java
@@ -408,7 +408,7 @@ public class LoggerLogic extends AbstractTransactionalLogic<EntityTO> {
             final AuditElements.Result result,
             final List<OrderByClause> orderByClauses) {
 
-        int count = loggerDAO.countAuditEntries(entityKey);
+        int count = loggerDAO.countAuditEntries(entityKey, type, category, subcategory, events, result);
         List<AuditEntry> matching = loggerDAO.findAuditEntries(
                 entityKey, page, size, type, category, subcategory, events, result, orderByClauses);
         return Pair.of(count, matching);
diff --git a/core/logic/src/main/java/org/apache/syncope/core/logic/LogicInvocationHandler.java b/core/logic/src/main/java/org/apache/syncope/core/logic/LogicInvocationHandler.java
index f7c5fce..f1d4fd0 100644
--- a/core/logic/src/main/java/org/apache/syncope/core/logic/LogicInvocationHandler.java
+++ b/core/logic/src/main/java/org/apache/syncope/core/logic/LogicInvocationHandler.java
@@ -101,7 +101,7 @@ public class LogicInvocationHandler {
             if (notificationsAvailable || auditRequested) {
                 Map<String, Object> jobMap = new HashMap<>();
                 jobMap.put(AfterHandlingEvent.JOBMAP_KEY, new AfterHandlingEvent(
-                        AuthContextUtils.getUsername(),
+                        AuthContextUtils.getWho(),
                         AuditElements.EventCategoryType.LOGIC,
                         category,
                         null,
diff --git a/core/logic/src/main/java/org/apache/syncope/core/logic/UserLogic.java b/core/logic/src/main/java/org/apache/syncope/core/logic/UserLogic.java
index 90f0c0f..ad59396 100644
--- a/core/logic/src/main/java/org/apache/syncope/core/logic/UserLogic.java
+++ b/core/logic/src/main/java/org/apache/syncope/core/logic/UserLogic.java
@@ -27,6 +27,7 @@ import java.util.Set;
 import java.util.stream.Collectors;
 import org.apache.commons.lang3.ArrayUtils;
 import org.apache.commons.lang3.tuple.Pair;
+import org.apache.commons.lang3.tuple.Triple;
 import org.apache.syncope.common.lib.SyncopeClientException;
 import org.apache.syncope.common.lib.patch.BooleanReplacePatchItem;
 import org.apache.syncope.common.lib.patch.MembershipPatch;
@@ -45,6 +46,7 @@ import org.apache.syncope.common.lib.types.StandardEntitlement;
 import org.apache.syncope.core.persistence.api.dao.AccessTokenDAO;
 import org.apache.syncope.core.persistence.api.dao.AnySearchDAO;
 import org.apache.syncope.core.persistence.api.dao.ConfDAO;
+import org.apache.syncope.core.persistence.api.dao.DelegationDAO;
 import org.apache.syncope.core.persistence.api.dao.GroupDAO;
 import org.apache.syncope.core.persistence.api.dao.NotFoundException;
 import org.apache.syncope.core.persistence.api.dao.UserDAO;
@@ -86,6 +88,9 @@ public class UserLogic extends AbstractAnyLogic<UserTO, UserPatch> {
     protected AccessTokenDAO accessTokenDAO;
 
     @Autowired
+    protected DelegationDAO delegationDAO;
+
+    @Autowired
     protected UserDataBinder binder;
 
     @Autowired
@@ -96,10 +101,13 @@ public class UserLogic extends AbstractAnyLogic<UserTO, UserPatch> {
 
     @PreAuthorize("isAuthenticated() and not(hasRole('" + StandardEntitlement.MUST_CHANGE_PASSWORD + "'))")
     @Transactional(readOnly = true)
-    public Pair<String, UserTO> selfRead() {
-        return Pair.of(
+    public Triple<String, String, UserTO> selfRead() {
+        UserTO authenticatedUser = binder.getAuthenticatedUserTO();
+
+        return Triple.of(
                 POJOHelper.serialize(AuthContextUtils.getAuthorizations()),
-                binder.returnUserTO(binder.getAuthenticatedUserTO()));
+                POJOHelper.serialize(delegationDAO.findValidDelegating(authenticatedUser.getKey())),
+                binder.returnUserTO(authenticatedUser));
     }
 
     @PreAuthorize("hasRole('" + StandardEntitlement.USER_READ + "')")
diff --git a/client/lib/src/main/java/org/apache/syncope/client/lib/BasicAuthenticationHandler.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/DelegationDAO.java
similarity index 51%
copy from client/lib/src/main/java/org/apache/syncope/client/lib/BasicAuthenticationHandler.java
copy to core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/DelegationDAO.java
index ff1452e..09ac349 100644
--- a/client/lib/src/main/java/org/apache/syncope/client/lib/BasicAuthenticationHandler.java
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/DelegationDAO.java
@@ -16,28 +16,31 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.syncope.client.lib;
+package org.apache.syncope.core.persistence.api.dao;
 
-/**
- * Implementation providing Basic Authentication capability.
- */
-public class BasicAuthenticationHandler implements AuthenticationHandler {
+import java.util.List;
+import java.util.Optional;
+import org.apache.syncope.core.persistence.api.entity.Delegation;
+import org.apache.syncope.core.persistence.api.entity.Role;
+import org.apache.syncope.core.persistence.api.entity.user.User;
+
+public interface DelegationDAO extends DAO<Delegation> {
+
+    Delegation find(String key);
+
+    Optional<String> findValidFor(String delegating, String delegated);
+
+    List<String> findValidDelegating(String delegated);
 
-    private final String username;
+    List<Delegation> findByDelegating(User user);
 
-    private final String password;
+    List<Delegation> findByDelegated(User user);
 
-    public BasicAuthenticationHandler(final String username, final String password) {
-        this.username = username;
-        this.password = password;
-    }
+    List<Delegation> findByRole(Role role);
 
-    public String getUsername() {
-        return username;
-    }
+    List<Delegation> findAll();
 
-    public String getPassword() {
-        return password;
-    }
+    Delegation save(Delegation delegation);
 
+    void delete(String key);
 }
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/LoggerDAO.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/LoggerDAO.java
index e8cfe5a..0539ef3 100644
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/LoggerDAO.java
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/LoggerDAO.java
@@ -41,6 +41,14 @@ public interface LoggerDAO extends DAO<Logger> {
 
     void delete(Logger logger);
 
+    int countAuditEntries(
+            String entityKey,
+            AuditElements.EventCategoryType type,
+            String category,
+            String subcategory,
+            List<String> events,
+            AuditElements.Result result);
+
     List<AuditEntry> findAuditEntries(
             String entityKey,
             int page,
@@ -51,6 +59,4 @@ public interface LoggerDAO extends DAO<Logger> {
             List<String> events,
             AuditElements.Result result,
             List<OrderByClause> orderByClauses);
-
-    int countAuditEntries(String entityKey);
 }
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/UserDAO.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/UserDAO.java
index 471182d..98302bf 100644
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/UserDAO.java
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/UserDAO.java
@@ -46,6 +46,8 @@ public interface UserDAO extends AnyDAO<User> {
      */
     void securityChecks(Set<String> authRealms, String key, String realm, Collection<String> groups);
 
+    Optional<String> findUsername(String key);
+
     Map<String, Integer> countByRealm();
 
     Map<String, Integer> countByStatus();
diff --git a/core/spring/src/main/java/org/apache/syncope/core/spring/security/SyncopeAuthenticationDetailsSource.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/Delegation.java
similarity index 61%
copy from core/spring/src/main/java/org/apache/syncope/core/spring/security/SyncopeAuthenticationDetailsSource.java
copy to core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/Delegation.java
index 0b2b27c..07c34c5 100644
--- a/core/spring/src/main/java/org/apache/syncope/core/spring/security/SyncopeAuthenticationDetailsSource.java
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/Delegation.java
@@ -16,17 +16,31 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.syncope.core.spring.security;
+package org.apache.syncope.core.persistence.api.entity;
 
-import javax.servlet.http.HttpServletRequest;
-import org.springframework.security.authentication.AuthenticationDetailsSource;
+import java.util.Date;
+import java.util.Set;
+import org.apache.syncope.core.persistence.api.entity.user.User;
 
-public class SyncopeAuthenticationDetailsSource
-        implements AuthenticationDetailsSource<HttpServletRequest, SyncopeAuthenticationDetails> {
+public interface Delegation extends Entity {
 
-    @Override
-    public SyncopeAuthenticationDetails buildDetails(final HttpServletRequest context) {
-        return new SyncopeAuthenticationDetails(context);
-    }
+    User getDelegating();
 
+    void setDelegating(User delegating);
+
+    User getDelegated();
+
+    void setDelegated(User delegated);
+
+    void setStart(Date start);
+
+    Date getStart();
+
+    void setEnd(Date end);
+
+    Date getEnd();
+
+    boolean add(Role role);
+
+    Set<? extends Role> getRoles();
 }
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPADelegationDAO.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPADelegationDAO.java
new file mode 100644
index 0000000..d22842a
--- /dev/null
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPADelegationDAO.java
@@ -0,0 +1,118 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.syncope.core.persistence.jpa.dao;
+
+import java.util.Date;
+import java.util.List;
+import java.util.Optional;
+import java.util.stream.Collectors;
+import javax.persistence.TypedQuery;
+import org.apache.syncope.core.persistence.api.dao.DelegationDAO;
+import org.apache.syncope.core.persistence.api.entity.Delegation;
+import org.apache.syncope.core.persistence.api.entity.Role;
+import org.apache.syncope.core.persistence.api.entity.user.User;
+import org.apache.syncope.core.persistence.jpa.entity.JPADelegation;
+import org.springframework.stereotype.Repository;
+
+@Repository
+public class JPADelegationDAO extends AbstractDAO<Delegation> implements DelegationDAO {
+
+    @Override
+    public Delegation find(final String key) {
+        return entityManager().find(JPADelegation.class, key);
+    }
+
+    @Override
+    public Optional<String> findValidFor(final String delegating, final String delegated) {
+        TypedQuery<Delegation> query = entityManager().createQuery(
+                "SELECT e FROM " + JPADelegation.class.getSimpleName() + " e "
+                + "WHERE e.delegating.id=:delegating AND e.delegated.id=:delegated "
+                + "AND e.start <= :now AND (e.end IS NULL OR e.end >= :now)", Delegation.class);
+        query.setParameter("delegating", delegating);
+        query.setParameter("delegated", delegated);
+        query.setParameter("now", new Date());
+        query.setMaxResults(1);
+
+        List<Delegation> raw = query.getResultList();
+        return raw.isEmpty() ? Optional.empty() : Optional.of(raw.get(0).getKey());
+    }
+
+    @Override
+    public List<String> findValidDelegating(final String delegated) {
+        TypedQuery<Delegation> query = entityManager().createQuery(
+                "SELECT e FROM " + JPADelegation.class.getSimpleName() + " e "
+                + "WHERE e.delegated.id=:delegated "
+                + "AND e.start <= :now AND (e.end IS NULL OR e.end >= :now)", Delegation.class);
+        query.setParameter("delegated", delegated);
+        query.setParameter("now", new Date());
+
+        return query.getResultList().stream().
+                map(delegation -> delegation.getDelegating().getUsername()).
+                collect(Collectors.toList());
+    }
+
+    @Override
+    public List<Delegation> findByDelegating(final User user) {
+        TypedQuery<Delegation> query = entityManager().createQuery(
+                "SELECT e FROM " + JPADelegation.class.getSimpleName() + " e "
+                + "WHERE e.delegating=:user", Delegation.class);
+        query.setParameter("user", user);
+        return query.getResultList();
+    }
+
+    @Override
+    public List<Delegation> findByDelegated(final User user) {
+        TypedQuery<Delegation> query = entityManager().createQuery(
+                "SELECT e FROM " + JPADelegation.class.getSimpleName() + " e "
+                + "WHERE e.delegated=:user", Delegation.class);
+        query.setParameter("user", user);
+        return query.getResultList();
+    }
+
+    @Override
+    public List<Delegation> findByRole(final Role role) {
+        TypedQuery<Delegation> query = entityManager().createQuery(
+                "SELECT e FROM " + JPADelegation.class.getSimpleName() + " e "
+                + "WHERE :role MEMBER OF e.roles", Delegation.class);
+        query.setParameter("role", role);
+        return query.getResultList();
+    }
+
+    @Override
+    public List<Delegation> findAll() {
+        TypedQuery<Delegation> query = entityManager().createQuery(
+                "SELECT e FROM " + JPADelegation.class.getSimpleName() + " e ", Delegation.class);
+        return query.getResultList();
+    }
+
+    @Override
+    public Delegation save(final Delegation delegation) {
+        return entityManager().merge(delegation);
+    }
+
+    @Override
+    public void delete(final String key) {
+        Delegation delegation = find(key);
+        if (delegation == null) {
+            return;
+        }
+
+        entityManager().remove(delegation);
+    }
+}
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPALoggerDAO.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPALoggerDAO.java
index 6e85952..a2f44dd 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPALoggerDAO.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPALoggerDAO.java
@@ -43,15 +43,21 @@ public class JPALoggerDAO extends AbstractDAO<Logger> implements LoggerDAO {
 
         protected final StringBuilder query = new StringBuilder();
 
+        protected String andIfNeeded() {
+            return query.length() == 0 ? " " : " AND ";
+        }
+
         protected MessageCriteriaBuilder entityKey(final String entityKey) {
-            query.append(' ').append(AUDIT_MESSAGE_COLUMN).
-                    append(" LIKE '%key%").append(entityKey).append("%'");
+            if (entityKey != null) {
+                query.append(andIfNeeded()).append(AUDIT_MESSAGE_COLUMN).
+                        append(" LIKE '%key%").append(entityKey).append("%'");
+            }
             return this;
         }
 
         public MessageCriteriaBuilder type(final AuditElements.EventCategoryType type) {
             if (type != null) {
-                query.append(" AND ").append(AUDIT_MESSAGE_COLUMN).
+                query.append(andIfNeeded()).append(AUDIT_MESSAGE_COLUMN).
                         append(" LIKE '%\"type\":\"").append(type.name()).append("\"%'");
             }
             return this;
@@ -59,7 +65,7 @@ public class JPALoggerDAO extends AbstractDAO<Logger> implements LoggerDAO {
 
         public MessageCriteriaBuilder category(final String category) {
             if (StringUtils.isNotBlank(category)) {
-                query.append(" AND ").append(AUDIT_MESSAGE_COLUMN).
+                query.append(andIfNeeded()).append(AUDIT_MESSAGE_COLUMN).
                         append(" LIKE '%\"category\":\"").append(category).append("\"%'");
             }
             return this;
@@ -67,7 +73,7 @@ public class JPALoggerDAO extends AbstractDAO<Logger> implements LoggerDAO {
 
         public MessageCriteriaBuilder subcategory(final String subcategory) {
             if (StringUtils.isNotBlank(subcategory)) {
-                query.append(" AND ").append(AUDIT_MESSAGE_COLUMN).
+                query.append(andIfNeeded()).append(AUDIT_MESSAGE_COLUMN).
                         append(" LIKE '%\"subcategory\":\"").append(subcategory).append("\"%'");
             }
             return this;
@@ -75,7 +81,7 @@ public class JPALoggerDAO extends AbstractDAO<Logger> implements LoggerDAO {
 
         public MessageCriteriaBuilder events(final List<String> events) {
             if (!events.isEmpty()) {
-                query.append(" AND ( ").
+                query.append(andIfNeeded()).append("( ").
                         append(events.stream().
                                 map(event -> AUDIT_MESSAGE_COLUMN + " LIKE '%\"event\":\"" + event + "\"%'").
                                 collect(Collectors.joining(" OR "))).
@@ -86,7 +92,7 @@ public class JPALoggerDAO extends AbstractDAO<Logger> implements LoggerDAO {
 
         public MessageCriteriaBuilder result(final AuditElements.Result result) {
             if (result != null) {
-                query.append(" AND ").append(AUDIT_MESSAGE_COLUMN).
+                query.append(andIfNeeded()).append(AUDIT_MESSAGE_COLUMN).
                         append(" LIKE '%\"result\":\"").append(result.name()).append("\"%' ");
             }
             return this;
@@ -139,9 +145,23 @@ public class JPALoggerDAO extends AbstractDAO<Logger> implements LoggerDAO {
     }
 
     @Override
-    public int countAuditEntries(final String entityKey) {
-        String queryString = "SELECT COUNT(0) FROM " + AUDIT_TABLE
-                + " WHERE " + messageCriteriaBuilder(entityKey).build();
+    public int countAuditEntries(
+            final String entityKey,
+            final AuditElements.EventCategoryType type,
+            final String category,
+            final String subcategory,
+            final List<String> events,
+            final AuditElements.Result result) {
+
+        String queryString = "SELECT COUNT(0)"
+                + " FROM " + AUDIT_TABLE
+                + " WHERE " + messageCriteriaBuilder(entityKey).
+                        type(type).
+                        category(category).
+                        subcategory(subcategory).
+                        result(result).
+                        events(events).
+                        build();
         Query countQuery = entityManager().createNativeQuery(queryString);
 
         return ((Number) countQuery.getSingleResult()).intValue();
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPARoleDAO.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPARoleDAO.java
index 0ba685f..bae0b98 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPARoleDAO.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPARoleDAO.java
@@ -28,6 +28,7 @@ import org.apache.syncope.core.persistence.api.dao.AnyMatchDAO;
 import org.apache.syncope.core.persistence.api.search.SearchCondConverter;
 import org.apache.syncope.core.persistence.api.dao.RoleDAO;
 import org.apache.syncope.core.persistence.api.dao.AnySearchDAO;
+import org.apache.syncope.core.persistence.api.dao.DelegationDAO;
 import org.apache.syncope.core.persistence.api.entity.Privilege;
 import org.apache.syncope.core.persistence.api.entity.Realm;
 import org.apache.syncope.core.persistence.api.entity.Role;
@@ -57,6 +58,9 @@ public class JPARoleDAO extends AbstractDAO<Role> implements RoleDAO {
     private AnySearchDAO searchDAO;
 
     @Autowired
+    private DelegationDAO delegationDAO;
+
+    @Autowired
     private SearchCondVisitor searchCondVisitor;
 
     @Override
@@ -137,6 +141,8 @@ public class JPARoleDAO extends AbstractDAO<Role> implements RoleDAO {
 
         clearDynMembers(role);
 
+        delegationDAO.findByRole(role).forEach(delegation -> delegation.getRoles().remove(role));
+
         entityManager().remove(role);
     }
 
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAUserDAO.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAUserDAO.java
index fcee9c2..054461d 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAUserDAO.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAUserDAO.java
@@ -45,12 +45,14 @@ import org.apache.syncope.core.spring.security.AuthContextUtils;
 import org.apache.syncope.core.spring.security.DelegatedAdministrationException;
 import org.apache.syncope.core.persistence.api.attrvalue.validation.InvalidEntityException;
 import org.apache.syncope.core.persistence.api.dao.AccessTokenDAO;
+import org.apache.syncope.core.persistence.api.dao.DelegationDAO;
 import org.apache.syncope.core.persistence.api.dao.GroupDAO;
 import org.apache.syncope.core.persistence.api.dao.RealmDAO;
 import org.apache.syncope.core.persistence.api.dao.RoleDAO;
 import org.apache.syncope.core.persistence.api.dao.UserDAO;
 import org.apache.syncope.core.persistence.api.entity.AccessToken;
 import org.apache.syncope.core.persistence.api.entity.AnyUtils;
+import org.apache.syncope.core.persistence.api.entity.Delegation;
 import org.apache.syncope.core.persistence.api.entity.Implementation;
 import org.apache.syncope.core.persistence.api.entity.Privilege;
 import org.apache.syncope.core.persistence.api.entity.Realm;
@@ -94,6 +96,9 @@ public class JPAUserDAO extends AbstractAnyDAO<User> implements UserDAO {
     @Autowired
     protected GroupDAO groupDAO;
 
+    @Autowired
+    protected DelegationDAO delegationDAO;
+
     @Resource(name = "adminUser")
     protected String adminUser;
 
@@ -117,6 +122,22 @@ public class JPAUserDAO extends AbstractAnyDAO<User> implements UserDAO {
         return findLastChange(key, JPAUser.TABLE);
     }
 
+    @Transactional(readOnly = true)
+    @Override
+    public Optional<String> findUsername(final String key) {
+        Query query = entityManager().createNativeQuery("SELECT username FROM " + JPAUser.TABLE + " WHERE id=?");
+        query.setParameter(1, key);
+
+        String username = null;
+        for (Object resultKey : query.getResultList()) {
+            username = resultKey instanceof Object[]
+                    ? (String) ((Object[]) resultKey)[0]
+                    : ((String) resultKey);
+        }
+
+        return Optional.ofNullable(username);
+    }
+
     @Override
     public int count() {
         Query query = entityManager().createQuery(
@@ -454,6 +475,13 @@ public class JPAUserDAO extends AbstractAnyDAO<User> implements UserDAO {
         groupDAO.removeDynMemberships(user);
         dynRealmDAO.removeDynMemberships(user.getKey());
 
+        Set<String> delegations = delegationDAO.findByDelegating(user).stream().
+                map(Delegation::getKey).collect(Collectors.toSet());
+        delegations.forEach(delegationDAO::delete);
+        delegations = delegationDAO.findByDelegated(user).stream().
+                map(Delegation::getKey).collect(Collectors.toSet());
+        delegations.forEach(delegationDAO::delete);
+
         AccessToken accessToken = accessTokenDAO.findByOwner(user.getUsername());
         if (accessToken != null) {
             accessTokenDAO.delete(accessToken);
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/AbstractSysInfoListener.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/AbstractSysInfoListener.java
index 2009a78..9d4d179 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/AbstractSysInfoListener.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/AbstractSysInfoListener.java
@@ -19,6 +19,7 @@
 package org.apache.syncope.core.persistence.jpa.entity;
 
 import java.util.Date;
+import org.apache.commons.lang3.StringUtils;
 import org.apache.syncope.core.persistence.api.entity.AnnotatedEntity;
 import org.apache.syncope.core.spring.security.AuthContextUtils;
 import org.slf4j.Logger;
@@ -29,9 +30,11 @@ public abstract class AbstractSysInfoListener {
     protected static final Logger LOG = LoggerFactory.getLogger(AnnotatedEntityListener.class);
 
     protected void setSysInfoOnAnnotatedEntity(final AnnotatedEntity entity) {
-        String username = AuthContextUtils.getUsername();
         LOG.debug("Set system properties for '{}'", entity);
 
+        String username = AuthContextUtils.getUsername()
+                + AuthContextUtils.getDelegatedBy().map(d -> " [delegated by " + d + "]").orElse(StringUtils.EMPTY);
+
         Date now = new Date();
 
         if (entity.getCreationDate() == null) {
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPADelegation.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPADelegation.java
new file mode 100644
index 0000000..e49325f
--- /dev/null
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPADelegation.java
@@ -0,0 +1,129 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.syncope.core.persistence.jpa.entity;
+
+import java.util.Date;
+import java.util.HashSet;
+import java.util.Set;
+import javax.persistence.Cacheable;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.ManyToOne;
+import javax.persistence.OneToMany;
+import javax.persistence.Table;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+import javax.persistence.UniqueConstraint;
+import javax.validation.constraints.NotNull;
+import org.apache.syncope.core.persistence.api.entity.Delegation;
+import org.apache.syncope.core.persistence.api.entity.Role;
+import org.apache.syncope.core.persistence.api.entity.user.User;
+import org.apache.syncope.core.persistence.jpa.entity.user.JPAUser;
+import org.apache.syncope.core.persistence.jpa.validation.entity.DelegationCheck;
+
+@Entity
+@Table(name = JPADelegation.TABLE, uniqueConstraints =
+        @UniqueConstraint(columnNames = { "delegating_id", "delegated_id" }))
+@Cacheable
+@DelegationCheck
+public class JPADelegation extends AbstractGeneratedKeyEntity implements Delegation {
+
+    public static final String TABLE = "Delegation";
+
+    private static final long serialVersionUID = 17988340419552L;
+
+    @ManyToOne(optional = false)
+    private JPAUser delegating;
+
+    @ManyToOne(optional = false)
+    private JPAUser delegated;
+
+    @NotNull
+    @Temporal(TemporalType.TIMESTAMP)
+    @Column(name = "startDate")
+    private Date start;
+
+    @Temporal(TemporalType.TIMESTAMP)
+    @Column(name = "endDate")
+    private Date end;
+
+    @OneToMany
+    private Set<JPARole> roles = new HashSet<>();
+
+    @Override
+    public User getDelegating() {
+        return delegating;
+    }
+
+    @Override
+    public void setDelegating(final User delegating) {
+        checkType(delegating, JPAUser.class);
+        this.delegating = (JPAUser) delegating;
+    }
+
+    @Override
+    public User getDelegated() {
+        return delegated;
+    }
+
+    @Override
+    public void setDelegated(final User delegated) {
+        checkType(delegated, JPAUser.class);
+        this.delegated = (JPAUser) delegated;
+    }
+
+    @Override
+    public Date getStart() {
+        return start == null
+                ? null
+                : new Date(start.getTime());
+    }
+
+    @Override
+    public void setStart(final Date start) {
+        this.start = start == null
+                ? null
+                : new Date(start.getTime());
+    }
+
+    @Override
+    public Date getEnd() {
+        return end == null
+                ? null
+                : new Date(end.getTime());
+    }
+
+    @Override
+    public void setEnd(final Date end) {
+        this.end = end == null
+                ? null
+                : new Date(end.getTime());
+    }
+
+    @Override
+    public boolean add(final Role role) {
+        checkType(role, JPARole.class);
+        return roles.add((JPARole) role);
+    }
+
+    @Override
+    public Set<? extends Role> getRoles() {
+        return roles;
+    }
+}
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAEntityFactory.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAEntityFactory.java
index d96f6fb..048105c 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAEntityFactory.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAEntityFactory.java
@@ -36,6 +36,7 @@ import org.apache.syncope.core.persistence.api.entity.Application;
 import org.apache.syncope.core.persistence.api.entity.Batch;
 import org.apache.syncope.core.persistence.api.entity.ConnInstance;
 import org.apache.syncope.core.persistence.api.entity.ConnPoolConf;
+import org.apache.syncope.core.persistence.api.entity.Delegation;
 import org.apache.syncope.core.persistence.api.entity.DerSchema;
 import org.apache.syncope.core.persistence.api.entity.Domain;
 import org.apache.syncope.core.persistence.api.entity.user.DynRoleMembership;
@@ -309,6 +310,8 @@ public class JPAEntityFactory implements EntityFactory {
             result = (E) new JPARemediation();
         } else if (reference.equals(Batch.class)) {
             result = (E) new JPABatch();
+        } else if (reference.equals(Delegation.class)) {
+            result = (E) new JPADelegation();
         } else {
             throw new IllegalArgumentException("Could not find a JPA implementation of " + reference.getName());
         }
diff --git a/client/lib/src/main/java/org/apache/syncope/client/lib/BasicAuthenticationHandler.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/DelegationCheck.java
similarity index 54%
copy from client/lib/src/main/java/org/apache/syncope/client/lib/BasicAuthenticationHandler.java
copy to core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/DelegationCheck.java
index ff1452e..ffb8207 100644
--- a/client/lib/src/main/java/org/apache/syncope/client/lib/BasicAuthenticationHandler.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/DelegationCheck.java
@@ -16,28 +16,26 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.syncope.client.lib;
+package org.apache.syncope.core.persistence.jpa.validation.entity;
 
-/**
- * Implementation providing Basic Authentication capability.
- */
-public class BasicAuthenticationHandler implements AuthenticationHandler {
-
-    private final String username;
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
 
-    private final String password;
+import javax.validation.Constraint;
+import javax.validation.Payload;
 
-    public BasicAuthenticationHandler(final String username, final String password) {
-        this.username = username;
-        this.password = password;
-    }
+@Target({ ElementType.TYPE })
+@Retention(RetentionPolicy.RUNTIME)
+@Constraint(validatedBy = DelegationValidator.class)
+@Documented
+public @interface DelegationCheck {
 
-    public String getUsername() {
-        return username;
-    }
+    String message() default "{org.apache.syncope.core.persistence.validation.delegation}";
 
-    public String getPassword() {
-        return password;
-    }
+    Class<?>[] groups() default {};
 
+    Class<? extends Payload>[] payload() default {};
 }
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/DelegationValidator.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/DelegationValidator.java
new file mode 100644
index 0000000..c90eec3
--- /dev/null
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/validation/entity/DelegationValidator.java
@@ -0,0 +1,59 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.syncope.core.persistence.jpa.validation.entity;
+
+import javax.validation.ConstraintValidatorContext;
+import org.apache.syncope.common.lib.types.EntityViolationType;
+import org.apache.syncope.core.persistence.api.entity.Delegation;
+
+public class DelegationValidator extends AbstractValidator<DelegationCheck, Delegation> {
+
+    @Override
+    public boolean isValid(final Delegation delegation, final ConstraintValidatorContext context) {
+        context.disableDefaultConstraintViolation();
+
+        boolean isValid = true;
+
+        if (delegation.getDelegating().equals(delegation.getDelegated())) {
+            context.buildConstraintViolationWithTemplate(
+                    getTemplate(EntityViolationType.Standard, "delegating must be different from delegated")).
+                    addPropertyNode("delegating").addConstraintViolation();
+
+            isValid = false;
+        }
+
+        if (isValid && delegation.getEnd() != null && !delegation.getEnd().after(delegation.getStart())) {
+            context.buildConstraintViolationWithTemplate(
+                    getTemplate(EntityViolationType.Standard, "when end is provided it must to be after start")).
+                    addPropertyNode("end").addConstraintViolation();
+
+            isValid = false;
+        }
+
+        if (isValid && !delegation.getDelegating().getRoles().containsAll(delegation.getRoles())) {
+            context.buildConstraintViolationWithTemplate(
+                    getTemplate(EntityViolationType.Standard, "only Roles assigned to delegating User can be granted")).
+                    addPropertyNode("roles").addConstraintViolation();
+
+            isValid = false;
+        }
+
+        return isValid;
+    }
+}
diff --git a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/AnySearchTest.java b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/AnySearchTest.java
index 1439f8d..8e543fe 100644
--- a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/AnySearchTest.java
+++ b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/AnySearchTest.java
@@ -605,7 +605,7 @@ public class AnySearchTest extends AbstractTest {
         UsernamePasswordAuthenticationToken auth = new UsernamePasswordAuthenticationToken(
                 new org.springframework.security.core.userdetails.User(
                         "poorGroupOwner", "FAKE_PASSWORD", authorities), "FAKE_PASSWORD", authorities);
-        auth.setDetails(new SyncopeAuthenticationDetails(SyncopeConstants.MASTER_DOMAIN));
+        auth.setDetails(new SyncopeAuthenticationDetails(SyncopeConstants.MASTER_DOMAIN, null));
 
         SecurityContextHolder.getContext().setAuthentication(auth);
         try {
diff --git a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/ConnInstanceTest.java b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/ConnInstanceTest.java
index 1d9784b..64a7030 100644
--- a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/ConnInstanceTest.java
+++ b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/ConnInstanceTest.java
@@ -62,7 +62,7 @@ public class ConnInstanceTest extends AbstractTest {
         UsernamePasswordAuthenticationToken auth = new UsernamePasswordAuthenticationToken(
                 new org.springframework.security.core.userdetails.User(
                         "admin", "FAKE_PASSWORD", authorities), "FAKE_PASSWORD", authorities);
-        auth.setDetails(new SyncopeAuthenticationDetails("Master"));
+        auth.setDetails(new SyncopeAuthenticationDetails(SyncopeConstants.MASTER_DOMAIN, null));
         SecurityContextHolder.getContext().setAuthentication(auth);
 
         try {
diff --git a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/MultitenancyTest.java b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/MultitenancyTest.java
index 8af7240..565b3b8 100644
--- a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/MultitenancyTest.java
+++ b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/MultitenancyTest.java
@@ -67,7 +67,7 @@ public class MultitenancyTest extends AbstractTest {
         UsernamePasswordAuthenticationToken auth = new UsernamePasswordAuthenticationToken(
                 new org.springframework.security.core.userdetails.User(
                         "admin", "FAKE_PASSWORD", authorities), "FAKE_PASSWORD", authorities);
-        auth.setDetails(new SyncopeAuthenticationDetails("Two"));
+        auth.setDetails(new SyncopeAuthenticationDetails("Two", null));
         SecurityContextHolder.getContext().setAuthentication(auth);
     }
 
diff --git a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/ResourceTest.java b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/ResourceTest.java
index 0bf2672..812125e 100644
--- a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/ResourceTest.java
+++ b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/ResourceTest.java
@@ -101,7 +101,7 @@ public class ResourceTest extends AbstractTest {
         UsernamePasswordAuthenticationToken auth = new UsernamePasswordAuthenticationToken(
                 new org.springframework.security.core.userdetails.User(
                         "admin", "FAKE_PASSWORD", authorities), "FAKE_PASSWORD", authorities);
-        auth.setDetails(new SyncopeAuthenticationDetails("Master"));
+        auth.setDetails(new SyncopeAuthenticationDetails(SyncopeConstants.MASTER_DOMAIN, null));
         SecurityContextHolder.getContext().setAuthentication(auth);
 
         try {
diff --git a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/outer/PlainSchemaTest.java b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/outer/PlainSchemaTest.java
index e84f882..0870232 100644
--- a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/outer/PlainSchemaTest.java
+++ b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/outer/PlainSchemaTest.java
@@ -84,7 +84,7 @@ public class PlainSchemaTest extends AbstractTest {
         UsernamePasswordAuthenticationToken auth = new UsernamePasswordAuthenticationToken(
                 new org.springframework.security.core.userdetails.User(
                         "admin", "FAKE_PASSWORD", authorities), "FAKE_PASSWORD", authorities);
-        auth.setDetails(new SyncopeAuthenticationDetails("Master"));
+        auth.setDetails(new SyncopeAuthenticationDetails(SyncopeConstants.MASTER_DOMAIN, null));
         SecurityContextHolder.getContext().setAuthentication(auth);
     }
 
diff --git a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/outer/RoleTest.java b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/outer/RoleTest.java
index 5c21a76..709ef48 100644
--- a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/outer/RoleTest.java
+++ b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/outer/RoleTest.java
@@ -26,16 +26,20 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
+import java.util.Collections;
+import java.util.Date;
 import java.util.HashSet;
 import java.util.List;
 import javax.persistence.Query;
 import org.apache.syncope.common.lib.types.AnyTypeKind;
 import org.apache.syncope.common.lib.types.StandardEntitlement;
 import org.apache.syncope.core.persistence.api.dao.AnyTypeClassDAO;
+import org.apache.syncope.core.persistence.api.dao.DelegationDAO;
 import org.apache.syncope.core.persistence.api.dao.PlainSchemaDAO;
 import org.apache.syncope.core.persistence.api.dao.RealmDAO;
 import org.apache.syncope.core.persistence.api.dao.RoleDAO;
 import org.apache.syncope.core.persistence.api.dao.UserDAO;
+import org.apache.syncope.core.persistence.api.entity.Delegation;
 import org.apache.syncope.core.persistence.api.entity.user.DynRoleMembership;
 import org.apache.syncope.core.persistence.api.entity.Role;
 import org.apache.syncope.core.persistence.api.entity.user.UPlainAttr;
@@ -65,6 +69,9 @@ public class RoleTest extends AbstractTest {
     @Autowired
     private AnyTypeClassDAO anyTypeClassDAO;
 
+    @Autowired
+    private DelegationDAO delegationDAO;
+
     /**
      * Static copy of {@link org.apache.syncope.core.persistence.jpa.dao.JPAUserDAO} method with same signature:
      * required for avoiding creating new transaction - good for general use case but bad for the way how
@@ -201,4 +208,31 @@ public class RoleTest extends AbstractTest {
         assertNotNull(user);
         assertTrue(user.getRoles().isEmpty());
     }
+
+    @Test
+    public void deleteCascadeOnDelegations() {
+        User bellini = userDAO.findByUsername("bellini");
+        User rossini = userDAO.findByUsername("rossini");
+
+        Role reviewer = roleDAO.find("User reviewer");
+
+        Delegation delegation = entityFactory.newEntity(Delegation.class);
+        delegation.setDelegating(bellini);
+        delegation.setDelegated(rossini);
+        delegation.setStart(new Date());
+        delegation.add(reviewer);
+        delegation = delegationDAO.save(delegation);
+
+        entityManager().flush();
+
+        delegation = delegationDAO.find(delegation.getKey());
+
+        assertEquals(Collections.singletonList(delegation), delegationDAO.findByRole(reviewer));
+
+        roleDAO.delete(reviewer.getKey());
+
+        entityManager().flush();
+
+        assertTrue(delegationDAO.find(delegation.getKey()).getRoles().isEmpty());
+    }
 }
diff --git a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/outer/UserTest.java b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/outer/UserTest.java
index e7196f6..e3093ac 100644
--- a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/outer/UserTest.java
+++ b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/outer/UserTest.java
@@ -25,6 +25,7 @@ import static org.junit.jupiter.api.Assertions.assertNull;
 import static org.junit.jupiter.api.Assertions.assertTrue;
 import static org.junit.jupiter.api.Assertions.fail;
 
+import java.util.Collections;
 import java.util.Date;
 import java.util.List;
 import java.util.Objects;
@@ -34,15 +35,19 @@ import org.apache.syncope.common.lib.types.CipherAlgorithm;
 import org.apache.syncope.core.persistence.api.attrvalue.validation.InvalidEntityException;
 import org.apache.syncope.core.persistence.api.dao.AnyObjectDAO;
 import org.apache.syncope.core.persistence.api.dao.ApplicationDAO;
+import org.apache.syncope.core.persistence.api.dao.DelegationDAO;
 import org.apache.syncope.core.persistence.api.dao.DerSchemaDAO;
 import org.apache.syncope.core.persistence.api.dao.ExternalResourceDAO;
 import org.apache.syncope.core.persistence.api.dao.PlainSchemaDAO;
 import org.apache.syncope.core.persistence.api.dao.GroupDAO;
 import org.apache.syncope.core.persistence.api.dao.RelationshipTypeDAO;
+import org.apache.syncope.core.persistence.api.dao.RoleDAO;
 import org.apache.syncope.core.persistence.api.dao.UserDAO;
 import org.apache.syncope.core.persistence.api.entity.AnyUtils;
+import org.apache.syncope.core.persistence.api.entity.Delegation;
 import org.apache.syncope.core.persistence.api.entity.DerSchema;
 import org.apache.syncope.core.persistence.api.entity.PlainAttrValue;
+import org.apache.syncope.core.persistence.api.entity.Role;
 import org.apache.syncope.core.persistence.api.entity.user.LAPlainAttr;
 import org.apache.syncope.core.persistence.api.entity.user.LinkedAccount;
 import org.apache.syncope.core.persistence.api.entity.user.UMembership;
@@ -86,6 +91,12 @@ public class UserTest extends AbstractTest {
     @Autowired
     private ApplicationDAO applicationDAO;
 
+    @Autowired
+    private DelegationDAO delegationDAO;
+
+    @Autowired
+    private RoleDAO roleDAO;
+
     @Test
     public void delete() {
         List<UMembership> memberships = groupDAO.findUMemberships(groupDAO.findByName("managingDirector"));
@@ -319,6 +330,34 @@ public class UserTest extends AbstractTest {
         assertNull(entityManager().find(JPALinkedAccount.class, account.getKey()));
     }
 
+    @Test
+    public void deleteCascadeOnDelegations() {
+        User bellini = userDAO.findByUsername("bellini");
+        User rossini = userDAO.findByUsername("rossini");
+
+        Role reviewer = roleDAO.find("User reviewer");
+
+        Delegation delegation = entityFactory.newEntity(Delegation.class);
+        delegation.setDelegating(bellini);
+        delegation.setDelegated(rossini);
+        delegation.setStart(new Date());
+        delegation.add(reviewer);
+        delegation = delegationDAO.save(delegation);
+
+        entityManager().flush();
+
+        delegation = delegationDAO.find(delegation.getKey());
+
+        assertEquals(Collections.singletonList(delegation), delegationDAO.findByDelegating(bellini));
+        assertEquals(Collections.singletonList(delegation), delegationDAO.findByDelegated(rossini));
+
+        userDAO.delete(rossini.getKey());
+
+        entityManager().flush();
+
+        assertNull(delegationDAO.find(delegation.getKey()));
+    }
+
     /**
      * Search by derived attribute.
      */
diff --git a/client/lib/src/main/java/org/apache/syncope/client/lib/AnonymousAuthenticationHandler.java b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/data/DelegationDataBinder.java
similarity index 67%
copy from client/lib/src/main/java/org/apache/syncope/client/lib/AnonymousAuthenticationHandler.java
copy to core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/data/DelegationDataBinder.java
index b34be66..ece45d3 100644
--- a/client/lib/src/main/java/org/apache/syncope/client/lib/AnonymousAuthenticationHandler.java
+++ b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/data/DelegationDataBinder.java
@@ -16,15 +16,16 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.syncope.client.lib;
+package org.apache.syncope.core.provisioning.api.data;
 
-/**
- * Implementation providing Basic Authentication capability for the special {@code anonymous} user.
- */
-public class AnonymousAuthenticationHandler extends BasicAuthenticationHandler implements AuthenticationHandler {
+import org.apache.syncope.common.lib.to.DelegationTO;
+import org.apache.syncope.core.persistence.api.entity.Delegation;
+
+public interface DelegationDataBinder {
+
+    Delegation create(DelegationTO delegationTO);
 
-    public AnonymousAuthenticationHandler(final String username, final String password) {
-        super(username, password);
-    }
+    Delegation update(Delegation delegation, DelegationTO delegationTO);
 
+    DelegationTO getDelegationTO(Delegation delegation);
 }
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/ApplicationDataBinderImpl.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/ApplicationDataBinderImpl.java
index 0fcb38c..1a78c79 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/ApplicationDataBinderImpl.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/ApplicationDataBinderImpl.java
@@ -112,10 +112,8 @@ public class ApplicationDataBinderImpl implements ApplicationDataBinder {
         applicationTO.setKey(application.getKey());
         applicationTO.setDescription(application.getDescription());
         applicationTO.getPrivileges().addAll(
-                application.getPrivileges().stream().map(privilege -> getPrivilegeTO(privilege)).
-                        collect(Collectors.toList()));
+                application.getPrivileges().stream().map(this::getPrivilegeTO).collect(Collectors.toList()));
 
         return applicationTO;
     }
-
 }
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/DelegationDataBinderImpl.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/DelegationDataBinderImpl.java
new file mode 100644
index 0000000..60be552
--- /dev/null
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/DelegationDataBinderImpl.java
@@ -0,0 +1,115 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.syncope.core.provisioning.java.data;
+
+import java.util.Iterator;
+import java.util.Optional;
+import java.util.stream.Collectors;
+import org.apache.syncope.common.lib.SyncopeClientException;
+import org.apache.syncope.common.lib.to.DelegationTO;
+import org.apache.syncope.common.lib.to.RoleTO;
+import org.apache.syncope.common.lib.types.ClientExceptionType;
+import org.apache.syncope.core.persistence.api.dao.NotFoundException;
+import org.apache.syncope.core.persistence.api.dao.RoleDAO;
+import org.apache.syncope.core.persistence.api.dao.UserDAO;
+import org.apache.syncope.core.persistence.api.entity.Delegation;
+import org.apache.syncope.core.persistence.api.entity.EntityFactory;
+import org.apache.syncope.core.persistence.api.entity.Role;
+import org.apache.syncope.core.persistence.api.entity.user.User;
+import org.apache.syncope.core.provisioning.api.data.DelegationDataBinder;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+@Component
+public class DelegationDataBinderImpl implements DelegationDataBinder {
+
+    private static final Logger LOG = LoggerFactory.getLogger(DelegationDataBinder.class);
+
+    @Autowired
+    private UserDAO userDAO;
+
+    @Autowired
+    private RoleDAO roleDAO;
+
+    @Autowired
+    private EntityFactory entityFactory;
+
+    @Override
+    public Delegation create(final DelegationTO delegationTO) {
+        Delegation delegation = entityFactory.newEntity(Delegation.class);
+
+        User delegating = Optional.ofNullable(userDAO.find(delegationTO.getDelegating())).
+                orElseThrow(() -> new NotFoundException("Delegating User " + delegationTO.getDelegating()));
+        delegation.setDelegating(delegating);
+
+        User delegated = Optional.ofNullable(userDAO.find(delegationTO.getDelegated())).
+                orElseThrow(() -> new NotFoundException("Delegated User " + delegationTO.getDelegated()));
+        delegation.setDelegated(delegated);
+
+        return update(delegation, delegationTO);
+    }
+
+    @Override
+    public Delegation update(final Delegation delegation, final DelegationTO delegationTO) {
+        delegation.setStart(delegationTO.getStart());
+        delegation.setEnd(delegationTO.getEnd());
+
+        // 1. add or update all (valid) roles from TO
+        delegationTO.getRoles().forEach(roleTO -> {
+            if (roleTO == null) {
+                LOG.error("Null {}", RoleTO.class.getSimpleName());
+            } else {
+                Role role = roleDAO.find(roleTO);
+                if (role == null) {
+                    SyncopeClientException sce = SyncopeClientException.build(ClientExceptionType.InvalidRole);
+                    sce.getElements().add("Role " + roleTO + " not found");
+                    throw sce;
+                }
+
+                delegation.add(role);
+            }
+        });
+
+        // 2. remove all roles not contained in the TO
+        for (Iterator<? extends Role> itor = delegation.getRoles().iterator(); itor.hasNext();) {
+            Role role = itor.next();
+            if (!delegationTO.getRoles().stream().anyMatch(roleKey -> roleKey.equals(role.getKey()))) {
+                itor.remove();
+            }
+        }
+
+        return delegation;
+    }
+
+    @Override
+    public DelegationTO getDelegationTO(final Delegation delegation) {
+        DelegationTO delegationTO = new DelegationTO();
+
+        delegationTO.setKey(delegation.getKey());
+        delegationTO.setDelegating(delegation.getDelegating().getKey());
+        delegationTO.setDelegated(delegation.getDelegated().getKey());
+        delegationTO.setStart(delegation.getStart());
+        delegationTO.setEnd(delegation.getEnd());
+        delegationTO.getRoles().addAll(delegation.getRoles().stream().map(Role::getKey).collect(Collectors.toSet()));
+
+        return delegationTO;
+    }
+}
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/UserDataBinderImpl.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/UserDataBinderImpl.java
index 0faee63..605e6b3 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/UserDataBinderImpl.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/UserDataBinderImpl.java
@@ -57,9 +57,11 @@ import org.apache.syncope.core.provisioning.api.data.UserDataBinder;
 import org.apache.syncope.core.spring.security.AuthContextUtils;
 import org.apache.syncope.core.persistence.api.dao.AnyTypeDAO;
 import org.apache.syncope.core.persistence.api.dao.ApplicationDAO;
+import org.apache.syncope.core.persistence.api.dao.DelegationDAO;
 import org.apache.syncope.core.persistence.api.dao.RoleDAO;
 import org.apache.syncope.core.persistence.api.entity.AccessToken;
 import org.apache.syncope.core.persistence.api.entity.AnyUtils;
+import org.apache.syncope.core.persistence.api.entity.Delegation;
 import org.apache.syncope.core.persistence.api.entity.Entity;
 import org.apache.syncope.core.persistence.api.entity.PlainSchema;
 import org.apache.syncope.core.persistence.api.entity.Privilege;
@@ -99,6 +101,9 @@ public class UserDataBinderImpl extends AbstractAnyDataBinder implements UserDat
     @Autowired
     private AccessTokenDAO accessTokenDAO;
 
+    @Autowired
+    private DelegationDAO delegationDAO;
+
     @Resource(name = "adminUser")
     private String adminUser;
 
@@ -118,7 +123,7 @@ public class UserDataBinderImpl extends AbstractAnyDataBinder implements UserDat
     @Transactional(readOnly = true)
     @Override
     public UserTO getAuthenticatedUserTO() {
-        final UserTO authUserTO;
+        UserTO authUserTO;
 
         String authUsername = AuthContextUtils.getUsername();
         if (anonymousUser.equals(authUsername)) {
@@ -765,6 +770,12 @@ public class UserDataBinderImpl extends AbstractAnyDataBinder implements UserDat
             // linked accounts
             userTO.getLinkedAccounts().addAll(
                     user.getLinkedAccounts().stream().map(this::getLinkedAccountTO).collect(Collectors.toList()));
+
+            // delegations
+            userTO.getDelegatingDelegations().addAll(
+                    delegationDAO.findByDelegating(user).stream().map(Delegation::getKey).collect(Collectors.toList()));
+            userTO.getDelegatedDelegations().addAll(
+                    delegationDAO.findByDelegated(user).stream().map(Delegation::getKey).collect(Collectors.toList()));
         }
 
         return userTO;
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/job/AbstractSchedTaskJobDelegate.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/job/AbstractSchedTaskJobDelegate.java
index 0a3eb49..62bdff4 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/job/AbstractSchedTaskJobDelegate.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/job/AbstractSchedTaskJobDelegate.java
@@ -139,7 +139,7 @@ public abstract class AbstractSchedTaskJobDelegate implements SchedTaskJobDelega
         status.set("Done");
 
         notificationManager.createTasks(
-                AuthContextUtils.getUsername(),
+                AuthContextUtils.getWho(),
                 AuditElements.EventCategoryType.TASK,
                 this.getClass().getSimpleName(),
                 null,
@@ -149,14 +149,14 @@ public abstract class AbstractSchedTaskJobDelegate implements SchedTaskJobDelega
                 execution);
 
         auditManager.audit(
-                AuthContextUtils.getUsername(),
+                AuthContextUtils.getWho(),
                 AuditElements.EventCategoryType.TASK,
                 task.getClass().getSimpleName(),
                 null,
                 null, // searching for before object is too much expensive ...
                 result,
                 task,
-                (Object[]) null);
+                null);
     }
 
     /**
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/job/notification/DefaultNotificationJobDelegate.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/job/notification/DefaultNotificationJobDelegate.java
index f33bf1d..10a9019 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/job/notification/DefaultNotificationJobDelegate.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/job/notification/DefaultNotificationJobDelegate.java
@@ -199,7 +199,7 @@ public class DefaultNotificationJobDelegate implements InitializingBean, Notific
                     }
 
                     notificationManager.createTasks(
-                            AuthContextUtils.getUsername(),
+                            AuthContextUtils.getWho(),
                             AuditElements.EventCategoryType.TASK,
                             "notification",
                             null,
@@ -218,7 +218,7 @@ public class DefaultNotificationJobDelegate implements InitializingBean, Notific
                     }
 
                     notificationManager.createTasks(
-                            AuthContextUtils.getUsername(),
+                            AuthContextUtils.getWho(),
                             AuditElements.EventCategoryType.TASK,
                             "notification",
                             null,
@@ -290,7 +290,7 @@ public class DefaultNotificationJobDelegate implements InitializingBean, Notific
             notificationManager.setTaskExecuted(execution.getTask().getKey(), false);
 
             auditManager.audit(
-                    AuthContextUtils.getUsername(),
+                    AuthContextUtils.getWho(),
                     AuditElements.EventCategoryType.TASK,
                     "notification",
                     null,
@@ -304,7 +304,7 @@ public class DefaultNotificationJobDelegate implements InitializingBean, Notific
             LOG.error("Maximum number of retries reached for task {} - giving up", execution.getTask());
 
             auditManager.audit(
-                    AuthContextUtils.getUsername(),
+                    AuthContextUtils.getWho(),
                     AuditElements.EventCategoryType.TASK,
                     "notification",
                     null,
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/AbstractPropagationTaskExecutor.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/AbstractPropagationTaskExecutor.java
index 16aea1d..1730ae4 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/AbstractPropagationTaskExecutor.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/AbstractPropagationTaskExecutor.java
@@ -478,7 +478,7 @@ public abstract class AbstractPropagationTaskExecutor implements PropagationTask
         if (notificationsAvailable || auditRequested) {
             ExecTO execTO = taskDataBinder.getExecTO(execution);
             notificationManager.createTasks(
-                    AuthContextUtils.getUsername(),
+                    AuthContextUtils.getWho(),
                     AuditElements.EventCategoryType.PROPAGATION,
                     anyTypeKind,
                     task.getResource().getKey(),
@@ -489,7 +489,7 @@ public abstract class AbstractPropagationTaskExecutor implements PropagationTask
                     taskInfo);
 
             auditManager.audit(
-                    AuthContextUtils.getUsername(),
+                    AuthContextUtils.getWho(),
                     AuditElements.EventCategoryType.PROPAGATION,
                     anyTypeKind,
                     task.getResource().getKey(),
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/DefaultPropagationTaskCallable.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/DefaultPropagationTaskCallable.java
index da9b97a..3573327 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/DefaultPropagationTaskCallable.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/DefaultPropagationTaskCallable.java
@@ -46,6 +46,8 @@ public class DefaultPropagationTaskCallable implements PropagationTaskCallable {
 
     protected final String username;
 
+    protected final String delegatedBy;
+
     protected final Collection<? extends GrantedAuthority> authorities;
 
     protected PropagationTaskInfo taskInfo;
@@ -56,6 +58,7 @@ public class DefaultPropagationTaskCallable implements PropagationTaskCallable {
         SecurityContext ctx = SecurityContextHolder.getContext();
         domain = AuthContextUtils.getDomain();
         username = ctx.getAuthentication().getName();
+        delegatedBy = AuthContextUtils.getDelegatedBy().orElse(null);
         authorities = ctx.getAuthentication().getAuthorities();
     }
 
@@ -74,7 +77,7 @@ public class DefaultPropagationTaskCallable implements PropagationTaskCallable {
         // set security context according to the one gathered at instantiation time from the calling thread
         UsernamePasswordAuthenticationToken auth = new UsernamePasswordAuthenticationToken(
                 new User(username, "FAKE_PASSWORD", authorities), "FAKE_PASSWORD", authorities);
-        auth.setDetails(new SyncopeAuthenticationDetails(domain));
+        auth.setDetails(new SyncopeAuthenticationDetails(domain, delegatedBy));
         SecurityContextHolder.getContext().setAuthentication(auth);
 
         LOG.debug("Execution started for {}", taskInfo);
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/pushpull/AbstractPullResultHandler.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/pushpull/AbstractPullResultHandler.java
index 0f5acc9..4021560 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/pushpull/AbstractPullResultHandler.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/pushpull/AbstractPullResultHandler.java
@@ -916,7 +916,7 @@ public abstract class AbstractPullResultHandler extends AbstractSyncopeResultHan
         }
 
         notificationManager.createTasks(
-                AuthContextUtils.getUsername(),
+                AuthContextUtils.getWho(),
                 AuditElements.EventCategoryType.PULL,
                 anyTypeKind.name().toLowerCase(),
                 profile.getTask().getResource().getKey(),
@@ -928,7 +928,7 @@ public abstract class AbstractPullResultHandler extends AbstractSyncopeResultHan
                 furtherInput);
 
         auditManager.audit(
-                AuthContextUtils.getUsername(),
+                AuthContextUtils.getWho(),
                 AuditElements.EventCategoryType.PULL,
                 anyTypeKind.name().toLowerCase(),
                 profile.getTask().getResource().getKey(),
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/pushpull/AbstractPushResultHandler.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/pushpull/AbstractPushResultHandler.java
index 9110edb..e4fb96b 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/pushpull/AbstractPushResultHandler.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/pushpull/AbstractPushResultHandler.java
@@ -478,7 +478,7 @@ public abstract class AbstractPushResultHandler extends AbstractSyncopeResultHan
                 if (notificationsAvailable || auditRequested) {
                     Map<String, Object> jobMap = new HashMap<>();
                     jobMap.put(AfterHandlingEvent.JOBMAP_KEY, new AfterHandlingEvent(
-                            AuthContextUtils.getUsername(),
+                            AuthContextUtils.getWho(),
                             AuditElements.EventCategoryType.PUSH,
                             any.getType().getKind().name().toLowerCase(),
                             profile.getTask().getResource().getKey(),
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/pushpull/DefaultRealmPullResultHandler.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/pushpull/DefaultRealmPullResultHandler.java
index 461b04d..a274daa 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/pushpull/DefaultRealmPullResultHandler.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/pushpull/DefaultRealmPullResultHandler.java
@@ -735,7 +735,7 @@ public class DefaultRealmPullResultHandler
         }
 
         notificationManager.createTasks(
-                AuthContextUtils.getUsername(),
+                AuthContextUtils.getWho(),
                 AuditElements.EventCategoryType.PULL,
                 SyncopeConstants.REALM_ANYTYPE.toLowerCase(),
                 profile.getTask().getResource().getKey(),
@@ -746,7 +746,7 @@ public class DefaultRealmPullResultHandler
                 delta);
 
         auditManager.audit(
-                AuthContextUtils.getUsername(),
+                AuthContextUtils.getWho(),
                 AuditElements.EventCategoryType.PULL,
                 SyncopeConstants.REALM_ANYTYPE.toLowerCase(),
                 profile.getTask().getResource().getKey(),
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/pushpull/DefaultRealmPushResultHandler.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/pushpull/DefaultRealmPushResultHandler.java
index 0afe207..3fb7dfa 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/pushpull/DefaultRealmPushResultHandler.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/pushpull/DefaultRealmPushResultHandler.java
@@ -427,7 +427,7 @@ public class DefaultRealmPushResultHandler
                 if (notificationsAvailable || auditRequested) {
                     Map<String, Object> jobMap = new HashMap<>();
                     jobMap.put(AfterHandlingEvent.JOBMAP_KEY, new AfterHandlingEvent(
-                            AuthContextUtils.getUsername(),
+                            AuthContextUtils.getWho(),
                             AuditElements.EventCategoryType.PUSH,
                             SyncopeConstants.REALM_ANYTYPE.toLowerCase(),
                             profile.getTask().getResource().getKey(),
diff --git a/core/provisioning-java/src/test/java/org/apache/syncope/core/provisioning/java/data/ResourceDataBinderTest.java b/core/provisioning-java/src/test/java/org/apache/syncope/core/provisioning/java/data/ResourceDataBinderTest.java
index 4033eb5..935ea20 100644
--- a/core/provisioning-java/src/test/java/org/apache/syncope/core/provisioning/java/data/ResourceDataBinderTest.java
+++ b/core/provisioning-java/src/test/java/org/apache/syncope/core/provisioning/java/data/ResourceDataBinderTest.java
@@ -77,7 +77,7 @@ public class ResourceDataBinderTest extends AbstractTest {
         UsernamePasswordAuthenticationToken auth = new UsernamePasswordAuthenticationToken(
                 new org.springframework.security.core.userdetails.User(
                         "admin", "FAKE_PASSWORD", authorities), "FAKE_PASSWORD", authorities);
-        auth.setDetails(new SyncopeAuthenticationDetails("Master"));
+        auth.setDetails(new SyncopeAuthenticationDetails(SyncopeConstants.MASTER_DOMAIN, null));
         SecurityContextHolder.getContext().setAuthentication(auth);
     }
 
diff --git a/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/SyncopeOpenApiCustomizer.java b/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/SyncopeOpenApiCustomizer.java
index e41f194..5f5d108 100644
--- a/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/SyncopeOpenApiCustomizer.java
+++ b/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/SyncopeOpenApiCustomizer.java
@@ -93,9 +93,8 @@ public class SyncopeOpenApiCustomizer extends OpenApiCustomizer {
                             getBean(DomainsHolder.class).getDomains().keySet());
         }
         if (!domains.isEmpty() && !domains.equals(Collections.singletonList(SyncopeConstants.MASTER_DOMAIN))) {
-            Optional<Parameter> domainHeaderParameter = parameters.stream().filter(parameter
-                    -> parameter instanceof HeaderParameter && RESTHeaders.DOMAIN.equals(parameter.getName())).
-                    findFirst();
+            Optional<Parameter> domainHeaderParameter = parameters.stream().
+                    filter(p -> p instanceof HeaderParameter && RESTHeaders.DOMAIN.equals(p.getName())).findFirst();
             if (!domainHeaderParameter.isPresent()) {
                 HeaderParameter parameter = new HeaderParameter();
                 parameter.setName(RESTHeaders.DOMAIN);
@@ -115,6 +114,25 @@ public class SyncopeOpenApiCustomizer extends OpenApiCustomizer {
                 parameters.add(parameter);
             }
         }
+
+        Optional<Parameter> delegatedByHeaderParameter = parameters.stream().
+                filter(p -> p instanceof HeaderParameter && RESTHeaders.DELEGATED_BY.equals(p.getName())).findFirst();
+        if (!delegatedByHeaderParameter.isPresent()) {
+            HeaderParameter parameter = new HeaderParameter();
+            parameter.setName(RESTHeaders.DELEGATED_BY);
+            parameter.setRequired(false);
+
+            ExternalDocumentation extDoc = new ExternalDocumentation();
+            extDoc.setDescription("Apache Syncope Reference Guide");
+            extDoc.setUrl("http://syncope.apache.org/docs/2.1/reference-guide.html#delegation");
+
+            Schema<String> schema = new Schema<>();
+            schema.setDescription("Acton behalf of someone else");
+            schema.setExternalDocs(extDoc);
+            parameter.setSchema(schema);
+
+            parameters.add(parameter);
+        }
     }
 
     @Override
diff --git a/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/ApplicationServiceImpl.java b/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/ApplicationServiceImpl.java
index ed944da..a0354ee 100644
--- a/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/ApplicationServiceImpl.java
+++ b/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/ApplicationServiceImpl.java
@@ -68,5 +68,4 @@ public class ApplicationServiceImpl extends AbstractServiceImpl implements Appli
     public void delete(final String key) {
         logic.delete(key);
     }
-
 }
diff --git a/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/ApplicationServiceImpl.java b/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/DelegationServiceImpl.java
similarity index 68%
copy from core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/ApplicationServiceImpl.java
copy to core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/DelegationServiceImpl.java
index ed944da..d6da13e 100644
--- a/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/ApplicationServiceImpl.java
+++ b/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/DelegationServiceImpl.java
@@ -21,38 +21,32 @@ package org.apache.syncope.core.rest.cxf.service;
 import java.net.URI;
 import java.util.List;
 import javax.ws.rs.core.Response;
-import org.apache.syncope.common.lib.to.ApplicationTO;
-import org.apache.syncope.common.lib.to.PrivilegeTO;
+import org.apache.syncope.common.lib.to.DelegationTO;
 import org.apache.syncope.common.rest.api.RESTHeaders;
-import org.apache.syncope.common.rest.api.service.ApplicationService;
-import org.apache.syncope.core.logic.ApplicationLogic;
+import org.apache.syncope.common.rest.api.service.DelegationService;
+import org.apache.syncope.core.logic.DelegationLogic;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 @Service
-public class ApplicationServiceImpl extends AbstractServiceImpl implements ApplicationService {
+public class DelegationServiceImpl extends AbstractServiceImpl implements DelegationService {
 
     @Autowired
-    private ApplicationLogic logic;
+    private DelegationLogic logic;
 
     @Override
-    public List<ApplicationTO> list() {
+    public List<DelegationTO> list() {
         return logic.list();
     }
 
     @Override
-    public ApplicationTO read(final String key) {
+    public DelegationTO read(final String key) {
         return logic.read(key);
     }
 
     @Override
-    public PrivilegeTO readPrivilege(final String key) {
-        return logic.readPrivilege(key);
-    }
-
-    @Override
-    public Response create(final ApplicationTO applicationTO) {
-        ApplicationTO created = logic.create(applicationTO);
+    public Response create(final DelegationTO applicationTO) {
+        DelegationTO created = logic.create(applicationTO);
         URI location = uriInfo.getAbsolutePathBuilder().path(created.getKey()).build();
         return Response.created(location).
                 header(RESTHeaders.RESOURCE_KEY, created.getKey()).
@@ -60,7 +54,7 @@ public class ApplicationServiceImpl extends AbstractServiceImpl implements Appli
     }
 
     @Override
-    public void update(final ApplicationTO applicationTO) {
+    public void update(final DelegationTO applicationTO) {
         logic.update(applicationTO);
     }
 
@@ -68,5 +62,4 @@ public class ApplicationServiceImpl extends AbstractServiceImpl implements Appli
     public void delete(final String key) {
         logic.delete(key);
     }
-
 }
diff --git a/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/UserSelfServiceImpl.java b/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/UserSelfServiceImpl.java
index ed6cd69..d97ba96 100644
--- a/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/UserSelfServiceImpl.java
+++ b/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/UserSelfServiceImpl.java
@@ -19,7 +19,7 @@
 package org.apache.syncope.core.rest.cxf.service;
 
 import javax.ws.rs.core.Response;
-import org.apache.commons.lang3.tuple.Pair;
+import org.apache.commons.lang3.tuple.Triple;
 import org.apache.syncope.common.lib.AnyOperations;
 import org.apache.syncope.common.lib.SyncopeClientException;
 import org.apache.syncope.common.lib.patch.StatusPatch;
@@ -57,10 +57,11 @@ public class UserSelfServiceImpl extends AbstractServiceImpl implements UserSelf
 
     @Override
     public Response read() {
-        Pair<String, UserTO> self = logic.selfRead();
+        Triple<String, String, UserTO> self = logic.selfRead();
         return Response.ok().
                 header(RESTHeaders.RESOURCE_KEY, self.getRight().getKey()).
                 header(RESTHeaders.OWNED_ENTITLEMENTS, self.getLeft()).
+                header(RESTHeaders.DELEGATIONS, self.getMiddle()).
                 entity(self.getRight()).
                 build();
     }
@@ -73,7 +74,7 @@ public class UserSelfServiceImpl extends AbstractServiceImpl implements UserSelf
 
     @Override
     public Response update(final UserTO user) {
-        Pair<String, UserTO> self = logic.selfRead();
+        Triple<String, String, UserTO> self = logic.selfRead();
         return update(AnyOperations.diff(user, self.getRight(), false));
     }
 
diff --git a/core/spring/src/main/java/org/apache/syncope/core/spring/security/AuthContextUtils.java b/core/spring/src/main/java/org/apache/syncope/core/spring/security/AuthContextUtils.java
index ee99056..f829105 100644
--- a/core/spring/src/main/java/org/apache/syncope/core/spring/security/AuthContextUtils.java
+++ b/core/spring/src/main/java/org/apache/syncope/core/spring/security/AuthContextUtils.java
@@ -21,10 +21,12 @@ package org.apache.syncope.core.spring.security;
 import java.util.Collections;
 import java.util.List;
 import java.util.Map;
+import java.util.Optional;
 import java.util.Set;
 import java.util.stream.Collectors;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.syncope.common.lib.SyncopeConstants;
+import org.apache.syncope.core.persistence.api.dao.UserDAO;
 import org.apache.syncope.core.provisioning.api.EntitlementsHolder;
 import org.apache.syncope.core.spring.ApplicationContextProvider;
 import org.slf4j.Logger;
@@ -32,7 +34,6 @@ import org.slf4j.LoggerFactory;
 import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
 import org.springframework.security.core.Authentication;
 import org.springframework.security.core.GrantedAuthority;
-import org.springframework.security.core.context.SecurityContext;
 import org.springframework.security.core.context.SecurityContextHolder;
 import org.springframework.security.core.userdetails.User;
 
@@ -60,29 +61,39 @@ public final class AuthContextUtils {
         SecurityContextHolder.getContext().setAuthentication(newAuth);
     }
 
-    public static Set<SyncopeGrantedAuthority> getAuthorities() {
-        SecurityContext ctx = SecurityContextHolder.getContext();
-        if (ctx != null && ctx.getAuthentication() != null && ctx.getAuthentication().getAuthorities() != null) {
-            return ctx.getAuthentication().getAuthorities().stream().
-                    filter(SyncopeGrantedAuthority.class::isInstance).
-                    map(SyncopeGrantedAuthority.class::cast).
-                    collect(Collectors.toSet());
-        }
+    public static Optional<String> getDelegatedBy() {
+        Authentication auth = SecurityContextHolder.getContext().getAuthentication();
 
-        return Collections.emptySet();
+        return auth != null && auth.getDetails() instanceof SyncopeAuthenticationDetails
+                ? Optional.ofNullable(SyncopeAuthenticationDetails.class.cast(auth.getDetails()).getDelegatedBy())
+                : Optional.empty();
     }
 
-    public static Map<String, Set<String>> getAuthorizations() {
-        SecurityContext ctx = SecurityContextHolder.getContext();
-        if (ctx != null && ctx.getAuthentication() != null && ctx.getAuthentication().getAuthorities() != null) {
-            return ctx.getAuthentication().getAuthorities().stream().
-                    filter(SyncopeGrantedAuthority.class::isInstance).
-                    map(SyncopeGrantedAuthority.class::cast).
-                    collect(Collectors.toMap(
-                            SyncopeGrantedAuthority::getAuthority, SyncopeGrantedAuthority::getRealms));
-        }
+    public static String getWho() {
+        return getUsername() + getDelegatedBy().map(d -> {
+            String delegatedBy = execWithAuthContext(getDomain(),
+                    () -> ApplicationContextProvider.getApplicationContext().getBean(UserDAO.class).findUsername(d)).
+                    orElse(d);
+            return " [delegated by " + delegatedBy + "]";
+        }).orElse(StringUtils.EMPTY);
+    }
 
-        return Collections.emptyMap();
+    public static Set<SyncopeGrantedAuthority> getAuthorities() {
+        return Optional.ofNullable(SecurityContextHolder.getContext().getAuthentication()).
+                map(authentication -> authentication.getAuthorities().stream().
+                filter(SyncopeGrantedAuthority.class::isInstance).
+                map(SyncopeGrantedAuthority.class::cast).
+                collect(Collectors.toSet())).
+                orElse(Collections.emptySet());
+    }
+
+    public static Map<String, Set<String>> getAuthorizations() {
+        return Optional.ofNullable(SecurityContextHolder.getContext().getAuthentication()).
+                map(authentication -> authentication.getAuthorities().stream().
+                filter(SyncopeGrantedAuthority.class::isInstance).
+                map(SyncopeGrantedAuthority.class::cast).
+                collect(Collectors.toMap(SyncopeGrantedAuthority::getAuthority, SyncopeGrantedAuthority::getRealms))).
+                orElse(Collections.emptyMap());
     }
 
     public static String getDomain() {
@@ -106,7 +117,7 @@ public final class AuthContextUtils {
         UsernamePasswordAuthenticationToken auth = new UsernamePasswordAuthenticationToken(
                 new User(ApplicationContextProvider.getBeanFactory().getBean("adminUser", String.class),
                         "FAKE_PASSWORD", authorities), "FAKE_PASSWORD", authorities);
-        auth.setDetails(new SyncopeAuthenticationDetails(domain));
+        auth.setDetails(new SyncopeAuthenticationDetails(domain, null));
         return auth;
     }
 
diff --git a/core/spring/src/main/java/org/apache/syncope/core/spring/security/AuthDataAccessor.java b/core/spring/src/main/java/org/apache/syncope/core/spring/security/AuthDataAccessor.java
index 5a4d7bf..a59555e 100644
--- a/core/spring/src/main/java/org/apache/syncope/core/spring/security/AuthDataAccessor.java
+++ b/core/spring/src/main/java/org/apache/syncope/core/spring/security/AuthDataAccessor.java
@@ -32,7 +32,9 @@ import javax.annotation.Resource;
 import javax.security.auth.login.AccountNotFoundException;
 
 import org.apache.commons.lang3.BooleanUtils;
+import org.apache.commons.lang3.StringUtils;
 import org.apache.commons.lang3.tuple.Pair;
+import org.apache.commons.lang3.tuple.Triple;
 import org.apache.syncope.common.lib.SyncopeConstants;
 import org.apache.syncope.common.lib.types.AnyTypeKind;
 import org.apache.syncope.common.lib.types.AuditElements;
@@ -45,6 +47,7 @@ import org.apache.syncope.core.persistence.api.entity.resource.Provision;
 import org.apache.syncope.core.provisioning.api.utils.RealmUtils;
 import org.apache.syncope.core.persistence.api.dao.AnyTypeDAO;
 import org.apache.syncope.core.persistence.api.dao.ConfDAO;
+import org.apache.syncope.core.persistence.api.dao.DelegationDAO;
 import org.apache.syncope.core.persistence.api.dao.DomainDAO;
 import org.apache.syncope.core.persistence.api.dao.GroupDAO;
 import org.apache.syncope.core.persistence.api.dao.RealmDAO;
@@ -53,6 +56,7 @@ import org.apache.syncope.core.persistence.api.dao.UserDAO;
 import org.apache.syncope.core.persistence.api.dao.search.AttrCond;
 import org.apache.syncope.core.persistence.api.dao.search.SearchCond;
 import org.apache.syncope.core.persistence.api.entity.AccessToken;
+import org.apache.syncope.core.persistence.api.entity.Delegation;
 import org.apache.syncope.core.persistence.api.entity.Domain;
 import org.apache.syncope.core.persistence.api.entity.DynRealm;
 import org.apache.syncope.core.persistence.api.entity.Realm;
@@ -75,6 +79,7 @@ import org.springframework.security.authentication.AuthenticationServiceExceptio
 import org.springframework.security.authentication.DisabledException;
 import org.springframework.security.core.Authentication;
 import org.springframework.security.core.userdetails.UsernameNotFoundException;
+import org.springframework.security.web.authentication.session.SessionAuthenticationException;
 import org.springframework.transaction.annotation.Transactional;
 
 /**
@@ -127,6 +132,9 @@ public class AuthDataAccessor {
     protected RoleDAO roleDAO;
 
     @Autowired
+    protected DelegationDAO delegationDAO;
+
+    @Autowired
     protected ConnectorFactory connFactory;
 
     @Autowired
@@ -173,6 +181,20 @@ public class AuthDataAccessor {
         return domain;
     }
 
+    protected String getDelegationKey(final SyncopeAuthenticationDetails details, final String delegatedKey) {
+        return Optional.ofNullable(details.getDelegatedBy()).
+                map(delegatingKey -> SyncopeConstants.UUID_PATTERN.matcher(delegatingKey).matches()
+                ? delegatingKey
+                : userDAO.findKey(delegatingKey)).map(delegatingKey -> {
+
+            LOG.debug("Delegation request: delegating:{}, delegated:{}", delegatingKey, delegatedKey);
+
+            return delegationDAO.findValidFor(delegatingKey, delegatedKey).
+                    orElseThrow(() -> new SessionAuthenticationException(
+                    "Delegation by " + delegatingKey + " was requested but none found"));
+        }).orElse(null);
+    }
+
     /**
      * Attempts to authenticate the given credentials against internal storage and pass-through resources (if
      * configured): the first succeeding causes global success.
@@ -181,7 +203,7 @@ public class AuthDataAccessor {
      * @return {@code null} if no matching user was found, authentication result otherwise
      */
     @Transactional(noRollbackFor = DisabledException.class)
-    public Pair<User, Boolean> authenticate(final Authentication authentication) {
+    public Triple<User, Boolean, String> authenticate(final Authentication authentication) {
         User user = null;
 
         Optional<? extends CPlainAttr> authAttrs = confDAO.find("authentication.attributes");
@@ -206,6 +228,7 @@ public class AuthDataAccessor {
         }
 
         Boolean authenticated = null;
+        String delegationKey = null;
         if (user != null) {
             authenticated = false;
 
@@ -218,8 +241,11 @@ public class AuthDataAccessor {
             }
 
             boolean userModified = false;
-            authenticated = AuthDataAccessor.this.authenticate(user, authentication.getCredentials().toString());
+            authenticated = authenticate(user, authentication.getCredentials().toString());
             if (authenticated) {
+                delegationKey = getDelegationKey(
+                        SyncopeAuthenticationDetails.class.cast(authentication.getDetails()), user.getKey());
+
                 if (confDAO.find("log.lastlogindate", true)) {
                     user.setLastLoginDate(new Date());
                     userModified = true;
@@ -229,7 +255,6 @@ public class AuthDataAccessor {
                     user.setFailedLogins(0);
                     userModified = true;
                 }
-
             } else {
                 user.setFailedLogins(user.getFailedLogins() + 1);
                 userModified = true;
@@ -240,7 +265,7 @@ public class AuthDataAccessor {
             }
         }
 
-        return Pair.of(user, authenticated);
+        return Triple.of(user, authenticated, delegationKey);
     }
 
     protected boolean authenticate(final User user, final String password) {
@@ -308,76 +333,106 @@ public class AuthDataAccessor {
                 collect(Collectors.toSet());
     }
 
-    protected Set<SyncopeGrantedAuthority> getUserAuthorities(final User user) {
+    protected Set<SyncopeGrantedAuthority> buildAuthorities(final Map<String, Set<String>> entForRealms) {
         Set<SyncopeGrantedAuthority> authorities = new HashSet<>();
 
+        entForRealms.forEach((entitlement, realms) -> {
+            Pair<Set<String>, Set<String>> normalized = RealmUtils.normalize(realms);
+
+            SyncopeGrantedAuthority authority = new SyncopeGrantedAuthority(entitlement);
+            authority.addRealms(normalized.getLeft());
+            authority.addRealms(normalized.getRight());
+            authorities.add(authority);
+        });
+
+        return authorities;
+    }
+
+    protected Set<SyncopeGrantedAuthority> getUserAuthorities(final User user) {
         if (user.isMustChangePassword()) {
-            authorities.add(new SyncopeGrantedAuthority(StandardEntitlement.MUST_CHANGE_PASSWORD));
-        } else {
-            Map<String, Set<String>> entForRealms = new HashMap<>();
-
-            // Give entitlements as assigned by roles (with static or dynamic realms, where applicable) - assigned
-            // either statically and dynamically
-            userDAO.findAllRoles(user).stream().
-                    filter(role -> !SyncopeConstants.GROUP_OWNER_ROLE.equals(role.getKey())).
-                    forEach(role -> role.getEntitlements().forEach(entitlement -> {
-                Set<String> realms = Optional.ofNullable(entForRealms.get(entitlement)).orElseGet(() -> {
-                    HashSet<String> r = new HashSet<>();
-                    entForRealms.put(entitlement, r);
-                    return r;
-                });
+            return Collections.singleton(new SyncopeGrantedAuthority(StandardEntitlement.MUST_CHANGE_PASSWORD));
+        }
 
-                realms.addAll(role.getRealms().stream().map(Realm::getFullPath).collect(Collectors.toSet()));
-                if (!entitlement.endsWith("_CREATE") && !entitlement.endsWith("_DELETE")) {
-                    realms.addAll(role.getDynRealms().stream().map(DynRealm::getKey).collect(Collectors.toList()));
-                }
-            }));
+        Map<String, Set<String>> entForRealms = new HashMap<>();
+
+        // Give entitlements as assigned by roles (with static or dynamic realms, where applicable) - assigned
+        // either statically and dynamically
+        userDAO.findAllRoles(user).stream().
+                filter(role -> !SyncopeConstants.GROUP_OWNER_ROLE.equals(role.getKey())).
+                forEach(role -> role.getEntitlements().forEach(entitlement -> {
+            Set<String> realms = Optional.ofNullable(entForRealms.get(entitlement)).orElseGet(() -> {
+                HashSet<String> r = new HashSet<>();
+                entForRealms.put(entitlement, r);
+                return r;
+            });
 
-            // Give group entitlements for owned groups
-            groupDAO.findOwnedByUser(user.getKey()).forEach(group -> {
-                Role groupOwnerRole = roleDAO.find(SyncopeConstants.GROUP_OWNER_ROLE);
-                if (groupOwnerRole == null) {
-                    LOG.warn("Role {} was not found", SyncopeConstants.GROUP_OWNER_ROLE);
-                } else {
-                    groupOwnerRole.getEntitlements().forEach(entitlement -> {
-                        Set<String> realms = Optional.ofNullable(entForRealms.get(entitlement)).orElseGet(() -> {
-                            HashSet<String> r = new HashSet<>();
-                            entForRealms.put(entitlement, r);
-                            return r;
-                        });
-
-                        realms.add(RealmUtils.getGroupOwnerRealm(group.getRealm().getFullPath(), group.getKey()));
+            realms.addAll(role.getRealms().stream().map(Realm::getFullPath).collect(Collectors.toSet()));
+            if (!entitlement.endsWith("_CREATE") && !entitlement.endsWith("_DELETE")) {
+                realms.addAll(role.getDynRealms().stream().map(DynRealm::getKey).collect(Collectors.toList()));
+            }
+        }));
+
+        // Give group entitlements for owned groups
+        groupDAO.findOwnedByUser(user.getKey()).forEach(group -> {
+            Role groupOwnerRole = roleDAO.find(SyncopeConstants.GROUP_OWNER_ROLE);
+            if (groupOwnerRole == null) {
+                LOG.warn("Role {} was not found", SyncopeConstants.GROUP_OWNER_ROLE);
+            } else {
+                groupOwnerRole.getEntitlements().forEach(entitlement -> {
+                    Set<String> realms = Optional.ofNullable(entForRealms.get(entitlement)).orElseGet(() -> {
+                        HashSet<String> r = new HashSet<>();
+                        entForRealms.put(entitlement, r);
+                        return r;
                     });
-                }
-            });
 
-            // Finally normalize realms for each given entitlement and generate authorities
-            entForRealms.forEach((key, value) -> {
-                Pair<Set<String>, Set<String>> normalized = RealmUtils.normalize(value);
+                    realms.add(RealmUtils.getGroupOwnerRealm(group.getRealm().getFullPath(), group.getKey()));
+                });
+            }
+        });
+
+        return buildAuthorities(entForRealms);
+    }
+
+    protected Set<SyncopeGrantedAuthority> getDelegatedAuthorities(final Delegation delegation) {
+        Map<String, Set<String>> entForRealms = new HashMap<>();
 
-                SyncopeGrantedAuthority authority = new SyncopeGrantedAuthority(key);
-                authority.addRealms(normalized.getLeft());
-                authority.addRealms(normalized.getRight());
-                authorities.add(authority);
+        delegation.getRoles().stream().filter(role -> !SyncopeConstants.GROUP_OWNER_ROLE.equals(role.getKey())).
+                forEach(role -> role.getEntitlements().forEach(entitlement -> {
+            Set<String> realms = Optional.ofNullable(entForRealms.get(entitlement)).orElseGet(() -> {
+                HashSet<String> r = new HashSet<>();
+                entForRealms.put(entitlement, r);
+                return r;
             });
-        }
 
-        return authorities;
+            realms.addAll(role.getRealms().stream().map(Realm::getFullPath).collect(Collectors.toSet()));
+            if (!entitlement.endsWith("_CREATE") && !entitlement.endsWith("_DELETE")) {
+                realms.addAll(role.getDynRealms().stream().map(DynRealm::getKey).collect(Collectors.toList()));
+            }
+        }));
+
+        return buildAuthorities(entForRealms);
     }
 
     @Transactional
-    public Set<SyncopeGrantedAuthority> getAuthorities(final String username) {
+    public Set<SyncopeGrantedAuthority> getAuthorities(final String username, final String delegationKey) {
         Set<SyncopeGrantedAuthority> authorities;
 
         if (anonymousUser.equals(username)) {
             authorities = ANONYMOUS_AUTHORITIES;
         } else if (adminUser.equals(username)) {
             authorities = getAdminAuthorities();
+        } else if (delegationKey != null) {
+            Delegation delegation = Optional.ofNullable(delegationDAO.find(delegationKey)).
+                    orElseThrow(() -> new UsernameNotFoundException(
+                    "Could not find delegation " + delegationKey));
+
+            authorities = delegation.getRoles().isEmpty()
+                    ? getUserAuthorities(delegation.getDelegating())
+                    : getDelegatedAuthorities(delegation);
         } else {
-            User user = userDAO.findByUsername(username);
-            if (user == null) {
-                throw new UsernameNotFoundException("Could not find any user with id " + username);
-            }
+            User user = Optional.ofNullable(userDAO.findByUsername(username)).
+                    orElseThrow(() -> new UsernameNotFoundException(
+                    "Could not find any user with username " + username));
 
             authorities = getUserAuthorities(user);
         }
@@ -409,12 +464,19 @@ public class AuthDataAccessor {
             }
 
             User user = resolved.getLeft();
+            String delegationKey = getDelegationKey(authentication.getDetails(), user.getKey());
             username = user.getUsername();
-            authorities = resolved.getRight() == null ? Collections.emptySet() : resolved.getRight();
+            authorities = resolved.getRight() == null
+                    ? Collections.emptySet()
+                    : delegationKey == null
+                            ? resolved.getRight()
+                            : getAuthorities(username, delegationKey);
             LOG.debug("JWT {} issued by {} resolved to User {} with authorities {}",
                     authentication.getClaims().getTokenId(),
                     authentication.getClaims().getIssuer(),
-                    username, authorities);
+                    username + Optional.ofNullable(delegationKey).
+                            map(d -> " [under delegation " + delegationKey + "]").orElse(StringUtils.EMPTY),
+                    authorities);
 
             if (BooleanUtils.isTrue(user.isSuspended())) {
                 throw new DisabledException("User " + username + " is suspended");
@@ -441,17 +503,16 @@ public class AuthDataAccessor {
 
     @Transactional(readOnly = true)
     public void audit(
-            final String who,
-            final AuditElements.EventCategoryType type,
-            final String category,
-            final String subcategory,
-            final String event,
+            final String username,
+            final String delegationKey,
             final AuditElements.Result result,
-            final Object before,
             final Object output,
             final Object... input) {
 
-        auditManager.audit(who, type, category, subcategory, event, result, before, output, input);
+        auditManager.audit(
+                username + Optional.ofNullable(delegationKey).
+                        map(d -> " [under delegation " + delegationKey + "]").orElse(StringUtils.EMPTY),
+                AuditElements.EventCategoryType.LOGIC, AuditElements.AUTHENTICATION_CATEGORY, null,
+                AuditElements.LOGIN_EVENT, result, null, output, input);
     }
-
 }
diff --git a/core/spring/src/main/java/org/apache/syncope/core/spring/security/JWTAuthenticationProvider.java b/core/spring/src/main/java/org/apache/syncope/core/spring/security/JWTAuthenticationProvider.java
index e5bd99f..dc2974d 100644
--- a/core/spring/src/main/java/org/apache/syncope/core/spring/security/JWTAuthenticationProvider.java
+++ b/core/spring/src/main/java/org/apache/syncope/core/spring/security/JWTAuthenticationProvider.java
@@ -38,7 +38,7 @@ public class JWTAuthenticationProvider implements AuthenticationProvider {
 
     @Override
     public Authentication authenticate(final Authentication authentication) throws AuthenticationException {
-        final JWTAuthentication jwtAuthentication = (JWTAuthentication) authentication;
+        JWTAuthentication jwtAuthentication = (JWTAuthentication) authentication;
 
         AuthContextUtils.execWithAuthContext(jwtAuthentication.getDetails().getDomain(), () -> {
             Pair<String, Set<SyncopeGrantedAuthority>> authenticated = dataAccessor.authenticate(jwtAuthentication);
diff --git a/core/spring/src/main/java/org/apache/syncope/core/spring/security/SyncopeAuthenticationDetails.java b/core/spring/src/main/java/org/apache/syncope/core/spring/security/SyncopeAuthenticationDetails.java
index de86f94..b6d80e7 100644
--- a/core/spring/src/main/java/org/apache/syncope/core/spring/security/SyncopeAuthenticationDetails.java
+++ b/core/spring/src/main/java/org/apache/syncope/core/spring/security/SyncopeAuthenticationDetails.java
@@ -33,12 +33,16 @@ public class SyncopeAuthenticationDetails implements Serializable {
 
     private final String domain;
 
+    private final String delegatedBy;
+
     public SyncopeAuthenticationDetails(final HttpServletRequest request) {
         this.domain = request.getHeader(RESTHeaders.DOMAIN);
+        this.delegatedBy = request.getHeader(RESTHeaders.DELEGATED_BY);
     }
 
-    public SyncopeAuthenticationDetails(final String domain) {
+    public SyncopeAuthenticationDetails(final String domain, final String delegatedBy) {
         this.domain = domain;
+        this.delegatedBy = delegatedBy;
     }
 
     public String getDomain() {
@@ -47,10 +51,15 @@ public class SyncopeAuthenticationDetails implements Serializable {
                 : domain;
     }
 
+    public String getDelegatedBy() {
+        return delegatedBy;
+    }
+
     @Override
     public int hashCode() {
         return new HashCodeBuilder().
                 append(domain).
+                append(delegatedBy).
                 build();
     }
 
@@ -68,6 +77,7 @@ public class SyncopeAuthenticationDetails implements Serializable {
         final SyncopeAuthenticationDetails other = (SyncopeAuthenticationDetails) obj;
         return new EqualsBuilder().
                 append(domain, other.domain).
+                append(delegatedBy, other.delegatedBy).
                 build();
     }
 
@@ -75,6 +85,7 @@ public class SyncopeAuthenticationDetails implements Serializable {
     public String toString() {
         return new ToStringBuilder(this).
                 append(domain).
+                append(delegatedBy).
                 build();
     }
 }
diff --git a/core/spring/src/main/java/org/apache/syncope/core/spring/security/SyncopeAuthenticationDetailsSource.java b/core/spring/src/main/java/org/apache/syncope/core/spring/security/SyncopeAuthenticationDetailsSource.java
index 0b2b27c..5f82832 100644
--- a/core/spring/src/main/java/org/apache/syncope/core/spring/security/SyncopeAuthenticationDetailsSource.java
+++ b/core/spring/src/main/java/org/apache/syncope/core/spring/security/SyncopeAuthenticationDetailsSource.java
@@ -28,5 +28,4 @@ public class SyncopeAuthenticationDetailsSource
     public SyncopeAuthenticationDetails buildDetails(final HttpServletRequest context) {
         return new SyncopeAuthenticationDetails(context);
     }
-
 }
diff --git a/core/spring/src/main/java/org/apache/syncope/core/spring/security/UsernamePasswordAuthenticationProvider.java b/core/spring/src/main/java/org/apache/syncope/core/spring/security/UsernamePasswordAuthenticationProvider.java
index b127f46..3b0d4cf 100644
--- a/core/spring/src/main/java/org/apache/syncope/core/spring/security/UsernamePasswordAuthenticationProvider.java
+++ b/core/spring/src/main/java/org/apache/syncope/core/spring/security/UsernamePasswordAuthenticationProvider.java
@@ -18,10 +18,11 @@
  */
 package org.apache.syncope.core.spring.security;
 
+import java.util.concurrent.atomic.AtomicReference;
 import javax.annotation.Resource;
-import org.apache.commons.lang3.tuple.Pair;
+import org.apache.commons.lang3.BooleanUtils;
+import org.apache.commons.lang3.tuple.Triple;
 import org.apache.syncope.common.lib.SyncopeConstants;
-import org.apache.syncope.common.lib.types.AuditElements;
 import org.apache.syncope.common.lib.types.AuditElements.Result;
 import org.apache.syncope.common.lib.types.CipherAlgorithm;
 import org.apache.syncope.core.persistence.api.entity.Domain;
@@ -92,15 +93,16 @@ public class UsernamePasswordAuthenticationProvider implements AuthenticationPro
     public Authentication authenticate(final Authentication authentication) {
         String domainKey = SyncopeAuthenticationDetails.class.cast(authentication.getDetails()).getDomain();
 
-        final String[] username = new String[1];
+        AtomicReference<String> username = new AtomicReference<>();
         Boolean authenticated;
+        AtomicReference<String> delegationKey = new AtomicReference<>();
 
         if (anonymousUser.equals(authentication.getName())) {
-            username[0] = anonymousUser;
+            username.set(anonymousUser);
             credentialChecker.checkIsDefaultAnonymousKeyInUse();
             authenticated = authentication.getCredentials().toString().equals(anonymousKey);
         } else if (adminUser.equals(authentication.getName())) {
-            username[0] = adminUser;
+            username.set(adminUser);
             if (SyncopeConstants.MASTER_DOMAIN.equals(domainKey)) {
                 credentialChecker.checkIsDefaultAdminPasswordInUse();
                 authenticated = ENCRYPTOR.verify(
@@ -108,10 +110,8 @@ public class UsernamePasswordAuthenticationProvider implements AuthenticationPro
                         CipherAlgorithm.valueOf(adminPasswordAlgorithm),
                         adminPassword);
             } else {
-                final String domainToFind = domainKey;
                 authenticated = AuthContextUtils.execWithAuthContext(SyncopeConstants.MASTER_DOMAIN, () -> {
-                    Domain domain = dataAccessor.findDomain(domainToFind);
-
+                    Domain domain = dataAccessor.findDomain(domainKey);
                     return ENCRYPTOR.verify(
                             authentication.getCredentials().toString(),
                             domain.getAdminCipherAlgorithm(),
@@ -119,63 +119,60 @@ public class UsernamePasswordAuthenticationProvider implements AuthenticationPro
                 });
             }
         } else {
-            final Pair<User, Boolean> authResult =
+            Triple<User, Boolean, String> authResult =
                     AuthContextUtils.execWithAuthContext(domainKey, () -> dataAccessor.authenticate(authentication));
-            authenticated = authResult.getValue();
-            if (authResult.getLeft() != null && authResult.getRight() != null) {
-                username[0] = authResult.getLeft().getUsername();
+            authenticated = authResult.getMiddle();
+            if (authResult.getLeft() != null && authResult.getMiddle() != null) {
+                username.set(authResult.getLeft().getUsername());
 
-                if (!authResult.getRight()) {
+                if (!authenticated) {
                     AuthContextUtils.execWithAuthContext(domainKey, () -> {
                         provisioningManager.internalSuspend(authResult.getLeft().getKey());
                         return null;
                     });
                 }
             }
+            delegationKey.set(authResult.getRight());
         }
-        if (username[0] == null) {
-            username[0] = authentication.getPrincipal().toString();
+        if (username.get() == null) {
+            username.set(authentication.getPrincipal().toString());
         }
 
-        final boolean isAuthenticated = authenticated != null && authenticated;
         UsernamePasswordAuthenticationToken token;
-        if (isAuthenticated) {
+        if (BooleanUtils.isTrue(authenticated)) {
             token = AuthContextUtils.execWithAuthContext(domainKey, () -> {
-                UsernamePasswordAuthenticationToken token1 = new UsernamePasswordAuthenticationToken(
-                        username[0],
+                UsernamePasswordAuthenticationToken upat = new UsernamePasswordAuthenticationToken(
+                        username.get(),
                         null,
-                        dataAccessor.getAuthorities(username[0]));
-                token1.setDetails(authentication.getDetails());
+                        dataAccessor.getAuthorities(username.get(), delegationKey.get()));
+                upat.setDetails(authentication.getDetails());
                 dataAccessor.audit(
-                        username[0],
-                        AuditElements.EventCategoryType.LOGIC,
-                        AuditElements.AUTHENTICATION_CATEGORY, null,
-                        AuditElements.LOGIN_EVENT, Result.SUCCESS, null, isAuthenticated, authentication,
-                        "Successfully authenticated, with entitlements: " + token1.getAuthorities());
-                return token1;
+                        username.get(),
+                        delegationKey.get(),
+                        Result.SUCCESS,
+                        true,
+                        authentication,
+                        "Successfully authenticated, with entitlements: " + upat.getAuthorities());
+                return upat;
             });
 
             LOG.debug("User {} successfully authenticated, with entitlements {}",
-                    username[0], token.getAuthorities());
+                    username.get(), token.getAuthorities());
         } else {
             AuthContextUtils.execWithAuthContext(domainKey, () -> {
                 dataAccessor.audit(
-                        username[0],
-                        AuditElements.EventCategoryType.LOGIC,
-                        AuditElements.AUTHENTICATION_CATEGORY,
-                        null,
-                        AuditElements.LOGIN_EVENT,
+                        username.get(),
+                        delegationKey.get(),
                         Result.FAILURE,
-                        null,
-                        isAuthenticated,
+                        false,
                         authentication,
-                        "User " + username[0] + " not authenticated");
+                        "Not authenticated");
                 return null;
             });
 
-            LOG.debug("User {} not authenticated", username[0]);
+            LOG.debug("User {} not authenticated", username.get());
 
-            throw new BadCredentialsException("User " + username[0] + " not authenticated");
+            throw new BadCredentialsException("User " + username.get() + " not authenticated");
         }
 
         return token;
diff --git a/ext/oidcclient/logic/src/main/java/org/apache/syncope/core/logic/OIDCClientLogic.java b/ext/oidcclient/logic/src/main/java/org/apache/syncope/core/logic/OIDCClientLogic.java
index 9c9acbf..a328651 100644
--- a/ext/oidcclient/logic/src/main/java/org/apache/syncope/core/logic/OIDCClientLogic.java
+++ b/ext/oidcclient/logic/src/main/java/org/apache/syncope/core/logic/OIDCClientLogic.java
@@ -356,7 +356,7 @@ public class OIDCClientLogic extends AbstractTransactionalLogic<EntityTO> {
         byte[] authorities = null;
         try {
             authorities = ENCRYPTOR.encode(POJOHelper.serialize(
-                    authDataAccessor.getAuthorities(responseTO.getUsername())), CipherAlgorithm.AES).
+                    authDataAccessor.getAuthorities(responseTO.getUsername(), null)), CipherAlgorithm.AES).
                     getBytes();
         } catch (Exception e) {
             LOG.error("Could not fetch authorities", e);
diff --git a/ext/saml2sp/logic/src/main/java/org/apache/syncope/core/logic/SAML2SPLogic.java b/ext/saml2sp/logic/src/main/java/org/apache/syncope/core/logic/SAML2SPLogic.java
index 814fa41..a9f31a0 100644
--- a/ext/saml2sp/logic/src/main/java/org/apache/syncope/core/logic/SAML2SPLogic.java
+++ b/ext/saml2sp/logic/src/main/java/org/apache/syncope/core/logic/SAML2SPLogic.java
@@ -483,8 +483,8 @@ public class SAML2SPLogic extends AbstractSAML2Logic<EntityTO> {
             }
         }
 
-        final List<String> matchingUsers = keyValue == null
-                ? Collections.<String>emptyList()
+        List<String> matchingUsers = keyValue == null
+                ? Collections.emptyList()
                 : userManager.findMatchingUser(keyValue, idp.getKey());
         LOG.debug("Found {} matching users for {}", matchingUsers.size(), keyValue);
 
@@ -540,7 +540,7 @@ public class SAML2SPLogic extends AbstractSAML2Logic<EntityTO> {
         byte[] authorities = null;
         try {
             authorities = ENCRYPTOR.encode(POJOHelper.serialize(
-                    authDataAccessor.getAuthorities(responseTO.getUsername())), CipherAlgorithm.AES).getBytes();
+                    authDataAccessor.getAuthorities(responseTO.getUsername(), null)), CipherAlgorithm.AES).getBytes();
         } catch (Exception e) {
             LOG.error("Could not fetch authorities", e);
         }
diff --git a/ext/scimv2/logic/src/main/java/org/apache/syncope/core/logic/SCIMDataBinder.java b/ext/scimv2/logic/src/main/java/org/apache/syncope/core/logic/SCIMDataBinder.java
index 1a349e5..55cd023 100644
--- a/ext/scimv2/logic/src/main/java/org/apache/syncope/core/logic/SCIMDataBinder.java
+++ b/ext/scimv2/logic/src/main/java/org/apache/syncope/core/logic/SCIMDataBinder.java
@@ -406,7 +406,7 @@ public class SCIMDataBinder {
             }
 
             if (output(attributes, excludedAttributes, "entitlements")) {
-                authDataAccessor.getAuthorities(userTO.getUsername()).forEach(authority -> {
+                authDataAccessor.getAuthorities(userTO.getUsername(), null).forEach(authority -> {
                     user.getEntitlements().
                             add(new Value(authority.getAuthority() + " on Realm(s) " + authority.getRealms()));
                 });
diff --git a/fit/build-tools/src/main/java/org/apache/directory/server/core/normalization/NormalizationInterceptor.java b/fit/build-tools/src/main/java/org/apache/directory/server/core/normalization/NormalizationInterceptor.java
index e5cfb5a..555ca61 100644
--- a/fit/build-tools/src/main/java/org/apache/directory/server/core/normalization/NormalizationInterceptor.java
+++ b/fit/build-tools/src/main/java/org/apache/directory/server/core/normalization/NormalizationInterceptor.java
@@ -532,6 +532,7 @@ public class NormalizationInterceptor extends BaseInterceptor
                 }
                 else if ( leafNode instanceof EqualityNode )
                 {
+                    @SuppressWarnings("unchecked")
                     Value value = ( ( EqualityNode<String> ) leafNode ).getValue();
 
                     if ( value.equals( SchemaConstants.TOP_OC ) )
diff --git a/fit/core-reference/src/main/java/org/apache/syncope/fit/core/reference/CustomJWTSSOProvider.java b/fit/core-reference/src/main/java/org/apache/syncope/fit/core/reference/CustomJWTSSOProvider.java
index 379d305..a3bbce9 100644
--- a/fit/core-reference/src/main/java/org/apache/syncope/fit/core/reference/CustomJWTSSOProvider.java
+++ b/fit/core-reference/src/main/java/org/apache/syncope/fit/core/reference/CustomJWTSSOProvider.java
@@ -90,7 +90,7 @@ public class CustomJWTSSOProvider implements JWTSSOProvider {
         List<User> matching = searchDAO.search(SearchCond.getLeaf(userIdCond), AnyTypeKind.USER);
         if (matching.size() == 1) {
             User user = matching.get(0);
-            Set<SyncopeGrantedAuthority> authorities = authDataAccessor.getAuthorities(user.getUsername());
+            Set<SyncopeGrantedAuthority> authorities = authDataAccessor.getAuthorities(user.getUsername(), null);
 
             return Pair.of(user, authorities);
         }
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/AbstractITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/AbstractITCase.java
index d199310..f54f968 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/AbstractITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/AbstractITCase.java
@@ -29,6 +29,7 @@ import java.io.InputStream;
 import java.net.URI;
 import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.Collections;
 import java.util.List;
 import java.util.Locale;
 import java.util.Map;
@@ -49,6 +50,7 @@ import org.apache.cxf.jaxrs.client.WebClient;
 import org.apache.cxf.rs.security.jose.jwa.SignatureAlgorithm;
 import org.apache.syncope.client.lib.SyncopeClient;
 import org.apache.syncope.client.lib.SyncopeClientFactoryBean;
+import org.apache.syncope.common.lib.log.AuditEntry;
 import org.apache.syncope.common.lib.patch.AnyObjectPatch;
 import org.apache.syncope.common.lib.patch.AttrPatch;
 import org.apache.syncope.common.lib.patch.GroupPatch;
@@ -74,6 +76,7 @@ import org.apache.syncope.common.lib.types.TraceLevel;
 import org.apache.syncope.common.rest.api.RESTHeaders;
 import org.apache.syncope.common.rest.api.batch.BatchPayloadParser;
 import org.apache.syncope.common.rest.api.batch.BatchResponseItem;
+import org.apache.syncope.common.rest.api.beans.AuditQuery;
 import org.apache.syncope.common.rest.api.service.AnyObjectService;
 import org.apache.syncope.common.rest.api.service.AnyTypeClassService;
 import org.apache.syncope.common.rest.api.service.AnyTypeService;
@@ -110,6 +113,7 @@ import org.apache.syncope.common.rest.api.service.UserSelfService;
 import org.apache.syncope.common.rest.api.service.UserService;
 import org.apache.syncope.common.rest.api.service.UserRequestService;
 import org.apache.syncope.common.rest.api.service.BpmnProcessService;
+import org.apache.syncope.common.rest.api.service.DelegationService;
 import org.apache.syncope.common.rest.api.service.UserWorkflowTaskService;
 import org.apache.syncope.fit.core.UserITCase;
 import org.identityconnectors.common.security.Encryptor;
@@ -268,6 +272,8 @@ public abstract class AbstractITCase {
 
     protected static RemediationService remediationService;
 
+    protected static DelegationService delegationService;
+
     protected static CamelRouteService camelRouteService;
 
     protected static SAML2SPService saml2SpService;
@@ -344,6 +350,7 @@ public abstract class AbstractITCase {
         securityQuestionService = adminClient.getService(SecurityQuestionService.class);
         implementationService = adminClient.getService(ImplementationService.class);
         remediationService = adminClient.getService(RemediationService.class);
+        delegationService = adminClient.getService(DelegationService.class);
         camelRouteService = adminClient.getService(CamelRouteService.class);
         saml2SpService = adminClient.getService(SAML2SPService.class);
         saml2IdPService = adminClient.getService(SAML2IdPService.class);
@@ -681,4 +688,18 @@ public abstract class AbstractITCase {
 
         return object;
     }
+
+    protected static List<AuditEntry> query(final AuditQuery query, final int maxWaitSeconds) {
+        int i = 0;
+        List<AuditEntry> results = Collections.emptyList();
+        do {
+            try {
+                Thread.sleep(1000);
+            } catch (InterruptedException e) {
+            }
+            results = loggerService.search(query).getResult();
+            i++;
+        } while (results.isEmpty() && i < maxWaitSeconds);
+        return results;
+    }
 }
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/console/SecurityQuestionsITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/console/SecurityQuestionsITCase.java
index 2562344..25eb5f1 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/console/SecurityQuestionsITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/console/SecurityQuestionsITCase.java
@@ -39,7 +39,7 @@ public class SecurityQuestionsITCase extends AbstractConsoleITCase {
         doLogin(ADMIN_UNAME, ADMIN_PWD);
         TESTER.clickLink("body:configurationLI:configurationUL:securityLI:security");
         TESTER.assertRenderedPage(Security.class);
-        TESTER.clickLink("body:content:tabbedPanel:tabs-container:tabs:3:link");
+        TESTER.clickLink("body:content:tabbedPanel:tabs-container:tabs:4:link");
     }
 
     private void createSecurityQuestion(final String name) {
@@ -60,7 +60,7 @@ public class SecurityQuestionsITCase extends AbstractConsoleITCase {
         TESTER.cleanupFeedbackMessages();
 
         TESTER.clickLink("body:configurationLI:configurationUL:securityLI:security");
-        TESTER.clickLink("body:content:tabbedPanel:tabs-container:tabs:3:link");
+        TESTER.clickLink("body:content:tabbedPanel:tabs-container:tabs:4:link");
     }
 
     @Test
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/AuditITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/AuditITCase.java
index 76f2c83..edcf9d7 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/AuditITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/AuditITCase.java
@@ -25,7 +25,6 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
 import static org.junit.jupiter.api.Assertions.assertNotEquals;
 
 import com.fasterxml.jackson.core.JsonProcessingException;
-import java.util.Collections;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
@@ -43,42 +42,28 @@ import org.apache.syncope.common.lib.types.ConnConfProperty;
 import org.apache.syncope.common.lib.types.ConnectorCapability;
 import org.apache.syncope.common.rest.api.beans.AnyQuery;
 import org.apache.syncope.common.rest.api.beans.AuditQuery;
+import org.apache.syncope.core.logic.ConnectorLogic;
+import org.apache.syncope.core.logic.UserLogic;
 import org.apache.syncope.fit.AbstractITCase;
 import org.junit.jupiter.api.Test;
 
 public class AuditITCase extends AbstractITCase {
 
-    private static AuditEntry query(final AuditQuery query, final int maxWaitSeconds, final boolean failIfEmpty) {
+    private static AuditEntry queryWithFailure(final AuditQuery query, final int maxWaitSeconds) {
         List<AuditEntry> results = query(query, maxWaitSeconds);
         if (results.isEmpty()) {
-            if (failIfEmpty) {
-                fail("Timeout when executing query for key " + query.getEntityKey());
-            }
+            fail("Timeout when executing query for key " + query.getEntityKey());
             return null;
         }
         return results.get(0);
     }
 
-    private static List<AuditEntry> query(final AuditQuery query, final int maxWaitSeconds) {
-        int i = 0;
-        List<AuditEntry> results = Collections.emptyList();
-        do {
-            try {
-                Thread.sleep(1000);
-            } catch (InterruptedException e) {
-            }
-            results = loggerService.search(query).getResult();
-            i++;
-        } while (results.isEmpty() && i < maxWaitSeconds);
-        return results;
-    }
-
     @Test
     public void userReadAndSearchYieldsNoAudit() {
         UserTO userTO = createUser(UserITCase.getUniqueSampleTO("audit@syncope.org")).getEntity();
         assertNotNull(userTO.getKey());
 
-        AuditQuery query = new AuditQuery.Builder(userTO.getKey()).build();
+        AuditQuery query = new AuditQuery.Builder().entityKey(userTO.getKey()).build();
         List<AuditEntry> entries = query(query, MAX_WAIT_SECONDS);
         assertEquals(1, entries.size());
 
@@ -99,9 +84,9 @@ public class AuditITCase extends AbstractITCase {
         UserTO userTO = createUser(UserITCase.getUniqueSampleTO("audit@syncope.org")).getEntity();
         assertNotNull(userTO.getKey());
 
-        AuditQuery query = new AuditQuery.Builder(userTO.getKey()).orderBy("event_date desc").
+        AuditQuery query = new AuditQuery.Builder().entityKey(userTO.getKey()).orderBy("event_date desc").
                 page(1).size(1).build();
-        AuditEntry entry = query(query, MAX_WAIT_SECONDS, true);
+        AuditEntry entry = queryWithFailure(query, MAX_WAIT_SECONDS);
         assertNotNull(entry);
         userService.delete(userTO.getKey());
     }
@@ -111,16 +96,17 @@ public class AuditITCase extends AbstractITCase {
         UserTO userTO = createUser(UserITCase.getUniqueSampleTO("audit-2@syncope.org")).getEntity();
         assertNotNull(userTO.getKey());
 
-        AuditQuery query = new AuditQuery.Builder(userTO.getKey()).
+        AuditQuery query = new AuditQuery.Builder().
+                entityKey(userTO.getKey()).
                 orderBy("event_date desc").
                 page(1).
                 size(1).
                 type(AuditElements.EventCategoryType.LOGIC).
-                category("UserLogic").
+                category(UserLogic.class.getSimpleName()).
                 event("create").
                 result(AuditElements.Result.SUCCESS).
                 build();
-        AuditEntry entry = query(query, MAX_WAIT_SECONDS, true);
+        AuditEntry entry = queryWithFailure(query, MAX_WAIT_SECONDS);
         assertNotNull(entry);
         userService.delete(userTO.getKey());
     }
@@ -130,9 +116,9 @@ public class AuditITCase extends AbstractITCase {
         GroupTO groupTO = createGroup(GroupITCase.getBasicSampleTO("AuditGroup")).getEntity();
         assertNotNull(groupTO.getKey());
 
-        AuditQuery query = new AuditQuery.Builder(groupTO.getKey()).orderBy("event_date desc").
+        AuditQuery query = new AuditQuery.Builder().entityKey(groupTO.getKey()).orderBy("event_date desc").
                 page(1).size(1).build();
-        AuditEntry entry = query(query, MAX_WAIT_SECONDS, true);
+        AuditEntry entry = queryWithFailure(query, MAX_WAIT_SECONDS);
         assertNotNull(entry);
         groupService.delete(groupTO.getKey());
     }
@@ -142,15 +128,13 @@ public class AuditITCase extends AbstractITCase {
         GroupTO groupTO = createGroup(GroupITCase.getBasicSampleTO("AuditGroupSearch")).getEntity();
         assertNotNull(groupTO.getKey());
 
-        AuditQuery query = new AuditQuery.Builder(groupTO.getKey()).build();
+        AuditQuery query = new AuditQuery.Builder().entityKey(groupTO.getKey()).build();
         List<AuditEntry> entries = query(query, MAX_WAIT_SECONDS);
         assertEquals(1, entries.size());
 
-        PagedResult<GroupTO> groups = groupService.search(
-                new AnyQuery.Builder().realm(SyncopeConstants.ROOT_REALM).
-                        fiql(SyncopeClient.getGroupSearchConditionBuilder().
-                                is("name").equalTo(groupTO.getName()).query()).
-                        build());
+        PagedResult<GroupTO> groups = groupService.search(new AnyQuery.Builder().realm(SyncopeConstants.ROOT_REALM).
+                fiql(SyncopeClient.getGroupSearchConditionBuilder().is("name").equalTo(groupTO.getName()).query()).
+                build());
         assertNotNull(groups);
         assertFalse(groups.getResult().isEmpty());
 
@@ -162,9 +146,9 @@ public class AuditITCase extends AbstractITCase {
     public void findByAnyObject() {
         AnyObjectTO anyObjectTO = createAnyObject(AnyObjectITCase.getSampleTO("Italy")).getEntity();
         assertNotNull(anyObjectTO.getKey());
-        AuditQuery query = new AuditQuery.Builder(anyObjectTO.getKey()).orderBy("event_date desc").
-                page(1).size(1).build();
-        AuditEntry entry = query(query, MAX_WAIT_SECONDS, true);
+        AuditQuery query = new AuditQuery.Builder().entityKey(anyObjectTO.getKey()).
+                orderBy("event_date desc").page(1).size(1).build();
+        AuditEntry entry = queryWithFailure(query, MAX_WAIT_SECONDS);
         assertNotNull(entry);
         anyObjectService.delete(anyObjectTO.getKey());
     }
@@ -175,7 +159,7 @@ public class AuditITCase extends AbstractITCase {
         anyObjectTO = createAnyObject(anyObjectTO).getEntity();
         assertNotNull(anyObjectTO);
 
-        AuditQuery query = new AuditQuery.Builder(anyObjectTO.getKey()).build();
+        AuditQuery query = new AuditQuery.Builder().entityKey(anyObjectTO.getKey()).build();
         List<AuditEntry> entries = query(query, MAX_WAIT_SECONDS);
         assertEquals(1, entries.size());
 
@@ -194,10 +178,11 @@ public class AuditITCase extends AbstractITCase {
     public void findByConnector() throws JsonProcessingException {
         String connectorKey = "74141a3b-0762-4720-a4aa-fc3e374ef3ef";
 
-        AuditQuery query = new AuditQuery.Builder(connectorKey).
+        AuditQuery query = new AuditQuery.Builder().
+                entityKey(connectorKey).
                 orderBy("event_date desc").
                 type(AuditElements.EventCategoryType.LOGIC).
-                category("ConnectorLogic").
+                category(ConnectorLogic.class.getSimpleName()).
                 event("update").
                 result(AuditElements.Result.SUCCESS).
                 build();
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/AuthenticationITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/AuthenticationITCase.java
index ddae619..f08cb6b 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/AuthenticationITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/AuthenticationITCase.java
@@ -27,6 +27,8 @@ import static org.junit.jupiter.api.Assumptions.assumeFalse;
 import static org.junit.jupiter.api.Assumptions.assumeTrue;
 
 import java.security.AccessControlException;
+import java.util.Collections;
+import java.util.List;
 import java.util.Map;
 import java.util.Set;
 import java.util.stream.Collectors;
@@ -34,7 +36,7 @@ import javax.sql.DataSource;
 import javax.ws.rs.ForbiddenException;
 import javax.ws.rs.core.GenericType;
 import javax.ws.rs.core.Response;
-import org.apache.commons.lang3.tuple.Pair;
+import org.apache.commons.lang3.tuple.Triple;
 import org.apache.syncope.client.lib.AnonymousAuthenticationHandler;
 import org.apache.syncope.client.lib.BasicAuthenticationHandler;
 import org.apache.syncope.client.lib.SyncopeClient;
@@ -107,22 +109,25 @@ public class AuthenticationITCase extends AbstractITCase {
         }
 
         // 2. as anonymous
-        Pair<Map<String, Set<String>>, UserTO> self = clientFactory.create(
+        Triple<Map<String, Set<String>>, List<String>, UserTO> self = clientFactory.create(
                 new AnonymousAuthenticationHandler(ANONYMOUS_UNAME, ANONYMOUS_KEY)).self();
         assertEquals(1, self.getLeft().size());
         assertTrue(self.getLeft().keySet().contains(StandardEntitlement.ANONYMOUS));
+        assertEquals(Collections.emptyList(), self.getMiddle());
         assertEquals(ANONYMOUS_UNAME, self.getRight().getUsername());
 
         // 3. as admin
         self = adminClient.self();
         assertEquals(syncopeService.platform().getEntitlements().size(), self.getLeft().size());
         assertFalse(self.getLeft().keySet().contains(StandardEntitlement.ANONYMOUS));
+        assertEquals(Collections.emptyList(), self.getMiddle());
         assertEquals(ADMIN_UNAME, self.getRight().getUsername());
 
         // 4. as user
         self = clientFactory.create("bellini", ADMIN_PWD).self();
         assertFalse(self.getLeft().isEmpty());
         assertFalse(self.getLeft().keySet().contains(StandardEntitlement.ANONYMOUS));
+        assertEquals(Collections.emptyList(), self.getMiddle());
         assertEquals("bellini", self.getRight().getUsername());
     }
 
@@ -615,10 +620,11 @@ public class AuthenticationITCase extends AbstractITCase {
         assertEquals("active", userTO.getStatus());
 
         // 4. try to authenticate again: success
-        Pair<Map<String, Set<String>>, UserTO> self =
+        Triple<Map<String, Set<String>>, List<String>, UserTO> self =
                 clientFactory.create(userTO.getUsername(), "password123").self();
         assertNotNull(self);
         assertNotNull(self.getLeft());
+        assertEquals(Collections.emptyList(), self.getMiddle());
         assertNotNull(self.getRight());
     }
 
@@ -651,7 +657,7 @@ public class AuthenticationITCase extends AbstractITCase {
         assertEquals(Encryptor.getInstance().encode("password123", CipherAlgorithm.SHA1), value.toUpperCase());
 
         // 5. successfully authenticate with old (on db resource) and new (on internal storage) password values
-        Pair<Map<String, Set<String>>, UserTO> self =
+        Triple<Map<String, Set<String>>, List<String>, UserTO> self =
                 clientFactory.create(user.getUsername(), "password123").self();
         assertNotNull(self);
         self = clientFactory.create(user.getUsername(), "password234").self();
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/DelegationITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/DelegationITCase.java
new file mode 100644
index 0000000..f359ee5
--- /dev/null
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/DelegationITCase.java
@@ -0,0 +1,271 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.syncope.fit.core;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
+
+import java.security.AccessControlException;
+import java.util.Collections;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import javax.ws.rs.ForbiddenException;
+import javax.ws.rs.core.Response;
+import org.apache.commons.lang3.tuple.Triple;
+import org.apache.syncope.client.lib.SyncopeClient;
+import org.apache.syncope.common.lib.SyncopeClientException;
+import org.apache.syncope.common.lib.SyncopeConstants;
+import org.apache.syncope.common.lib.log.AuditEntry;
+import org.apache.syncope.common.lib.log.LoggerTO;
+import org.apache.syncope.common.lib.to.DelegationTO;
+import org.apache.syncope.common.lib.to.UserTO;
+import org.apache.syncope.common.lib.types.AuditElements;
+import org.apache.syncope.common.lib.types.AuditLoggerName;
+import org.apache.syncope.common.lib.types.ClientExceptionType;
+import org.apache.syncope.common.lib.types.LoggerLevel;
+import org.apache.syncope.common.lib.types.LoggerType;
+import org.apache.syncope.common.rest.api.beans.AnyQuery;
+import org.apache.syncope.common.rest.api.beans.AuditQuery;
+import org.apache.syncope.common.rest.api.service.DelegationService;
+import org.apache.syncope.common.rest.api.service.UserService;
+import org.apache.syncope.core.logic.UserLogic;
+import org.apache.syncope.fit.AbstractITCase;
+import org.junit.jupiter.api.Test;
+
+public class DelegationITCase extends AbstractITCase {
+
+    private DelegationTO create(final DelegationService ds, final DelegationTO delegation) {
+        Response response = ds.create(delegation);
+        if (response.getStatusInfo().getStatusCode() != Response.Status.CREATED.getStatusCode()) {
+            Exception ex = clientFactory.getExceptionMapper().fromResponse(response);
+            if (ex != null) {
+                throw (RuntimeException) ex;
+            }
+        }
+        return getObject(response.getLocation(), DelegationService.class, DelegationTO.class);
+    }
+
+    @Test
+    public void crudAsAdmin() {
+        // 1. create users        
+        UserTO delegating = UserITCase.getUniqueSampleTO("delegating@syncope.apache.org");
+        delegating.getRoles().add("User reviewer");
+        delegating = createUser(delegating).getEntity();
+        assertNotNull(delegating.getKey());
+
+        UserTO delegated = UserITCase.getUniqueSampleTO("delegated@syncope.apache.org");
+        delegated = createUser(delegated).getEntity();
+        assertNotNull(delegated.getKey());
+
+        DelegationTO delegation = new DelegationTO();
+        delegation.setDelegating(delegating.getKey());
+        delegation.setDelegated(delegated.getKey());
+
+        // no dates set -> FAIL
+        try {
+            delegationService.create(delegation);
+            fail();
+        } catch (SyncopeClientException e) {
+            assertEquals(ClientExceptionType.InvalidEntity, e.getType());
+        }
+
+        delegation.setStart(new Date());
+        delegation.setEnd(new Date(System.currentTimeMillis() - 1000));
+
+        // end before start -> FAIL
+        try {
+            delegationService.create(delegation);
+            fail();
+        } catch (SyncopeClientException e) {
+            assertEquals(ClientExceptionType.InvalidEntity, e.getType());
+        }
+
+        delegation.setEnd(new Date());
+
+        // 2. create delegation
+        delegation = create(delegationService, delegation);
+        assertNotNull(delegation.getKey());
+        assertNotNull(delegation.getEnd());
+
+        // 3. verify delegation is reported for users
+        delegating = userService.read(delegating.getKey());
+        assertEquals(Collections.singletonList(delegation.getKey()), delegating.getDelegatingDelegations());
+        assertEquals(Collections.emptyList(), delegating.getDelegatedDelegations());
+
+        delegated = userService.read(delegated.getKey());
+        assertEquals(Collections.emptyList(), delegated.getDelegatingDelegations());
+        assertEquals(Collections.singletonList(delegation.getKey()), delegated.getDelegatedDelegations());
+
+        // 4. update and read delegation
+        delegation.setEnd(null);
+        delegationService.update(delegation);
+
+        delegation = delegationService.read(delegation.getKey());
+        assertNull(delegation.getEnd());
+
+        // 5. delete delegation
+        delegationService.delete(delegation.getKey());
+
+        try {
+            delegationService.read(delegation.getKey());
+            fail();
+        } catch (SyncopeClientException e) {
+            assertEquals(ClientExceptionType.NotFound, e.getType());
+        }
+
+        // 6. verify delegation is not reported for users
+        delegating = userService.read(delegating.getKey());
+        assertEquals(Collections.emptyList(), delegating.getDelegatingDelegations());
+        assertEquals(Collections.emptyList(), delegating.getDelegatedDelegations());
+
+        delegated = userService.read(delegated.getKey());
+        assertEquals(Collections.emptyList(), delegated.getDelegatingDelegations());
+        assertEquals(Collections.emptyList(), delegated.getDelegatedDelegations());
+    }
+
+    @Test
+    public void crudAsUser() {
+        // 1. create users        
+        UserTO delegating = UserITCase.getUniqueSampleTO("delegating@syncope.apache.org");
+        delegating.getRoles().add("User reviewer");
+        delegating = createUser(delegating).getEntity();
+        assertNotNull(delegating.getKey());
+
+        UserTO delegated = UserITCase.getUniqueSampleTO("delegated@syncope.apache.org");
+        delegated = createUser(delegated).getEntity();
+        assertNotNull(delegated.getKey());
+
+        DelegationTO delegation = new DelegationTO();
+        delegation.setDelegating("c9b2dec2-00a7-4855-97c0-d854842b4b24");
+        delegation.setDelegated(delegated.getKey());
+        delegation.setStart(new Date());
+
+        DelegationService uds = clientFactory.create(delegating.getUsername(), "password123").
+                getService(DelegationService.class);
+
+        // delegating user is not requesting user -> FAIL
+        try {
+            create(uds, delegation);
+            fail();
+        } catch (SyncopeClientException e) {
+            assertEquals(ClientExceptionType.DelegatedAdministration, e.getType());
+        }
+
+        // 2. create delegation
+        delegation.setDelegating(delegating.getKey());
+
+        delegation = create(uds, delegation);
+        assertNotNull(delegation.getKey());
+        assertNull(delegation.getEnd());
+
+        // 3. update and read delegation
+        delegation.setEnd(new Date());
+        uds.update(delegation);
+
+        delegation = uds.read(delegation.getKey());
+        assertNotNull(delegation.getEnd());
+
+        // 4. delete delegation
+        uds.delete(delegation.getKey());
+
+        try {
+            uds.read(delegation.getKey());
+            fail();
+        } catch (SyncopeClientException e) {
+            assertEquals(ClientExceptionType.NotFound, e.getType());
+        }
+    }
+
+    @Test
+    public void operations() {
+        // 0. enable audit
+        AuditLoggerName authLoginSuccess = new AuditLoggerName.Builder().
+                type(AuditElements.EventCategoryType.LOGIC).
+                category(UserLogic.class.getSimpleName()).
+                event("search").
+                result(AuditElements.Result.SUCCESS).build();
+        LoggerTO authLogin = new LoggerTO();
+        authLogin.setKey(authLoginSuccess.toLoggerName());
+        authLogin.setLevel(LoggerLevel.DEBUG);
+        loggerService.update(LoggerType.AUDIT, authLogin);
+
+        // 1. bellini delegates rossini
+        DelegationTO delegation = new DelegationTO();
+        delegation.setDelegating("bellini");
+        delegation.setDelegated("rossini");
+        delegation.setStart(new Date());
+        delegation = create(delegationService, delegation);
+        assertNotNull(delegation.getKey());
+
+        // 2. search users as bellini
+        SyncopeClient bellini = clientFactory.create("bellini", "password");
+        int forBellini = bellini.getService(UserService.class).search(
+                new AnyQuery.Builder().realm(SyncopeConstants.ROOT_REALM).build()).getTotalCount();
+
+        SyncopeClient rossini = clientFactory.create("rossini", "password");
+
+        // 3. search users as rossini
+        Triple<Map<String, Set<String>>, List<String>, UserTO> self = rossini.self();
+        assertEquals(Collections.singletonList("bellini"), self.getMiddle());
+
+        // 3a. search users as rossini without delegation -> FAIL
+        try {
+            rossini.getService(UserService.class).search(
+                    new AnyQuery.Builder().realm(SyncopeConstants.ROOT_REALM).build());
+            fail();
+        } catch (ForbiddenException e) {
+            assertNotNull(e);
+        }
+
+        // 3b. search users as rossini with delegation -> SUCCESS
+        int forRossini = rossini.delegatedBy("bellini").getService(UserService.class).search(
+                new AnyQuery.Builder().realm(SyncopeConstants.ROOT_REALM).build()).getTotalCount();
+        assertEquals(forBellini, forRossini);
+
+        // 4. delete delegation: searching users as rossini does not work, even with delegation
+        delegationService.delete(delegation.getKey());
+
+        try {
+            rossini.getService(UserService.class).search(
+                    new AnyQuery.Builder().realm(SyncopeConstants.ROOT_REALM).build());
+            fail();
+        } catch (AccessControlException e) {
+            assertNotNull(e);
+        }
+
+        // 5. query audit entries
+        AuditQuery query = new AuditQuery.Builder().
+                type(authLoginSuccess.getType()).
+                category(authLoginSuccess.getCategory()).
+                event(authLoginSuccess.getEvent()).
+                result(authLoginSuccess.getResult()).
+                build();
+        List<AuditEntry> entries = query(query, MAX_WAIT_SECONDS);
+        assertTrue(entries.stream().anyMatch(entry -> "rossini [delegated by bellini]".equals(entry.getWho())));
+
+        // 6. disable audit
+        authLogin.setLevel(LoggerLevel.OFF);
+        loggerService.update(LoggerType.AUDIT, authLogin);
+    }
+}
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/JWTITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/JWTITCase.java
index 2dfa0b5..5e835dd 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/JWTITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/JWTITCase.java
@@ -31,12 +31,13 @@ import java.text.ParseException;
 import java.text.SimpleDateFormat;
 import java.util.Calendar;
 import java.util.Date;
+import java.util.List;
 import java.util.Map;
 import java.util.Set;
 import java.util.UUID;
 import javax.ws.rs.core.Response;
 import javax.xml.ws.WebServiceException;
-import org.apache.commons.lang3.tuple.Pair;
+import org.apache.commons.lang3.tuple.Triple;
 import org.apache.cxf.rs.security.jose.common.JoseType;
 import org.apache.cxf.rs.security.jose.jwa.SignatureAlgorithm;
 import org.apache.cxf.rs.security.jose.jws.HmacJwsSignatureProvider;
@@ -436,7 +437,7 @@ public class JWTITCase extends AbstractITCase {
 
         SyncopeClient jwtClient = clientFactory.create(signed);
 
-        Pair<Map<String, Set<String>>, UserTO> self = jwtClient.self();
+        Triple<Map<String, Set<String>>, List<String>, UserTO> self = jwtClient.self();
         assertFalse(self.getLeft().isEmpty());
         assertEquals("puccini", self.getRight().getUsername());
     }
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/PullTaskITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/PullTaskITCase.java
index 2060bf8..1fded4a 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/PullTaskITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/PullTaskITCase.java
@@ -35,6 +35,7 @@ import java.nio.charset.StandardCharsets;
 import java.util.Collections;
 import java.util.Date;
 import java.util.HashSet;
+import java.util.List;
 import java.util.Locale;
 import java.util.Map;
 import java.util.Optional;
@@ -45,7 +46,7 @@ import javax.sql.DataSource;
 import javax.ws.rs.core.Response;
 import org.apache.commons.io.IOUtils;
 import org.apache.commons.lang3.SerializationUtils;
-import org.apache.commons.lang3.tuple.Pair;
+import org.apache.commons.lang3.tuple.Triple;
 import org.apache.syncope.client.lib.SyncopeClient;
 import org.apache.syncope.client.lib.SyncopeClientFactoryBean;
 import org.apache.syncope.common.lib.SyncopeClientException;
@@ -1177,7 +1178,8 @@ public class PullTaskITCase extends AbstractTaskITCase {
         assertEquals(ExecStatus.SUCCESS, ExecStatus.valueOf(execution.getStatus()));
 
         // 5. Test the pulled user
-        Pair<Map<String, Set<String>>, UserTO> self = clientFactory.create(user.getUsername(), newCleanPassword).self();
+        Triple<Map<String, Set<String>>, List<String>, UserTO> self =
+                clientFactory.create(user.getUsername(), newCleanPassword).self();
         assertNotNull(self);
 
         // 6. Delete PullTask + user
@@ -1212,7 +1214,7 @@ public class PullTaskITCase extends AbstractTaskITCase {
             user = updateUser(userPatch).getEntity();
 
             // 3. Check that the Syncope user now has the changed password
-            Pair<Map<String, Set<String>>, UserTO> self =
+            Triple<Map<String, Set<String>>, List<String>, UserTO> self =
                     clientFactory.create(user.getUsername(), newCleanPassword).self();
             assertNotNull(self);
 
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/UserITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/UserITCase.java
index b767d33..65c0496 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/UserITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/UserITCase.java
@@ -43,7 +43,7 @@ import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.Response;
 import org.apache.commons.lang3.RandomStringUtils;
 import org.apache.commons.lang3.time.DateFormatUtils;
-import org.apache.commons.lang3.tuple.Pair;
+import org.apache.commons.lang3.tuple.Triple;
 import org.apache.cxf.jaxrs.client.WebClient;
 import org.apache.syncope.client.lib.SyncopeClient;
 import org.apache.syncope.client.lib.batch.BatchRequest;
@@ -344,7 +344,7 @@ public class UserITCase extends AbstractITCase {
 
         // 3. verify password
         try {
-            Pair<Map<String, Set<String>>, UserTO> self =
+            Triple<Map<String, Set<String>>, List<String>, UserTO> self =
                     clientFactory.create(newUserTO.getUsername(), "password123").self();
             assertNotNull(self);
         } catch (AccessControlException e) {
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/UserIssuesITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/UserIssuesITCase.java
index f11c07b..8d9d12b 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/UserIssuesITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/UserIssuesITCase.java
@@ -40,7 +40,7 @@ import javax.sql.DataSource;
 import javax.ws.rs.core.GenericType;
 import javax.ws.rs.core.Response;
 import org.apache.commons.lang3.SerializationUtils;
-import org.apache.commons.lang3.tuple.Pair;
+import org.apache.commons.lang3.tuple.Triple;
 import org.apache.cxf.helpers.IOUtils;
 import org.apache.syncope.client.lib.SyncopeClient;
 import org.apache.syncope.common.lib.SyncopeClientException;
@@ -1155,7 +1155,7 @@ public class UserIssuesITCase extends AbstractITCase {
         assertEquals(
                 "passwordTESTNULL1",
                 connObjectTO.getAttr(OperationalAttributes.PASSWORD_NAME).get().getValues().get(0));
-        Pair<Map<String, Set<String>>, UserTO> self =
+        Triple<Map<String, Set<String>>, List<String>, UserTO> self =
                 clientFactory.create(userTO.getUsername(), "passwordTESTNULL1").self();
         assertNotNull(self);
 
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/UserSelfITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/UserSelfITCase.java
index af8c1d3..843546e 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/UserSelfITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/UserSelfITCase.java
@@ -38,7 +38,7 @@ import javax.ws.rs.ForbiddenException;
 import javax.ws.rs.core.GenericType;
 import javax.ws.rs.core.Response;
 import org.apache.commons.lang3.StringUtils;
-import org.apache.commons.lang3.tuple.Pair;
+import org.apache.commons.lang3.tuple.Triple;
 import org.apache.syncope.client.lib.SyncopeClient;
 import org.apache.syncope.client.lib.SyncopeClientFactoryBean;
 import org.apache.syncope.common.lib.SyncopeClientException;
@@ -208,7 +208,8 @@ public class UserSelfITCase extends AbstractITCase {
             assertNotNull(e);
         }
 
-        Pair<Map<String, Set<String>>, UserTO> self = clientFactory.create(user.getUsername(), "password123").self();
+        Triple<Map<String, Set<String>>, List<String>, UserTO> self =
+                clientFactory.create(user.getUsername(), "password123").self();
         assertEquals(user.getUsername(), self.getRight().getUsername());
     }
 
@@ -219,7 +220,7 @@ public class UserSelfITCase extends AbstractITCase {
         String userId = rossini.getPlainAttr("userId").get().getValues().get(0);
         assertNotNull(userId);
 
-        Pair<Map<String, Set<String>>, UserTO> self = clientFactory.create(userId, ADMIN_PWD).self();
+        Triple<Map<String, Set<String>>, List<String>, UserTO> self = clientFactory.create(userId, ADMIN_PWD).self();
         assertEquals(rossini.getUsername(), self.getRight().getUsername());
     }
 
@@ -466,7 +467,8 @@ public class UserSelfITCase extends AbstractITCase {
         vivaldiClient.getService(UserSelfService.class).mustChangePassword("password123");
 
         // 4. verify it worked
-        Pair<Map<String, Set<String>>, UserTO> self = clientFactory.create("vivaldi", "password123").self();
+        Triple<Map<String, Set<String>>, List<String>, UserTO> self =
+                clientFactory.create("vivaldi", "password123").self();
         assertFalse(self.getRight().isMustChangePassword());
     }
 
diff --git a/src/main/asciidoc/reference-guide/concepts/roles.adoc b/src/main/asciidoc/reference-guide/concepts/roles.adoc
index 9f5073b..216de6c 100644
--- a/src/main/asciidoc/reference-guide/concepts/roles.adoc
+++ b/src/main/asciidoc/reference-guide/concepts/roles.adoc
@@ -127,3 +127,23 @@ The actual Entitlements are assigned through the predefined `GROUP_OWNER` Role:
 . `GROUP_READ`
 . `GROUP_UPDATE`
 . `GROUP_DELETE`
+
+The `GROUP_OWNER` Role can be updated to adjust the set of assigned Entitlements.
+
+==== Delegation
+
+With Delegation, any user can delegate other users to perform operations on their behalf.
+
+In order to set up a Delegation, the following information shall be provided:
+
+* delegating User (mandatory) - administrators granted with `DELEGATION_CREATE` Entitlement can create Delegations for
+all defined Users; otherwise, the only accepted value is the User itself;
+* delegated User (mandatory) - any User defined, distinct from delegating;
+* start (mandatory) - initial timestamp from which the Delegation is considered effective;
+* end (optional) - final timestamp after which the Delegation is not considered effective: when not provided, Delegation
+will remain valid unless deleted;
+* roles (optional) - set of Roles granted by delegating to delegated User: only Roles owned by delegating can be
+granted, when not provided all owned Roles are considered as part of the Delegation.
+
+[NOTE]
+<<Audit>> entries generated when operating under Delegation will report both delegating and delegated users.
diff --git a/src/main/asciidoc/reference-guide/workingwithapachesyncope/restfulservices.adoc b/src/main/asciidoc/reference-guide/workingwithapachesyncope/restfulservices.adoc
index 1f6fc23..c9bdbec 100644
--- a/src/main/asciidoc/reference-guide/workingwithapachesyncope/restfulservices.adoc
+++ b/src/main/asciidoc/reference-guide/workingwithapachesyncope/restfulservices.adoc
@@ -159,6 +159,11 @@ https://github.com/apache/syncope/blob/2_1_X/common/lib/src/main/java/org/apache
 endif::[]
 and `X-Application-Error-Info` might be optionally populated with more details, if available.
 
+===== X-Syncope-Delegated-By
+
+When requesting an operation under <<delegation,Delegation>>, this header must be provided to indicate the delegating
+User, either by their username or key.
+
 ===== X-Syncope-Null-Priority-Async
 
 When set to `true`, this request header instructs the <<propagation,propagation process>> not to wait for completion
@@ -204,6 +209,11 @@ Groups and Any Objects operations.
 When invoking the REST endpoint `/users/self` in `GET`, the `X-Syncope-Entitlements` response header will list all
 the <<entitlements,entitlements>> owned by the requesting user.
 
+===== X-Syncope-Delegations
+
+When invoking the REST endpoint `/users/self` in `GET`, the `X-Syncope-Delegations` response header will list all
+delegating users for each <<delegation,Delegation>> for which the requesting user is delegated.
+
 ===== X-Syncope-Privileges
 
 When invoking the REST endpoint `/users/self` in `GET`, the `X-Syncope-Privileges` response header will list all