This Confluence has been LDAP enabled, if you are an ASF Committer, please use your LDAP Credentials to login. Any problems file an INFRA jira ticket please.

Page tree
Skip to end of metadata
Go to start of metadata

Version Warning

The content below is for Apache Syncope <= 1.2 - for later versions the Reference Guide is available.


An attribute validator class is used to validate the value to be assigned to an attribute.

This wiki page aims to show hot to implement and deploy a new attribute validator class.


An attribute validator class must extend AbstractValidator class.

Conditions must be evaluated into the method doValidate(...).

In case of an attribute value not valid an InvalidAttrValueException exception must be thrown.

A sample validator has been provided below.

package org.apache.syncope.core.persistence.validation.attrvalue;

import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.apache.syncope.core.persistence.beans.AbstractSchema;
import org.apache.syncope.core.persistence.beans.AbstractAttrValue;

public class EmailAddressValidator extends AbstractValidator {

    private static final Pattern EMAIL_PATTERN = Pattern.compile(

    public EmailAddressValidator(final AbstractSchema schema) {

    protected void doValidate(final AbstractAttrValue attributeValue)
            throws InvalidAttrValueException {

        Matcher matcher = EMAIL_PATTERN.matcher(
            (CharSequence) attributeValue.getValue());

        if (!matcher.matches()) {
            throw new InvalidAttrValueException(attributeValue);


An attribute validator class can be deployed:

  • at project definition time
    by adding own implementation into the overlay project, before to build Syncope.
  • at run-time
    by including into the container classpath own implementation (container must be re-started to reload the classpath).
  • No labels