You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@syncope.apache.org by md...@apache.org on 2015/08/27 13:12:43 UTC

[16/33] syncope git commit: [SYNCOPE-685] Now account and password policies can be composed of several 'rules', where each rule can be provided as a separate Java class (similar to Reportlet mechanism); previous account and password policies are now impl

[SYNCOPE-685] Now account and password policies can be composed of several 'rules', where each rule can be provided as a separate Java class (similar to Reportlet mechanism); previous account and password policies are now implemented as default rules - also contain SYNCOPE-626


Project: http://git-wip-us.apache.org/repos/asf/syncope/repo
Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/b8cadde8
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/b8cadde8
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/b8cadde8

Branch: refs/heads/SYNCOPE-156
Commit: b8cadde8ec53da6834792b356cfe40a454193644
Parents: 77f697b
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Thu Aug 20 11:47:26 2015 +0200
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Thu Aug 20 11:47:26 2015 +0200

----------------------------------------------------------------------
 .../client/cli/commands/PolicyCommand.java      |   2 +-
 .../client/cli/commands/ReportCommand.java      |  14 -
 .../console/panels/ResourceSecurityPanel.java   |   2 +-
 .../client/console/rest/PolicyRestClient.java   |   2 +-
 .../client/console/rest/ReportRestClient.java   |  18 --
 .../client/lib/SyncopeClientFactoryBean.java    |   2 +-
 .../lib/policy/AbstractAccountRuleConf.java     |  12 +-
 .../lib/policy/AbstractPasswordRuleConf.java    |  12 +-
 .../common/lib/policy/AccountPolicyTO.java      |   4 +-
 .../lib/policy/DefaultAccountRuleConf.java      |  55 +++-
 .../lib/policy/DefaultPasswordRuleConf.java     |  67 +++-
 .../common/lib/policy/PasswordPolicyTO.java     |   4 +-
 .../common/lib/report/StaticReportletConf.java  |   2 +-
 .../syncope/common/lib/to/AbstractPolicyTO.java |  97 ------
 .../syncope/common/lib/to/AccountPolicyTO.java  |  59 ----
 .../syncope/common/lib/to/PasswordPolicyTO.java |  46 ---
 .../syncope/common/lib/to/SyncPolicyTO.java     |  46 ---
 .../apache/syncope/common/lib/to/SyncopeTO.java |  28 ++
 .../common/lib/types/AbstractPolicySpec.java    | 100 ------
 .../common/lib/types/AccountPolicySpec.java     | 121 --------
 .../common/lib/types/PasswordPolicySpec.java    | 300 ------------------
 .../syncope/common/lib/types/PolicyType.java    |  43 ---
 .../common/lib/types/PushPolicySpec.java        |  28 --
 .../common/lib/types/SyncPolicySpec.java        |  62 ----
 .../common/rest/api/service/PolicyService.java  |   2 +-
 .../common/rest/api/service/ReportService.java  |  11 -
 .../apache/syncope/core/logic/PolicyLogic.java  |  14 +-
 .../apache/syncope/core/logic/ReportLogic.java  |  75 -----
 .../apache/syncope/core/logic/SyncopeLogic.java |   7 +
 .../init/ImplementationClassNamesLoader.java    |  13 +
 .../core/logic/report/AbstractReportlet.java    |  21 +-
 .../core/logic/report/GroupReportlet.java       |  13 +-
 .../core/logic/report/ReportJobDelegate.java    |  63 +++-
 .../syncope/core/logic/report/Reportlet.java    |  14 +-
 .../core/logic/report/StaticReportlet.java      |  38 ++-
 .../core/logic/report/UserReportlet.java        |  13 +-
 .../syncope/core/misc/ConnObjectUtils.java      |  24 +-
 .../apache/syncope/core/misc/MappingUtils.java  |   6 +-
 .../core/misc/policy/AccountPolicyEnforcer.java |  85 -----
 .../InvalidPasswordPolicySpecException.java     |  37 ---
 .../misc/policy/PasswordPolicyEnforcer.java     | 193 ------------
 .../core/misc/policy/PolicyEvaluator.java       | 100 ------
 .../misc/security/DefaultPasswordGenerator.java |  96 +++---
 .../core/misc/security/PasswordGenerator.java   | 310 +------------------
 .../misc/src/main/resources/security.properties |   1 +
 .../misc/src/main/resources/securityContext.xml |   1 +
 .../misc/security/PasswordGeneratorTest.java    | 146 ++++-----
 .../core/persistence/api/dao/AccountRule.java   |   9 +-
 .../core/persistence/api/dao/PasswordRule.java  |   9 +-
 .../core/persistence/api/dao/PolicyDAO.java     |   2 +-
 .../persistence/api/entity/AccountPolicy.java   |  38 ---
 .../persistence/api/entity/PasswordPolicy.java  |  29 --
 .../core/persistence/api/entity/PushPolicy.java |  28 --
 .../core/persistence/api/entity/Realm.java      |   3 +
 .../core/persistence/api/entity/Report.java     |   2 +-
 .../api/entity/ReportletConfInstance.java       |  33 --
 .../core/persistence/api/entity/SyncPolicy.java |  29 --
 .../api/entity/policy/AccountPolicy.java        |   2 +-
 .../api/entity/policy/PasswordPolicy.java       |   2 +-
 .../api/entity/resource/ExternalResource.java   |   6 +-
 .../persistence/jpa/dao/DefaultAccountRule.java |  29 +-
 .../jpa/dao/DefaultPasswordRule.java            |  61 ++--
 .../jpa/dao/JPAExternalResourceDAO.java         |   2 +-
 .../core/persistence/jpa/dao/JPAPolicyDAO.java  |  14 +-
 .../core/persistence/jpa/dao/JPARealmDAO.java   |   2 +-
 .../core/persistence/jpa/dao/JPATaskDAO.java    |   4 +-
 .../core/persistence/jpa/dao/JPAUserDAO.java    | 146 +++++++--
 .../jpa/entity/JPAAccountPolicy.java            |  96 ------
 .../jpa/entity/JPAEntityFactory.java            |  15 +-
 .../jpa/entity/JPAPasswordPolicy.java           |  48 ---
 .../core/persistence/jpa/entity/JPAPolicy.java  |  76 -----
 .../persistence/jpa/entity/JPAPushPolicy.java   |  47 ---
 .../core/persistence/jpa/entity/JPARealm.java   |   6 +-
 .../core/persistence/jpa/entity/JPAReport.java  |  27 +-
 .../jpa/entity/JPAReportletConfInstance.java    |   7 +-
 .../persistence/jpa/entity/JPASyncPolicy.java   |  48 ---
 .../jpa/entity/policy/JPAAccountPolicy.java     |  13 +-
 .../jpa/entity/policy/JPAPasswordPolicy.java    |  13 +-
 .../entity/resource/JPAExternalResource.java    |  12 +-
 .../jpa/entity/task/AbstractTask.java           |  11 +-
 .../jpa/entity/task/JPANotificationTask.java    |   2 +-
 .../jpa/entity/task/JPAPropagationTask.java     |   2 +-
 .../jpa/entity/task/JPASchedTask.java           |   2 +-
 .../persistence/jpa/entity/task/JPATask.java    |  96 ------
 .../jpa/entity/task/JPATaskExec.java            |  11 +-
 .../resources/META-INF/spring-orm-oracle.xml    |  22 +-
 .../resources/META-INF/spring-orm-sqlserver.xml |  22 +-
 .../src/main/resources/META-INF/spring-orm.xml  |  22 +-
 .../core/persistence/jpa/inner/PolicyTest.java  |  21 +-
 .../core/persistence/jpa/inner/RealmTest.java   |   4 +-
 .../core/persistence/jpa/inner/UserTest.java    |   6 +-
 .../persistence/jpa/outer/ResourceTest.java     |   2 +-
 .../test/resources/domains/MasterContent.xml    |  50 +--
 .../src/test/resources/persistenceTest.xml      |   2 +
 .../provisioning/api/data/PolicyDataBinder.java |   2 +-
 .../java/data/PolicyDataBinderImpl.java         |  90 ++++--
 .../java/data/RealmDataBinderImpl.java          |   4 +-
 .../java/data/ReportDataBinderImpl.java         |  33 +-
 .../java/data/ResourceDataBinderImpl.java       |   6 +-
 .../provisioning/java/sync/SyncJobDelegate.java |   2 +-
 .../core/provisioning/java/sync/SyncUtils.java  |   2 +-
 .../rest/cxf/service/PolicyServiceImpl.java     |   8 +-
 .../rest/cxf/service/ReportServiceImpl.java     |   7 -
 .../fit/core/reference/TestAccountRuleConf.java |  17 +-
 .../fit/core/reference/TestPasswordRule.java    |  26 +-
 .../core/reference/TestPasswordRuleConf.java    |  19 +-
 .../src/main/resources/log4j2.xml               |   2 +-
 .../fit/core/reference/AbstractITCase.java      |   2 +-
 .../fit/core/reference/PolicyITCase.java        |  51 ++-
 .../syncope/fit/core/reference/RealmITCase.java |  12 +-
 .../fit/core/reference/ReportITCase.java        |   7 +-
 .../fit/core/reference/SyncTaskITCase.java      |   2 +-
 .../syncope/fit/core/reference/UserITCase.java  | 106 +++++++
 113 files changed, 1036 insertions(+), 2904 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/syncope/blob/b8cadde8/client/cli/src/main/java/org/apache/syncope/client/cli/commands/PolicyCommand.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/PolicyCommand.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/PolicyCommand.java
index 6ea0d33..ae34f53 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/PolicyCommand.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/PolicyCommand.java
@@ -23,7 +23,7 @@ import com.beust.jcommander.Parameters;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.syncope.client.cli.SyncopeServices;
 import org.apache.syncope.common.lib.SyncopeClientException;
-import org.apache.syncope.common.lib.to.AbstractPolicyTO;
+import org.apache.syncope.common.lib.policy.AbstractPolicyTO;
 import org.apache.syncope.common.lib.types.PolicyType;
 import org.apache.syncope.common.rest.api.service.PolicyService;
 import org.slf4j.Logger;

http://git-wip-us.apache.org/repos/asf/syncope/blob/b8cadde8/client/cli/src/main/java/org/apache/syncope/client/cli/commands/ReportCommand.java
----------------------------------------------------------------------
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/ReportCommand.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/ReportCommand.java
index 2c4dba0..2ea9423 100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/ReportCommand.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/ReportCommand.java
@@ -33,7 +33,6 @@ import org.apache.syncope.common.lib.SyncopeClientException;
 import org.apache.syncope.common.lib.to.ReportExecTO;
 import org.apache.syncope.common.lib.to.ReportTO;
 import org.apache.syncope.common.lib.types.ReportExecExportFormat;
-import org.apache.syncope.common.lib.wrap.ReportletConfClass;
 import org.apache.syncope.common.rest.api.service.ReportService;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -84,9 +83,6 @@ public class ReportCommand extends AbstractCommand {
     @Parameter(names = { "-eer", "--export-execution-result" })
     private Long exportId = -1L;
 
-    @Parameter(names = { "-rc", "--reportlet-class" })
-    private boolean reportletClass = false;
-
     @Override
     public void execute() {
         final ReportService reportService = SyncopeServices.get(ReportService.class);
@@ -176,16 +172,6 @@ public class ReportCommand extends AbstractCommand {
                 LOG.error("Error calling configuration service", ex);
                 System.out.println(" - Error calling configuration service " + ex.getMessage());
             }
-        } else if (reportletClass) {
-            try {
-                LOG.debug("- reportlet configuration class list command");
-                System.out.println("Reportlet conf classes");
-                for (final ReportletConfClass reportletConfClass : reportService.getReportletConfClasses()) {
-                    System.out.println("  *** " + reportletConfClass.getElement());
-                }
-            } catch (final SyncopeClientException ex) {
-                System.out.println(" - Error: " + ex.getMessage());
-            }
         } else {
             System.out.println(helpMessage);
         }

http://git-wip-us.apache.org/repos/asf/syncope/blob/b8cadde8/client/console/src/main/java/org/apache/syncope/client/console/panels/ResourceSecurityPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/ResourceSecurityPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/ResourceSecurityPanel.java
index 15d2fe8..a0a1ddc 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/ResourceSecurityPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/ResourceSecurityPanel.java
@@ -23,7 +23,7 @@ import java.util.HashMap;
 import java.util.Map;
 import org.apache.syncope.client.console.rest.PolicyRestClient;
 import org.apache.syncope.client.console.wicket.markup.html.form.AjaxDropDownChoicePanel;
-import org.apache.syncope.common.lib.to.AbstractPolicyTO;
+import org.apache.syncope.common.lib.policy.AbstractPolicyTO;
 import org.apache.syncope.common.lib.to.ResourceTO;
 import org.apache.syncope.common.lib.types.PolicyType;
 import org.apache.wicket.markup.html.WebMarkupContainer;

http://git-wip-us.apache.org/repos/asf/syncope/blob/b8cadde8/client/console/src/main/java/org/apache/syncope/client/console/rest/PolicyRestClient.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/rest/PolicyRestClient.java b/client/console/src/main/java/org/apache/syncope/client/console/rest/PolicyRestClient.java
index e58f734..7f5964b 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/rest/PolicyRestClient.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/rest/PolicyRestClient.java
@@ -21,7 +21,7 @@ package org.apache.syncope.client.console.rest;
 import java.util.ArrayList;
 import java.util.List;
 import org.apache.syncope.client.console.SyncopeConsoleSession;
-import org.apache.syncope.common.lib.to.AbstractPolicyTO;
+import org.apache.syncope.common.lib.policy.AbstractPolicyTO;
 import org.apache.syncope.common.lib.types.PolicyType;
 import org.apache.syncope.common.rest.api.service.PolicyService;
 import org.springframework.stereotype.Component;

http://git-wip-us.apache.org/repos/asf/syncope/blob/b8cadde8/client/console/src/main/java/org/apache/syncope/client/console/rest/ReportRestClient.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/rest/ReportRestClient.java b/client/console/src/main/java/org/apache/syncope/client/console/rest/ReportRestClient.java
index 05af975..89617df 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/rest/ReportRestClient.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/rest/ReportRestClient.java
@@ -18,14 +18,11 @@
  */
 package org.apache.syncope.client.console.rest;
 
-import java.util.ArrayList;
 import java.util.List;
 import javax.ws.rs.core.Response;
 import org.apache.syncope.client.lib.SyncopeClient;
-import org.apache.syncope.common.lib.SyncopeClientException;
 import org.apache.syncope.common.lib.to.ReportTO;
 import org.apache.syncope.common.lib.types.ReportExecExportFormat;
-import org.apache.syncope.common.lib.wrap.ReportletConfClass;
 import org.apache.syncope.common.rest.api.service.ReportService;
 import org.apache.wicket.extensions.markup.html.repeater.util.SortParam;
 import org.springframework.stereotype.Component;
@@ -35,21 +32,6 @@ public class ReportRestClient extends BaseRestClient implements ExecutionRestCli
 
     private static final long serialVersionUID = 1644689667998953604L;
 
-    public List<String> getReportletConfClasses() {
-        List<String> result = new ArrayList<>();
-
-        try {
-            List<ReportletConfClass> reportletConfClasses = getService(ReportService.class).getReportletConfClasses();
-            for (ReportletConfClass clazz : reportletConfClasses) {
-                result.add(clazz.getElement());
-            }
-        } catch (SyncopeClientException e) {
-            LOG.error("While getting available reportlet classes", e);
-        }
-
-        return result;
-    }
-
     public ReportTO read(final Long reportId) {
         return getService(ReportService.class).read(reportId);
     }

http://git-wip-us.apache.org/repos/asf/syncope/blob/b8cadde8/client/lib/src/main/java/org/apache/syncope/client/lib/SyncopeClientFactoryBean.java
----------------------------------------------------------------------
diff --git a/client/lib/src/main/java/org/apache/syncope/client/lib/SyncopeClientFactoryBean.java b/client/lib/src/main/java/org/apache/syncope/client/lib/SyncopeClientFactoryBean.java
index a3a271c..968260f 100644
--- a/client/lib/src/main/java/org/apache/syncope/client/lib/SyncopeClientFactoryBean.java
+++ b/client/lib/src/main/java/org/apache/syncope/client/lib/SyncopeClientFactoryBean.java
@@ -31,7 +31,7 @@ import org.apache.cxf.feature.Feature;
 import org.apache.cxf.feature.LoggingFeature;
 import org.apache.cxf.jaxrs.provider.JAXBElementProvider;
 import org.apache.cxf.staxutils.DocumentDepthProperties;
-import org.apache.syncope.common.lib.to.AbstractPolicyTO;
+import org.apache.syncope.common.lib.policy.AbstractPolicyTO;
 import org.apache.syncope.common.rest.api.RESTHeaders;
 
 /**

http://git-wip-us.apache.org/repos/asf/syncope/blob/b8cadde8/common/lib/src/main/java/org/apache/syncope/common/lib/policy/AbstractAccountRuleConf.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/policy/AbstractAccountRuleConf.java b/common/lib/src/main/java/org/apache/syncope/common/lib/policy/AbstractAccountRuleConf.java
index 8fe5e24..8820779 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/policy/AbstractAccountRuleConf.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/policy/AbstractAccountRuleConf.java
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.syncope.common.lib.report;
+package org.apache.syncope.common.lib.policy;
 
 import javax.xml.bind.annotation.XmlSeeAlso;
 import javax.xml.bind.annotation.XmlType;
@@ -24,19 +24,19 @@ import org.apache.commons.lang3.StringUtils;
 import org.apache.syncope.common.lib.AbstractBaseBean;
 
 @XmlType
-@XmlSeeAlso({ StaticReportletConf.class, UserReportletConf.class, GroupReportletConf.class })
-public abstract class AbstractReportletConf extends AbstractBaseBean implements ReportletConf {
+@XmlSeeAlso({ DefaultAccountRuleConf.class })
+public abstract class AbstractAccountRuleConf extends AbstractBaseBean implements AccountRuleConf {
 
-    private static final long serialVersionUID = -6130008602014516608L;
+    private static final long serialVersionUID = -4080475005967851092L;
 
     private String name;
 
-    public AbstractReportletConf() {
+    public AbstractAccountRuleConf() {
         this(StringUtils.EMPTY);
         setName(getClass().getName());
     }
 
-    public AbstractReportletConf(final String name) {
+    public AbstractAccountRuleConf(final String name) {
         super();
         this.name = name;
     }

http://git-wip-us.apache.org/repos/asf/syncope/blob/b8cadde8/common/lib/src/main/java/org/apache/syncope/common/lib/policy/AbstractPasswordRuleConf.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/policy/AbstractPasswordRuleConf.java b/common/lib/src/main/java/org/apache/syncope/common/lib/policy/AbstractPasswordRuleConf.java
index 8fe5e24..6d35abd 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/policy/AbstractPasswordRuleConf.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/policy/AbstractPasswordRuleConf.java
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.syncope.common.lib.report;
+package org.apache.syncope.common.lib.policy;
 
 import javax.xml.bind.annotation.XmlSeeAlso;
 import javax.xml.bind.annotation.XmlType;
@@ -24,19 +24,19 @@ import org.apache.commons.lang3.StringUtils;
 import org.apache.syncope.common.lib.AbstractBaseBean;
 
 @XmlType
-@XmlSeeAlso({ StaticReportletConf.class, UserReportletConf.class, GroupReportletConf.class })
-public abstract class AbstractReportletConf extends AbstractBaseBean implements ReportletConf {
+@XmlSeeAlso({ DefaultPasswordRuleConf.class })
+public abstract class AbstractPasswordRuleConf extends AbstractBaseBean implements PasswordRuleConf {
 
-    private static final long serialVersionUID = -6130008602014516608L;
+    private static final long serialVersionUID = -5814018872387142339L;
 
     private String name;
 
-    public AbstractReportletConf() {
+    public AbstractPasswordRuleConf() {
         this(StringUtils.EMPTY);
         setName(getClass().getName());
     }
 
-    public AbstractReportletConf(final String name) {
+    public AbstractPasswordRuleConf(final String name) {
         super();
         this.name = name;
     }

http://git-wip-us.apache.org/repos/asf/syncope/blob/b8cadde8/common/lib/src/main/java/org/apache/syncope/common/lib/policy/AccountPolicyTO.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/policy/AccountPolicyTO.java b/common/lib/src/main/java/org/apache/syncope/common/lib/policy/AccountPolicyTO.java
index 67d9fe0..b1e1049 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/policy/AccountPolicyTO.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/policy/AccountPolicyTO.java
@@ -37,7 +37,7 @@ public class AccountPolicyTO extends AbstractPolicyTO {
 
     private int maxAuthenticationAttempts;
 
-    private final List<AccountRuleConf> ruleConfs = new ArrayList<>();
+    private final List<AbstractAccountRuleConf> ruleConfs = new ArrayList<>();
 
     private final List<String> resources = new ArrayList<>();
 
@@ -64,7 +64,7 @@ public class AccountPolicyTO extends AbstractPolicyTO {
     @XmlElementWrapper(name = "ruleConfs")
     @XmlElement(name = "ruleConf")
     @JsonProperty("ruleConfs")
-    public List<AccountRuleConf> getRuleConfs() {
+    public List<AbstractAccountRuleConf> getRuleConfs() {
         return ruleConfs;
     }
 

http://git-wip-us.apache.org/repos/asf/syncope/blob/b8cadde8/common/lib/src/main/java/org/apache/syncope/common/lib/policy/DefaultAccountRuleConf.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/policy/DefaultAccountRuleConf.java b/common/lib/src/main/java/org/apache/syncope/common/lib/policy/DefaultAccountRuleConf.java
index 929f05b..804fcc5 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/policy/DefaultAccountRuleConf.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/policy/DefaultAccountRuleConf.java
@@ -18,12 +18,17 @@
  */
 package org.apache.syncope.common.lib.policy;
 
+import com.fasterxml.jackson.annotation.JsonProperty;
+import java.util.ArrayList;
+import java.util.List;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlElementWrapper;
 import javax.xml.bind.annotation.XmlRootElement;
 import javax.xml.bind.annotation.XmlType;
 
 @XmlRootElement(name = "defaultAccountRuleConf")
 @XmlType
-public class DefaultAccountRuleConf extends AbstractRuleConf implements AccountRuleConf {
+public class DefaultAccountRuleConf extends AbstractAccountRuleConf implements AccountRuleConf {
 
     private static final long serialVersionUID = 3259256974414758406L;
 
@@ -52,6 +57,26 @@ public class DefaultAccountRuleConf extends AbstractRuleConf implements AccountR
      */
     private boolean allLowerCase;
 
+    /**
+     * Substrings not permitted.
+     */
+    private final List<String> wordsNotPermitted = new ArrayList<>();
+
+    /**
+     * User attribute values not permitted.
+     */
+    private final List<String> schemasNotPermitted = new ArrayList<>();
+
+    /**
+     * Substrings not permitted as prefix.
+     */
+    private final List<String> prefixesNotPermitted = new ArrayList<>();
+
+    /**
+     * Substrings not permitted as suffix.
+     */
+    private final List<String> suffixesNotPermitted = new ArrayList<>();
+
     public boolean isAllLowerCase() {
         return allLowerCase;
     }
@@ -91,4 +116,32 @@ public class DefaultAccountRuleConf extends AbstractRuleConf implements AccountR
     public void setPattern(final String pattern) {
         this.pattern = pattern;
     }
+
+    @XmlElementWrapper(name = "wordsNotPermitted")
+    @XmlElement(name = "word")
+    @JsonProperty("wordsNotPermitted")
+    public List<String> getWordsNotPermitted() {
+        return wordsNotPermitted;
+    }
+
+    @XmlElementWrapper(name = "prefixesNotPermitted")
+    @XmlElement(name = "prefix")
+    @JsonProperty("prefixesNotPermitted")
+    public List<String> getPrefixesNotPermitted() {
+        return prefixesNotPermitted;
+    }
+
+    @XmlElementWrapper(name = "schemasNotPermitted")
+    @XmlElement(name = "schema")
+    @JsonProperty("schemasNotPermitted")
+    public List<String> getSchemasNotPermitted() {
+        return schemasNotPermitted;
+    }
+
+    @XmlElementWrapper(name = "suffixesNotPermitted")
+    @XmlElement(name = "suffix")
+    @JsonProperty("suffixesNotPermitted")
+    public List<String> getSuffixesNotPermitted() {
+        return suffixesNotPermitted;
+    }
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/b8cadde8/common/lib/src/main/java/org/apache/syncope/common/lib/policy/DefaultPasswordRuleConf.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/policy/DefaultPasswordRuleConf.java b/common/lib/src/main/java/org/apache/syncope/common/lib/policy/DefaultPasswordRuleConf.java
index 629e820..8792897 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/policy/DefaultPasswordRuleConf.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/policy/DefaultPasswordRuleConf.java
@@ -18,12 +18,17 @@
  */
 package org.apache.syncope.common.lib.policy;
 
+import com.fasterxml.jackson.annotation.JsonProperty;
+import java.util.ArrayList;
+import java.util.List;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlElementWrapper;
 import javax.xml.bind.annotation.XmlRootElement;
 import javax.xml.bind.annotation.XmlType;
 
 @XmlRootElement(name = "defaultPasswordRuleConf")
 @XmlType
-public class DefaultPasswordRuleConf extends AbstractRuleConf implements PasswordRuleConf {
+public class DefaultPasswordRuleConf extends AbstractPasswordRuleConf {
 
     private static final long serialVersionUID = -7988778083915548547L;
 
@@ -122,6 +127,31 @@ public class DefaultPasswordRuleConf extends AbstractRuleConf implements Passwor
      */
     private boolean mustntEndWithAlpha;
 
+    /**
+     * Specify if using username as password is allowed.
+     */
+    private boolean usernameAllowed;
+
+    /**
+     * Substrings not permitted.
+     */
+    private final List<String> wordsNotPermitted = new ArrayList<>();
+
+    /**
+     * User attribute values not permitted.
+     */
+    private final List<String> schemasNotPermitted = new ArrayList<>();
+
+    /**
+     * Substrings not permitted as prefix.
+     */
+    private final List<String> prefixesNotPermitted = new ArrayList<>();
+
+    /**
+     * Substrings not permitted as suffix.
+     */
+    private final List<String> suffixesNotPermitted = new ArrayList<>();
+
     public boolean isDigitRequired() {
         return digitRequired;
     }
@@ -274,4 +304,39 @@ public class DefaultPasswordRuleConf extends AbstractRuleConf implements Passwor
         this.mustntStartWithAlpha = mustntStartWithAlpha;
     }
 
+    public boolean isUsernameAllowed() {
+        return usernameAllowed;
+    }
+
+    public void setUsernameAllowed(final boolean usernameAllowed) {
+        this.usernameAllowed = usernameAllowed;
+    }
+
+    @XmlElementWrapper(name = "wordsNotPermitted")
+    @XmlElement(name = "word")
+    @JsonProperty("wordsNotPermitted")
+    public List<String> getWordsNotPermitted() {
+        return wordsNotPermitted;
+    }
+
+    @XmlElementWrapper(name = "prefixesNotPermitted")
+    @XmlElement(name = "prefix")
+    @JsonProperty("prefixesNotPermitted")
+    public List<String> getPrefixesNotPermitted() {
+        return prefixesNotPermitted;
+    }
+
+    @XmlElementWrapper(name = "schemasNotPermitted")
+    @XmlElement(name = "schema")
+    @JsonProperty("schemasNotPermitted")
+    public List<String> getSchemasNotPermitted() {
+        return schemasNotPermitted;
+    }
+
+    @XmlElementWrapper(name = "suffixesNotPermitted")
+    @XmlElement(name = "suffix")
+    @JsonProperty("suffixesNotPermitted")
+    public List<String> getSuffixesNotPermitted() {
+        return suffixesNotPermitted;
+    }
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/b8cadde8/common/lib/src/main/java/org/apache/syncope/common/lib/policy/PasswordPolicyTO.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/policy/PasswordPolicyTO.java b/common/lib/src/main/java/org/apache/syncope/common/lib/policy/PasswordPolicyTO.java
index cf91df2..49c73a3 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/policy/PasswordPolicyTO.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/policy/PasswordPolicyTO.java
@@ -37,7 +37,7 @@ public class PasswordPolicyTO extends AbstractPolicyTO {
 
     private int historyLength;
 
-    private final List<PasswordRuleConf> ruleConfs = new ArrayList<>();
+    private final List<AbstractPasswordRuleConf> ruleConfs = new ArrayList<>();
 
     public PasswordPolicyTO() {
         super(PolicyType.PASSWORD);
@@ -62,7 +62,7 @@ public class PasswordPolicyTO extends AbstractPolicyTO {
     @XmlElementWrapper(name = "ruleConfs")
     @XmlElement(name = "ruleConf")
     @JsonProperty("ruleConfs")
-    public List<PasswordRuleConf> getRuleConfs() {
+    public List<AbstractPasswordRuleConf> getRuleConfs() {
         return ruleConfs;
     }
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/b8cadde8/common/lib/src/main/java/org/apache/syncope/common/lib/report/StaticReportletConf.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/report/StaticReportletConf.java b/common/lib/src/main/java/org/apache/syncope/common/lib/report/StaticReportletConf.java
index 6d867b2..2514c16 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/report/StaticReportletConf.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/report/StaticReportletConf.java
@@ -44,7 +44,7 @@ public class StaticReportletConf extends AbstractReportletConf {
 
     private TraceLevel traceLevel;
 
-    private final List<String> listField = new ArrayList<String>();
+    private final List<String> listField = new ArrayList<>();
 
     public StaticReportletConf() {
         super();

http://git-wip-us.apache.org/repos/asf/syncope/blob/b8cadde8/common/lib/src/main/java/org/apache/syncope/common/lib/to/AbstractPolicyTO.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/to/AbstractPolicyTO.java b/common/lib/src/main/java/org/apache/syncope/common/lib/to/AbstractPolicyTO.java
deleted file mode 100644
index 2c5fcb4..0000000
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/to/AbstractPolicyTO.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * 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.lib.to;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.annotation.JsonTypeInfo;
-import java.util.ArrayList;
-import java.util.List;
-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.XmlSeeAlso;
-import javax.xml.bind.annotation.XmlType;
-import org.apache.syncope.common.lib.AbstractBaseBean;
-import org.apache.syncope.common.lib.types.PolicyType;
-
-@XmlRootElement(name = "abstractPolicy")
-@XmlType
-@XmlSeeAlso({ AccountPolicyTO.class, PasswordPolicyTO.class, SyncPolicyTO.class })
-@JsonTypeInfo(use = JsonTypeInfo.Id.CLASS, include = JsonTypeInfo.As.PROPERTY, property = "@class")
-public abstract class AbstractPolicyTO extends AbstractBaseBean {
-
-    private static final long serialVersionUID = -2903888572649721035L;
-
-    private long key;
-
-    private String description;
-
-    private final PolicyType type;
-
-    private final List<String> usedByResources = new ArrayList<>();
-
-    private final List<String> usedByRealms = new ArrayList<>();
-
-    private AbstractPolicyTO() {
-        super();
-        throw new UnsupportedOperationException("No-arg constructor is just to keep JAXB from complaining");
-    }
-
-    protected AbstractPolicyTO(final PolicyType type) {
-        super();
-        this.type = type;
-    }
-
-    public long getKey() {
-        return key;
-    }
-
-    @PathParam("key")
-    public void setKey(final long key) {
-        this.key = key;
-    }
-
-    public String getDescription() {
-        return description;
-    }
-
-    public void setDescription(final String description) {
-        this.description = description;
-    }
-
-    public PolicyType getType() {
-        return type;
-    }
-
-    @XmlElementWrapper(name = "usedByResources")
-    @XmlElement(name = "resource")
-    @JsonProperty("usedByResources")
-    public List<String> getUsedByResources() {
-        return usedByResources;
-    }
-
-    @XmlElementWrapper(name = "usedByRealms")
-    @XmlElement(name = "group")
-    @JsonProperty("usedByRealms")
-    public List<String> getUsedByRealms() {
-        return usedByRealms;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/syncope/blob/b8cadde8/common/lib/src/main/java/org/apache/syncope/common/lib/to/AccountPolicyTO.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/to/AccountPolicyTO.java b/common/lib/src/main/java/org/apache/syncope/common/lib/to/AccountPolicyTO.java
deleted file mode 100644
index a701899..0000000
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/to/AccountPolicyTO.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * 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.lib.to;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-import java.util.ArrayList;
-import java.util.List;
-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.syncope.common.lib.types.AccountPolicySpec;
-import org.apache.syncope.common.lib.types.PolicyType;
-
-@XmlRootElement(name = "accountPolicy")
-@XmlType
-public class AccountPolicyTO extends AbstractPolicyTO {
-
-    private static final long serialVersionUID = -1557150042828800134L;
-
-    private AccountPolicySpec specification;
-
-    private final List<String> resources = new ArrayList<>();
-
-    public AccountPolicyTO() {
-        super(PolicyType.ACCOUNT);
-    }
-
-    public AccountPolicySpec getSpecification() {
-        return specification;
-    }
-
-    public void setSpecification(final AccountPolicySpec specification) {
-        this.specification = specification;
-    }
-
-    @XmlElementWrapper(name = "resources")
-    @XmlElement(name = "resource")
-    @JsonProperty("resources")
-    public List<String> getResources() {
-        return resources;
-    }
-}

http://git-wip-us.apache.org/repos/asf/syncope/blob/b8cadde8/common/lib/src/main/java/org/apache/syncope/common/lib/to/PasswordPolicyTO.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/to/PasswordPolicyTO.java b/common/lib/src/main/java/org/apache/syncope/common/lib/to/PasswordPolicyTO.java
deleted file mode 100644
index a0a21ea..0000000
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/to/PasswordPolicyTO.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * 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.lib.to;
-
-import javax.xml.bind.annotation.XmlRootElement;
-import javax.xml.bind.annotation.XmlType;
-import org.apache.syncope.common.lib.types.PasswordPolicySpec;
-import org.apache.syncope.common.lib.types.PolicyType;
-
-@XmlRootElement(name = "passwordPolicy")
-@XmlType
-public class PasswordPolicyTO extends AbstractPolicyTO {
-
-    private static final long serialVersionUID = -5606086441294799690L;
-
-    private PasswordPolicySpec specification;
-
-    public PasswordPolicyTO() {
-        super(PolicyType.PASSWORD);
-    }
-
-    public PasswordPolicySpec getSpecification() {
-        return specification;
-    }
-
-    public void setSpecification(final PasswordPolicySpec specification) {
-        this.specification = specification;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/syncope/blob/b8cadde8/common/lib/src/main/java/org/apache/syncope/common/lib/to/SyncPolicyTO.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/to/SyncPolicyTO.java b/common/lib/src/main/java/org/apache/syncope/common/lib/to/SyncPolicyTO.java
deleted file mode 100644
index 309a4eb..0000000
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/to/SyncPolicyTO.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * 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.lib.to;
-
-import javax.xml.bind.annotation.XmlRootElement;
-import javax.xml.bind.annotation.XmlType;
-import org.apache.syncope.common.lib.types.PolicyType;
-import org.apache.syncope.common.lib.types.SyncPolicySpec;
-
-@XmlRootElement(name = "syncPolicy")
-@XmlType
-public class SyncPolicyTO extends AbstractPolicyTO {
-
-    private static final long serialVersionUID = 993024634238024242L;
-
-    private SyncPolicySpec specification;
-
-    public SyncPolicyTO() {
-        super(PolicyType.SYNC);
-    }
-
-    public SyncPolicySpec getSpecification() {
-        return specification;
-    }
-
-    public void setSpecification(final SyncPolicySpec specification) {
-        this.specification = specification;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/syncope/blob/b8cadde8/common/lib/src/main/java/org/apache/syncope/common/lib/to/SyncopeTO.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/to/SyncopeTO.java b/common/lib/src/main/java/org/apache/syncope/common/lib/to/SyncopeTO.java
index 243a79f..fe57d52 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/to/SyncopeTO.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/to/SyncopeTO.java
@@ -59,8 +59,14 @@ public class SyncopeTO extends AbstractBaseBean {
 
     private String virAttrCache;
 
+    private String passwordGenerator;
+
     private final List<String> reportlets = new ArrayList<>();
 
+    private final List<String> accountRules = new ArrayList<>();
+
+    private final List<String> passwordRules = new ArrayList<>();
+
     private final List<String> taskJobs = new ArrayList<>();
 
     private final List<String> propagationActions = new ArrayList<>();
@@ -132,6 +138,14 @@ public class SyncopeTO extends AbstractBaseBean {
         return virAttrCache;
     }
 
+    public String getPasswordGenerator() {
+        return passwordGenerator;
+    }
+
+    public void setPasswordGenerator(final String passwordGenerator) {
+        this.passwordGenerator = passwordGenerator;
+    }
+
     @XmlElementWrapper(name = "reportlets")
     @XmlElement(name = "reportlet")
     @JsonProperty("reportlets")
@@ -139,6 +153,20 @@ public class SyncopeTO extends AbstractBaseBean {
         return reportlets;
     }
 
+    @XmlElementWrapper(name = "accountRules")
+    @XmlElement(name = "accountRule")
+    @JsonProperty("accountRules")
+    public List<String> getAccountRules() {
+        return accountRules;
+    }
+
+    @XmlElementWrapper(name = "passwordRules")
+    @XmlElement(name = "passwordRule")
+    @JsonProperty("passwordRules")
+    public List<String> getPasswordRules() {
+        return passwordRules;
+    }
+
     @XmlElementWrapper(name = "taskJobs")
     @XmlElement(name = "taskJob")
     @JsonProperty("taskJobs")

http://git-wip-us.apache.org/repos/asf/syncope/blob/b8cadde8/common/lib/src/main/java/org/apache/syncope/common/lib/types/AbstractPolicySpec.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/types/AbstractPolicySpec.java b/common/lib/src/main/java/org/apache/syncope/common/lib/types/AbstractPolicySpec.java
deleted file mode 100644
index e951419..0000000
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/types/AbstractPolicySpec.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * 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.lib.types;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-import java.util.ArrayList;
-import java.util.List;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlElementWrapper;
-import javax.xml.bind.annotation.XmlType;
-import org.apache.commons.lang3.builder.EqualsBuilder;
-import org.apache.commons.lang3.builder.HashCodeBuilder;
-import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
-import org.apache.commons.lang3.builder.ToStringStyle;
-
-@XmlType
-public abstract class AbstractPolicySpec {
-
-    private static final long serialVersionUID = -6210646284287392063L;
-
-    /**
-     * Substrings not permitted.
-     */
-    private final List<String> wordsNotPermitted = new ArrayList<>();
-
-    /**
-     * User attribute values not permitted.
-     */
-    protected final List<String> schemasNotPermitted = new ArrayList<>();
-
-    /**
-     * Substrings not permitted as prefix.
-     */
-    protected final List<String> prefixesNotPermitted = new ArrayList<>();
-
-    /**
-     * Substrings not permitted as suffix.
-     */
-    protected final List<String> suffixesNotPermitted = new ArrayList<>();
-
-    @XmlElementWrapper(name = "wordsNotPermitted")
-    @XmlElement(name = "word")
-    @JsonProperty("wordsNotPermitted")
-    public List<String> getWordsNotPermitted() {
-        return wordsNotPermitted;
-    }
-
-    @XmlElementWrapper(name = "prefixesNotPermitted")
-    @XmlElement(name = "prefix")
-    @JsonProperty("prefixesNotPermitted")
-    public List<String> getPrefixesNotPermitted() {
-        return prefixesNotPermitted;
-    }
-
-    @XmlElementWrapper(name = "schemasNotPermitted")
-    @XmlElement(name = "schema")
-    @JsonProperty("schemasNotPermitted")
-    public List<String> getSchemasNotPermitted() {
-        return schemasNotPermitted;
-    }
-
-    @XmlElementWrapper(name = "suffixesNotPermitted")
-    @XmlElement(name = "suffix")
-    @JsonProperty("suffixesNotPermitted")
-    public List<String> getSuffixesNotPermitted() {
-        return suffixesNotPermitted;
-    }
-
-    @Override
-    public boolean equals(final Object obj) {
-        return EqualsBuilder.reflectionEquals(this, obj);
-    }
-
-    @Override
-    public int hashCode() {
-        return HashCodeBuilder.reflectionHashCode(this);
-    }
-
-    @Override
-    public String toString() {
-        return ReflectionToStringBuilder.toString(this, ToStringStyle.MULTI_LINE_STYLE);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/syncope/blob/b8cadde8/common/lib/src/main/java/org/apache/syncope/common/lib/types/AccountPolicySpec.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/types/AccountPolicySpec.java b/common/lib/src/main/java/org/apache/syncope/common/lib/types/AccountPolicySpec.java
deleted file mode 100644
index 47a60e8..0000000
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/types/AccountPolicySpec.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * 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.lib.types;
-
-import javax.xml.bind.annotation.XmlType;
-
-@XmlType
-public class AccountPolicySpec extends AbstractPolicySpec {
-
-    private static final long serialVersionUID = 3259256974414758406L;
-
-    /**
-     * Minimum length.
-     */
-    private int maxLength;
-
-    /**
-     * Maximum length.
-     */
-    private int minLength;
-
-    /**
-     * Pattern (regular expression) that must match.
-     */
-    private String pattern;
-
-    /**
-     * Specify if one or more lowercase characters are permitted.
-     */
-    private boolean allUpperCase;
-
-    /**
-     * Specify if one or more uppercase characters are permitted.
-     */
-    private boolean allLowerCase;
-
-    /**
-     * Specify if, when reached the maximum allowed number of subsequent login failures, user shall be suspended.
-     */
-    private boolean propagateSuspension;
-
-    /**
-     * Maximum number of (failing) authentication attempts.
-     * 0 disabled; &gt;0 enabled.
-     * If the number of subsequent failed logins will be greater then this value
-     * the account will be suspended (lock-out).
-     */
-    private int maxAuthenticationAttempts;
-
-    public boolean isAllLowerCase() {
-        return allLowerCase;
-    }
-
-    public void setAllLowerCase(final boolean allLowerCase) {
-        this.allLowerCase = allLowerCase;
-    }
-
-    public boolean isAllUpperCase() {
-        return allUpperCase;
-    }
-
-    public void setAllUpperCase(final boolean allUpperCase) {
-        this.allUpperCase = allUpperCase;
-    }
-
-    public int getMaxLength() {
-        return maxLength;
-    }
-
-    public void setMaxLength(final int maxLength) {
-        this.maxLength = maxLength;
-    }
-
-    public int getMinLength() {
-        return minLength;
-    }
-
-    public void setMinLength(final int minLength) {
-        this.minLength = minLength;
-    }
-
-    public String getPattern() {
-        return pattern;
-    }
-
-    public void setPattern(final String pattern) {
-        this.pattern = pattern;
-    }
-
-    public boolean isPropagateSuspension() {
-        return propagateSuspension;
-    }
-
-    public void setPropagateSuspension(final boolean propagateSuspension) {
-        this.propagateSuspension = propagateSuspension;
-    }
-
-    public int getMaxAuthenticationAttempts() {
-        return maxAuthenticationAttempts;
-    }
-
-    public void setMaxAuthenticationAttempts(final int maxAuthenticationAttempts) {
-        this.maxAuthenticationAttempts = maxAuthenticationAttempts;
-    }
-}

http://git-wip-us.apache.org/repos/asf/syncope/blob/b8cadde8/common/lib/src/main/java/org/apache/syncope/common/lib/types/PasswordPolicySpec.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/types/PasswordPolicySpec.java b/common/lib/src/main/java/org/apache/syncope/common/lib/types/PasswordPolicySpec.java
deleted file mode 100644
index 175a1ef..0000000
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/types/PasswordPolicySpec.java
+++ /dev/null
@@ -1,300 +0,0 @@
-/*
- * 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.lib.types;
-
-import javax.xml.bind.annotation.XmlType;
-
-@XmlType
-public class PasswordPolicySpec extends AbstractPolicySpec {
-
-    private static final long serialVersionUID = -7988778083915548547L;
-
-    /**
-     * History length.
-     */
-    private int historyLength;
-
-    /**
-     * Minimum length.
-     */
-    private int maxLength;
-
-    /**
-     * Maximum length.
-     */
-    private int minLength;
-
-    /**
-     * Specify if one or more non alphanumeric characters are required.
-     */
-    private boolean nonAlphanumericRequired;
-
-    /**
-     * Specify if one or more alphanumeric characters are required.
-     */
-    private boolean alphanumericRequired;
-
-    /**
-     * Specify if one or more digits are required.
-     */
-    private boolean digitRequired;
-
-    /**
-     * Specify if one or more lowercase alphabetic characters are required.
-     */
-    private boolean lowercaseRequired;
-
-    /**
-     * Specify if one or more uppercase alphabetic characters are required.
-     */
-    private boolean uppercaseRequired;
-
-    /**
-     * Specify if must start with a digit.
-     */
-    private boolean mustStartWithDigit;
-
-    /**
-     * Specify if mustn't start with a digit.
-     */
-    private boolean mustntStartWithDigit;
-
-    /**
-     * Specify if must end with a digit.
-     */
-    private boolean mustEndWithDigit;
-
-    /**
-     * Specify if mustn't end with a digit.
-     */
-    private boolean mustntEndWithDigit;
-
-    /**
-     * Specify if must start with a non alphanumeric character.
-     */
-    private boolean mustStartWithNonAlpha;
-
-    /**
-     * Specify if must start with a alphanumeric character.
-     */
-    private boolean mustStartWithAlpha;
-
-    /**
-     * Specify if mustn't start with a non alphanumeric character.
-     */
-    private boolean mustntStartWithNonAlpha;
-
-    /**
-     * Specify if mustn't start with a alphanumeric character.
-     */
-    private boolean mustntStartWithAlpha;
-
-    /**
-     * Specify if must end with a non alphanumeric character.
-     */
-    private boolean mustEndWithNonAlpha;
-
-    /**
-     * Specify if must end with a alphanumeric character.
-     */
-    private boolean mustEndWithAlpha;
-
-    /**
-     * Specify if mustn't end with a non alphanumeric character.
-     */
-    private boolean mustntEndWithNonAlpha;
-
-    /**
-     * Specify if mustn't end with a alphanumeric character.
-     */
-    private boolean mustntEndWithAlpha;
-
-    /**
-     * Specify if password shall not be stored internally.
-     */
-    private boolean allowNullPassword;
-
-    public boolean isDigitRequired() {
-        return digitRequired;
-    }
-
-    public void setDigitRequired(final boolean digitRequired) {
-        this.digitRequired = digitRequired;
-    }
-
-    public boolean isLowercaseRequired() {
-        return lowercaseRequired;
-    }
-
-    public void setLowercaseRequired(final boolean lowercaseRequired) {
-        this.lowercaseRequired = lowercaseRequired;
-    }
-
-    public int getMaxLength() {
-        return maxLength;
-    }
-
-    public void setMaxLength(final int maxLength) {
-        this.maxLength = maxLength;
-    }
-
-    public int getMinLength() {
-        return minLength;
-    }
-
-    public void setMinLength(final int minLength) {
-        this.minLength = minLength;
-    }
-
-    public boolean isMustEndWithDigit() {
-        return mustEndWithDigit;
-    }
-
-    public void setMustEndWithDigit(final boolean mustEndWithDigit) {
-        this.mustEndWithDigit = mustEndWithDigit;
-    }
-
-    public boolean isMustEndWithNonAlpha() {
-        return mustEndWithNonAlpha;
-    }
-
-    public void setMustEndWithNonAlpha(final boolean mustEndWithNonAlpha) {
-        this.mustEndWithNonAlpha = mustEndWithNonAlpha;
-    }
-
-    public boolean isMustStartWithDigit() {
-        return mustStartWithDigit;
-    }
-
-    public void setMustStartWithDigit(final boolean mustStartWithDigit) {
-        this.mustStartWithDigit = mustStartWithDigit;
-    }
-
-    public boolean isMustStartWithNonAlpha() {
-        return mustStartWithNonAlpha;
-    }
-
-    public void setMustStartWithNonAlpha(final boolean mustStartWithNonAlpha) {
-        this.mustStartWithNonAlpha = mustStartWithNonAlpha;
-    }
-
-    public boolean isMustntEndWithDigit() {
-        return mustntEndWithDigit;
-    }
-
-    public void setMustntEndWithDigit(final boolean mustntEndWithDigit) {
-        this.mustntEndWithDigit = mustntEndWithDigit;
-    }
-
-    public boolean isMustntEndWithNonAlpha() {
-        return mustntEndWithNonAlpha;
-    }
-
-    public void setMustntEndWithNonAlpha(final boolean mustntEndWithNonAlpha) {
-        this.mustntEndWithNonAlpha = mustntEndWithNonAlpha;
-    }
-
-    public boolean isMustntStartWithDigit() {
-        return mustntStartWithDigit;
-    }
-
-    public void setMustntStartWithDigit(final boolean mustntStartWithDigit) {
-        this.mustntStartWithDigit = mustntStartWithDigit;
-    }
-
-    public boolean isMustntStartWithNonAlpha() {
-        return mustntStartWithNonAlpha;
-    }
-
-    public void setMustntStartWithNonAlpha(final boolean mustntStartWithNonAlpha) {
-        this.mustntStartWithNonAlpha = mustntStartWithNonAlpha;
-    }
-
-    public boolean isNonAlphanumericRequired() {
-        return nonAlphanumericRequired;
-    }
-
-    public void setNonAlphanumericRequired(final boolean nonAlphanumericRequired) {
-        this.nonAlphanumericRequired = nonAlphanumericRequired;
-    }
-
-    public boolean isUppercaseRequired() {
-        return uppercaseRequired;
-    }
-
-    public void setUppercaseRequired(final boolean uppercaseRequired) {
-        this.uppercaseRequired = uppercaseRequired;
-    }
-
-    public boolean isAlphanumericRequired() {
-        return alphanumericRequired;
-    }
-
-    public void setAlphanumericRequired(final boolean alphanumericRequired) {
-        this.alphanumericRequired = alphanumericRequired;
-    }
-
-    public boolean isMustEndWithAlpha() {
-        return mustEndWithAlpha;
-    }
-
-    public void setMustEndWithAlpha(final boolean mustEndWithAlpha) {
-        this.mustEndWithAlpha = mustEndWithAlpha;
-    }
-
-    public boolean isMustStartWithAlpha() {
-        return mustStartWithAlpha;
-    }
-
-    public void setMustStartWithAlpha(final boolean mustStartWithAlpha) {
-        this.mustStartWithAlpha = mustStartWithAlpha;
-    }
-
-    public boolean isMustntEndWithAlpha() {
-        return mustntEndWithAlpha;
-    }
-
-    public void setMustntEndWithAlpha(final boolean mustntEndWithAlpha) {
-        this.mustntEndWithAlpha = mustntEndWithAlpha;
-    }
-
-    public boolean isMustntStartWithAlpha() {
-        return mustntStartWithAlpha;
-    }
-
-    public void setMustntStartWithAlpha(final boolean mustntStartWithAlpha) {
-        this.mustntStartWithAlpha = mustntStartWithAlpha;
-    }
-
-    public int getHistoryLength() {
-        return historyLength;
-    }
-
-    public void setHistoryLength(final int historyLength) {
-        this.historyLength = historyLength;
-    }
-
-    public boolean isAllowNullPassword() {
-        return allowNullPassword;
-    }
-
-    public void setAllowNullPassword(final boolean allowNullPassword) {
-        this.allowNullPassword = allowNullPassword;
-    }
-}

http://git-wip-us.apache.org/repos/asf/syncope/blob/b8cadde8/common/lib/src/main/java/org/apache/syncope/common/lib/types/PolicyType.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/types/PolicyType.java b/common/lib/src/main/java/org/apache/syncope/common/lib/types/PolicyType.java
deleted file mode 100644
index 7f1c11e..0000000
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/types/PolicyType.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * 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.lib.types;
-
-import javax.xml.bind.annotation.XmlEnum;
-
-@XmlEnum
-public enum PolicyType {
-
-    /**
-     * How username values should look like.
-     */
-    ACCOUNT,
-    /**
-     * How password values should look like.
-     */
-    PASSWORD,
-    /**
-     * For handling conflicts resolution during synchronization.
-     */
-    SYNC,
-    /**
-     * For handling conflicts resolution during push.
-     */
-    PUSH;
-
-}

http://git-wip-us.apache.org/repos/asf/syncope/blob/b8cadde8/common/lib/src/main/java/org/apache/syncope/common/lib/types/PushPolicySpec.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/types/PushPolicySpec.java b/common/lib/src/main/java/org/apache/syncope/common/lib/types/PushPolicySpec.java
deleted file mode 100644
index 0bbea85..0000000
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/types/PushPolicySpec.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * 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.lib.types;
-
-import javax.xml.bind.annotation.XmlType;
-
-@XmlType
-public class PushPolicySpec {
-
-    private static final long serialVersionUID = 3641030189482617497L;
-
-}

http://git-wip-us.apache.org/repos/asf/syncope/blob/b8cadde8/common/lib/src/main/java/org/apache/syncope/common/lib/types/SyncPolicySpec.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/types/SyncPolicySpec.java b/common/lib/src/main/java/org/apache/syncope/common/lib/types/SyncPolicySpec.java
deleted file mode 100644
index 7bdaea0..0000000
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/types/SyncPolicySpec.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * 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.lib.types;
-
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import java.util.HashMap;
-import java.util.Map;
-import javax.xml.bind.annotation.XmlType;
-import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
-import org.apache.syncope.common.lib.jaxb.XmlGenericMapAdapter;
-
-@XmlType
-public class SyncPolicySpec {
-
-    private static final long serialVersionUID = -3144027171719498127L;
-
-    private ConflictResolutionAction conflictResolutionAction;
-
-    /**
-     * Associates anyTypeKey to either:
-     * <ol>
-     * <li>Java class name, implementing {@code SyncCorrelationRule}</li>
-     * <li>JSON array containing plain schema names - this will be used to feed
-     * {@code PlainAttrsSyncCorrelationRule}</li>
-     * </ol>
-     */
-    @XmlJavaTypeAdapter(XmlGenericMapAdapter.class)
-    @JsonIgnore
-    private final Map<String, String> correlationRules = new HashMap<>();
-
-    public ConflictResolutionAction getConflictResolutionAction() {
-        return conflictResolutionAction == null
-                ? ConflictResolutionAction.IGNORE
-                : conflictResolutionAction;
-    }
-
-    public void setConflictResolutionAction(final ConflictResolutionAction conflictResolutionAction) {
-        this.conflictResolutionAction = conflictResolutionAction;
-    }
-
-    @JsonProperty
-    public Map<String, String> getCorrelationRules() {
-        return correlationRules;
-    }
-}

http://git-wip-us.apache.org/repos/asf/syncope/blob/b8cadde8/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/PolicyService.java
----------------------------------------------------------------------
diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/PolicyService.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/PolicyService.java
index 980da9f..55b8747 100644
--- a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/PolicyService.java
+++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/PolicyService.java
@@ -34,7 +34,7 @@ import javax.ws.rs.core.Response;
 import org.apache.cxf.jaxrs.model.wadl.Description;
 import org.apache.cxf.jaxrs.model.wadl.Descriptions;
 import org.apache.cxf.jaxrs.model.wadl.DocTarget;
-import org.apache.syncope.common.lib.to.AbstractPolicyTO;
+import org.apache.syncope.common.lib.policy.AbstractPolicyTO;
 import org.apache.syncope.common.lib.types.PolicyType;
 
 /**

http://git-wip-us.apache.org/repos/asf/syncope/blob/b8cadde8/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ReportService.java
----------------------------------------------------------------------
diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ReportService.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ReportService.java
index 17c091d..44863ba 100644
--- a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ReportService.java
+++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ReportService.java
@@ -42,7 +42,6 @@ import org.apache.syncope.common.lib.to.ReportTO;
 import org.apache.syncope.common.lib.types.JobAction;
 import org.apache.syncope.common.lib.types.JobStatusType;
 import org.apache.syncope.common.lib.types.ReportExecExportFormat;
-import org.apache.syncope.common.lib.wrap.ReportletConfClass;
 import org.apache.syncope.common.rest.api.beans.ListQuery;
 
 /**
@@ -52,16 +51,6 @@ import org.apache.syncope.common.rest.api.beans.ListQuery;
 public interface ReportService extends JAXRSService {
 
     /**
-     * Returns a list of available classes for reportlet configuration.
-     *
-     * @return list of available classes for reportlet configuration
-     */
-    @GET
-    @Path("reportletConfClasses")
-    @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
-    List<ReportletConfClass> getReportletConfClasses();
-
-    /**
      * Returns report with matching key.
      *
      * @param key key of report to be read

http://git-wip-us.apache.org/repos/asf/syncope/blob/b8cadde8/core/logic/src/main/java/org/apache/syncope/core/logic/PolicyLogic.java
----------------------------------------------------------------------
diff --git a/core/logic/src/main/java/org/apache/syncope/core/logic/PolicyLogic.java b/core/logic/src/main/java/org/apache/syncope/core/logic/PolicyLogic.java
index 80409aa..e37dc28 100644
--- a/core/logic/src/main/java/org/apache/syncope/core/logic/PolicyLogic.java
+++ b/core/logic/src/main/java/org/apache/syncope/core/logic/PolicyLogic.java
@@ -24,18 +24,18 @@ import java.util.List;
 import org.apache.commons.collections4.CollectionUtils;
 import org.apache.commons.collections4.Transformer;
 import org.apache.commons.lang3.ArrayUtils;
-import org.apache.syncope.common.lib.to.AbstractPolicyTO;
-import org.apache.syncope.common.lib.to.AccountPolicyTO;
-import org.apache.syncope.common.lib.to.PasswordPolicyTO;
-import org.apache.syncope.common.lib.to.SyncPolicyTO;
+import org.apache.syncope.common.lib.policy.AbstractPolicyTO;
+import org.apache.syncope.common.lib.policy.AccountPolicyTO;
+import org.apache.syncope.common.lib.policy.PasswordPolicyTO;
+import org.apache.syncope.common.lib.policy.SyncPolicyTO;
 import org.apache.syncope.common.lib.types.Entitlement;
 import org.apache.syncope.common.lib.types.PolicyType;
 import org.apache.syncope.core.persistence.api.dao.NotFoundException;
 import org.apache.syncope.core.persistence.api.dao.PolicyDAO;
-import org.apache.syncope.core.persistence.api.entity.AccountPolicy;
-import org.apache.syncope.core.persistence.api.entity.PasswordPolicy;
+import org.apache.syncope.core.persistence.api.entity.policy.AccountPolicy;
+import org.apache.syncope.core.persistence.api.entity.policy.PasswordPolicy;
 import org.apache.syncope.core.persistence.api.entity.Policy;
-import org.apache.syncope.core.persistence.api.entity.SyncPolicy;
+import org.apache.syncope.core.persistence.api.entity.policy.SyncPolicy;
 import org.apache.syncope.core.provisioning.api.data.PolicyDataBinder;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;

http://git-wip-us.apache.org/repos/asf/syncope/blob/b8cadde8/core/logic/src/main/java/org/apache/syncope/core/logic/ReportLogic.java
----------------------------------------------------------------------
diff --git a/core/logic/src/main/java/org/apache/syncope/core/logic/ReportLogic.java b/core/logic/src/main/java/org/apache/syncope/core/logic/ReportLogic.java
index d8611ad..3780d30 100644
--- a/core/logic/src/main/java/org/apache/syncope/core/logic/ReportLogic.java
+++ b/core/logic/src/main/java/org/apache/syncope/core/logic/ReportLogic.java
@@ -24,10 +24,8 @@ import java.lang.reflect.Method;
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.HashMap;
-import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
-import java.util.Set;
 import java.util.zip.ZipInputStream;
 import org.apache.cocoon.optional.pipeline.components.sax.fop.FopSerializer;
 import org.apache.cocoon.pipeline.NonCachingPipeline;
@@ -37,13 +35,10 @@ import org.apache.cocoon.sax.component.XMLGenerator;
 import org.apache.cocoon.sax.component.XMLSerializer;
 import org.apache.cocoon.sax.component.XSLTTransformer;
 import org.apache.commons.collections4.CollectionUtils;
-import org.apache.commons.collections4.IteratorUtils;
-import org.apache.commons.collections4.PredicateUtils;
 import org.apache.commons.collections4.Transformer;
 import org.apache.commons.io.IOUtils;
 import org.apache.commons.lang3.ArrayUtils;
 import org.apache.syncope.common.lib.SyncopeClientException;
-import org.apache.syncope.common.lib.report.ReportletConf;
 import org.apache.syncope.common.lib.to.ReportExecTO;
 import org.apache.syncope.common.lib.to.ReportTO;
 import org.apache.syncope.common.lib.types.ClientExceptionType;
@@ -58,10 +53,7 @@ import org.apache.syncope.core.persistence.api.entity.Report;
 import org.apache.syncope.core.persistence.api.entity.ReportExec;
 import org.apache.syncope.core.provisioning.api.data.ReportDataBinder;
 import org.apache.syncope.core.provisioning.api.job.JobNamer;
-import org.apache.syncope.core.logic.init.ImplementationClassNamesLoader;
 import org.apache.syncope.core.provisioning.api.job.JobInstanceLoader;
-import org.apache.syncope.core.logic.report.Reportlet;
-import org.apache.syncope.core.logic.report.ReportletConfClass;
 import org.apache.syncope.core.logic.report.TextSerializer;
 import org.apache.syncope.common.lib.to.AbstractExecTO;
 import org.apache.syncope.common.lib.types.Entitlement;
@@ -74,7 +66,6 @@ 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;
-import org.springframework.util.ClassUtils;
 
 @Component
 public class ReportLogic extends AbstractJobLogic<ReportTO> {
@@ -94,9 +85,6 @@ public class ReportLogic extends AbstractJobLogic<ReportTO> {
     @Autowired
     private EntityFactory entityFactory;
 
-    @Autowired
-    private ImplementationClassNamesLoader classNamesLoader;
-
     @PreAuthorize("hasRole('" + Entitlement.REPORT_CREATE + "')")
     public ReportTO create(final ReportTO reportTO) {
         Report report = entityFactory.newEntity(Report.class);
@@ -156,69 +144,6 @@ public class ReportLogic extends AbstractJobLogic<ReportTO> {
                 }, new ArrayList<ReportTO>());
     }
 
-    private Class<? extends ReportletConf> getReportletConfClass(final Class<Reportlet> reportletClass) {
-        Class<? extends ReportletConf> result = null;
-
-        ReportletConfClass annotation = reportletClass.getAnnotation(ReportletConfClass.class);
-        if (annotation != null) {
-            result = annotation.value();
-        }
-
-        return result;
-    }
-
-    @SuppressWarnings({ "rawtypes" })
-    private Set<Class<Reportlet>> getAllReportletClasses() {
-        return CollectionUtils.collect(IteratorUtils.filteredIterator(
-                classNamesLoader.getClassNames(ImplementationClassNamesLoader.Type.REPORTLET).iterator(),
-                PredicateUtils.notNullPredicate()),
-                new Transformer<String, Class<Reportlet>>() {
-
-                    @SuppressWarnings("unchecked")
-                    @Override
-                    public Class<Reportlet> transform(final String className) {
-                        Class<Reportlet> result = null;
-                        try {
-                            Class reportletClass = ClassUtils.forName(className, ClassUtils.getDefaultClassLoader());
-                            result = reportletClass;
-                        } catch (ClassNotFoundException e) {
-                            LOG.warn("Could not load class {}", className);
-                        } catch (LinkageError e) {
-                            LOG.warn("Could not link class {}", className);
-                        }
-
-                        return result;
-                    }
-                }, new HashSet<Class<Reportlet>>());
-    }
-
-    @PreAuthorize("hasRole('" + Entitlement.REPORT_LIST + "')")
-    @SuppressWarnings({ "rawtypes" })
-    public Set<String> getReportletConfClasses() {
-        return CollectionUtils.collect(IteratorUtils.filteredIterator(getAllReportletClasses().iterator(),
-                PredicateUtils.notNullPredicate()),
-                new Transformer<Class<Reportlet>, String>() {
-
-                    @Override
-                    public String transform(final Class<Reportlet> reportletClass) {
-                        Class<? extends ReportletConf> reportletConfClass = getReportletConfClass(reportletClass);
-                        return reportletConfClass == null ? null : reportletConfClass.getName();
-                    }
-                }, new HashSet<String>());
-    }
-
-    public Class<Reportlet> findReportletClassHavingConfClass(final Class<? extends ReportletConf> reportletConfClass) {
-        Class<Reportlet> result = null;
-        for (Class<Reportlet> reportletClass : getAllReportletClasses()) {
-            Class<? extends ReportletConf> found = getReportletConfClass(reportletClass);
-            if (found != null && found.equals(reportletConfClass)) {
-                result = reportletClass;
-            }
-        }
-
-        return result;
-    }
-
     @PreAuthorize("hasRole('" + Entitlement.REPORT_READ + "')")
     public ReportTO read(final Long reportKey) {
         Report report = reportDAO.find(reportKey);

http://git-wip-us.apache.org/repos/asf/syncope/blob/b8cadde8/core/logic/src/main/java/org/apache/syncope/core/logic/SyncopeLogic.java
----------------------------------------------------------------------
diff --git a/core/logic/src/main/java/org/apache/syncope/core/logic/SyncopeLogic.java b/core/logic/src/main/java/org/apache/syncope/core/logic/SyncopeLogic.java
index d6432e2..eb0c1ad 100644
--- a/core/logic/src/main/java/org/apache/syncope/core/logic/SyncopeLogic.java
+++ b/core/logic/src/main/java/org/apache/syncope/core/logic/SyncopeLogic.java
@@ -28,6 +28,7 @@ import java.util.Set;
 import javax.annotation.Resource;
 import org.apache.syncope.common.lib.to.SyncopeTO;
 import org.apache.syncope.core.logic.init.ImplementationClassNamesLoader;
+import org.apache.syncope.core.misc.security.PasswordGenerator;
 import org.apache.syncope.core.misc.spring.ResourceWithFallbackLoader;
 import org.apache.syncope.core.persistence.api.dao.ConfDAO;
 import org.apache.syncope.core.provisioning.api.AnyObjectProvisioningManager;
@@ -83,6 +84,9 @@ public class SyncopeLogic extends AbstractLogic<SyncopeTO> {
     private VirAttrCache virAttrCache;
 
     @Autowired
+    private PasswordGenerator passwordGenerator;
+
+    @Autowired
     private ImplementationClassNamesLoader classNamesLoader;
 
     @Resource(name = "velocityResourceLoader")
@@ -129,8 +133,11 @@ public class SyncopeLogic extends AbstractLogic<SyncopeTO> {
         syncopeTO.setUserProvisioningManager(uProvisioningManager.getClass().getName());
         syncopeTO.setGroupProvisioningManager(gProvisioningManager.getClass().getName());
         syncopeTO.setVirAttrCache(virAttrCache.getClass().getName());
+        syncopeTO.setPasswordGenerator(passwordGenerator.getClass().getName());
 
         syncopeTO.getReportlets().addAll(classNamesLoader.getClassNames(Type.REPORTLET));
+        syncopeTO.getAccountRules().addAll(classNamesLoader.getClassNames(Type.ACCOUNT_RULE));
+        syncopeTO.getPasswordRules().addAll(classNamesLoader.getClassNames(Type.PASSWORD_RULE));
         syncopeTO.getTaskJobs().addAll(classNamesLoader.getClassNames(Type.TASKJOBDELEGATE));
         syncopeTO.getPropagationActions().addAll(classNamesLoader.getClassNames(Type.PROPAGATION_ACTIONS));
         syncopeTO.getSyncActions().addAll(classNamesLoader.getClassNames(Type.SYNC_ACTIONS));

http://git-wip-us.apache.org/repos/asf/syncope/blob/b8cadde8/core/logic/src/main/java/org/apache/syncope/core/logic/init/ImplementationClassNamesLoader.java
----------------------------------------------------------------------
diff --git a/core/logic/src/main/java/org/apache/syncope/core/logic/init/ImplementationClassNamesLoader.java b/core/logic/src/main/java/org/apache/syncope/core/logic/init/ImplementationClassNamesLoader.java
index 1b53e5c..7bc842e 100644
--- a/core/logic/src/main/java/org/apache/syncope/core/logic/init/ImplementationClassNamesLoader.java
+++ b/core/logic/src/main/java/org/apache/syncope/core/logic/init/ImplementationClassNamesLoader.java
@@ -32,6 +32,8 @@ import org.apache.syncope.core.provisioning.api.sync.SyncCorrelationRule;
 import org.apache.syncope.core.logic.report.Reportlet;
 import org.apache.syncope.core.persistence.api.SyncopeLoader;
 import org.apache.syncope.core.persistence.api.attrvalue.validation.Validator;
+import org.apache.syncope.core.persistence.api.dao.AccountRule;
+import org.apache.syncope.core.persistence.api.dao.PasswordRule;
 import org.apache.syncope.core.provisioning.api.job.SchedTaskJobDelegate;
 import org.apache.syncope.core.provisioning.java.sync.PushJobDelegate;
 import org.apache.syncope.core.provisioning.java.sync.SyncJobDelegate;
@@ -52,6 +54,8 @@ public class ImplementationClassNamesLoader implements SyncopeLoader {
     public enum Type {
 
         REPORTLET,
+        ACCOUNT_RULE,
+        PASSWORD_RULE,
         TASKJOBDELEGATE,
         PROPAGATION_ACTIONS,
         SYNC_ACTIONS,
@@ -80,6 +84,8 @@ public class ImplementationClassNamesLoader implements SyncopeLoader {
 
         ClassPathScanningCandidateComponentProvider scanner = new ClassPathScanningCandidateComponentProvider(false);
         scanner.addIncludeFilter(new AssignableTypeFilter(Reportlet.class));
+        scanner.addIncludeFilter(new AssignableTypeFilter(AccountRule.class));
+        scanner.addIncludeFilter(new AssignableTypeFilter(PasswordRule.class));
         scanner.addIncludeFilter(new AssignableTypeFilter(SchedTaskJobDelegate.class));
         scanner.addIncludeFilter(new AssignableTypeFilter(SyncActions.class));
         scanner.addIncludeFilter(new AssignableTypeFilter(PushActions.class));
@@ -99,6 +105,13 @@ public class ImplementationClassNamesLoader implements SyncopeLoader {
                     classNames.get(Type.REPORTLET).add(clazz.getName());
                 }
 
+                if (AccountRule.class.isAssignableFrom(clazz) && !isAbsractClazz) {
+                    classNames.get(Type.ACCOUNT_RULE).add(clazz.getName());
+                }
+                if (PasswordRule.class.isAssignableFrom(clazz) && !isAbsractClazz) {
+                    classNames.get(Type.PASSWORD_RULE).add(clazz.getName());
+                }
+
                 if (SchedTaskJobDelegate.class.isAssignableFrom(clazz) && !isAbsractClazz
                         && !SyncJobDelegate.class.isAssignableFrom(clazz)
                         && !PushJobDelegate.class.isAssignableFrom(clazz)) {

http://git-wip-us.apache.org/repos/asf/syncope/blob/b8cadde8/core/logic/src/main/java/org/apache/syncope/core/logic/report/AbstractReportlet.java
----------------------------------------------------------------------
diff --git a/core/logic/src/main/java/org/apache/syncope/core/logic/report/AbstractReportlet.java b/core/logic/src/main/java/org/apache/syncope/core/logic/report/AbstractReportlet.java
index 8c1e272..482ad0e 100644
--- a/core/logic/src/main/java/org/apache/syncope/core/logic/report/AbstractReportlet.java
+++ b/core/logic/src/main/java/org/apache/syncope/core/logic/report/AbstractReportlet.java
@@ -18,7 +18,7 @@
  */
 package org.apache.syncope.core.logic.report;
 
-import org.apache.syncope.common.lib.report.AbstractReportletConf;
+import org.apache.syncope.common.lib.report.ReportletConf;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.transaction.annotation.Transactional;
@@ -26,26 +26,15 @@ import org.xml.sax.ContentHandler;
 import org.xml.sax.SAXException;
 import org.xml.sax.helpers.AttributesImpl;
 
-public abstract class AbstractReportlet<T extends AbstractReportletConf> implements Reportlet<T> {
+public abstract class AbstractReportlet implements Reportlet {
 
     protected static final Logger LOG = LoggerFactory.getLogger(AbstractReportlet.class);
 
-    protected T conf;
-
-    public T getConf() {
-        return conf;
-    }
-
-    @Override
-    public void setConf(final T conf) {
-        this.conf = conf;
-    }
-
-    protected abstract void doExtract(ContentHandler handler) throws SAXException;
+    protected abstract void doExtract(ReportletConf conf, ContentHandler handler) throws SAXException;
 
     @Override
     @Transactional(readOnly = true)
-    public void extract(final ContentHandler handler) throws SAXException {
+    public void extract(final ReportletConf conf, final ContentHandler handler) throws SAXException {
         if (conf == null) {
             throw new ReportException(new IllegalArgumentException("No configuration provided"));
         }
@@ -55,7 +44,7 @@ public abstract class AbstractReportlet<T extends AbstractReportletConf> impleme
         atts.addAttribute("", "", ReportXMLConst.ATTR_CLASS, ReportXMLConst.XSD_STRING, getClass().getName());
         handler.startElement("", "", ReportXMLConst.ELEMENT_REPORTLET, atts);
 
-        doExtract(handler);
+        doExtract(conf, handler);
 
         handler.endElement("", "", ReportXMLConst.ELEMENT_REPORTLET);
     }

http://git-wip-us.apache.org/repos/asf/syncope/blob/b8cadde8/core/logic/src/main/java/org/apache/syncope/core/logic/report/GroupReportlet.java
----------------------------------------------------------------------
diff --git a/core/logic/src/main/java/org/apache/syncope/core/logic/report/GroupReportlet.java b/core/logic/src/main/java/org/apache/syncope/core/logic/report/GroupReportlet.java
index 5b89421..c5e6642 100644
--- a/core/logic/src/main/java/org/apache/syncope/core/logic/report/GroupReportlet.java
+++ b/core/logic/src/main/java/org/apache/syncope/core/logic/report/GroupReportlet.java
@@ -26,6 +26,7 @@ import org.apache.commons.lang3.StringUtils;
 import org.apache.syncope.common.lib.SyncopeConstants;
 import org.apache.syncope.common.lib.report.GroupReportletConf;
 import org.apache.syncope.common.lib.report.GroupReportletConf.Feature;
+import org.apache.syncope.common.lib.report.ReportletConf;
 import org.apache.syncope.common.lib.to.AnyTO;
 import org.apache.syncope.common.lib.to.AttrTO;
 import org.apache.syncope.common.lib.to.GroupTO;
@@ -43,7 +44,7 @@ import org.xml.sax.SAXException;
 import org.xml.sax.helpers.AttributesImpl;
 
 @ReportletConfClass(GroupReportletConf.class)
-public class GroupReportlet extends AbstractReportlet<GroupReportletConf> {
+public class GroupReportlet extends AbstractReportlet {
 
     private static final int PAGE_SIZE = 10;
 
@@ -56,6 +57,8 @@ public class GroupReportlet extends AbstractReportlet<GroupReportletConf> {
     @Autowired
     private GroupDataBinder groupDataBinder;
 
+    private GroupReportletConf conf;
+
     private List<Group> getPagedGroups(final int page) {
         List<Group> result;
 
@@ -296,7 +299,13 @@ public class GroupReportlet extends AbstractReportlet<GroupReportletConf> {
     }
 
     @Override
-    protected void doExtract(final ContentHandler handler) throws SAXException {
+    protected void doExtract(final ReportletConf conf, final ContentHandler handler) throws SAXException {
+        if (conf instanceof GroupReportletConf) {
+            this.conf = GroupReportletConf.class.cast(conf);
+        } else {
+            throw new ReportException(new IllegalArgumentException("Invalid configuration provided"));
+        }
+
         doExtractConf(handler);
         for (int i = 1; i <= (count() / PAGE_SIZE) + 1; i++) {
             doExtract(handler, getPagedGroups(i));