Search in sources :

Example 1 with StringAnonymizer

use of org.apache.directory.api.ldap.model.ldif.anonymizer.StringAnonymizer in project directory-ldap-api by apache.

the class LdifAnonymizer method init.

/**
 * Initialize the anonymizer, filling the maps we use.
 */
private void init(Map<Integer, String> stringLatestValueMap, Map<Integer, byte[]> binaryLatestValueMap, Map<Integer, String> integerLatestValueMap, Map<Integer, String> telephoneNumberLatestValueMap) {
    // Load the anonymizers
    attributeAnonymizers.put(SchemaConstants.CAR_LICENSE_AT_OID, new StringAnonymizer(stringLatestValueMap));
    attributeAnonymizers.put(SchemaConstants.DOMAIN_COMPONENT_AT_OID, new StringAnonymizer(stringLatestValueMap));
    attributeAnonymizers.put(SchemaConstants.CN_AT_OID, new StringAnonymizer(stringLatestValueMap));
    attributeAnonymizers.put(SchemaConstants.DESCRIPTION_AT_OID, new StringAnonymizer(stringLatestValueMap));
    attributeAnonymizers.put(SchemaConstants.DISPLAY_NAME_AT_OID, new StringAnonymizer(stringLatestValueMap));
    attributeAnonymizers.put(SchemaConstants.GECOS_AT_OID, new StringAnonymizer(stringLatestValueMap));
    attributeAnonymizers.put(SchemaConstants.GID_NUMBER_AT_OID, new IntegerAnonymizer(integerLatestValueMap));
    attributeAnonymizers.put(SchemaConstants.GIVENNAME_AT_OID, new StringAnonymizer(stringLatestValueMap));
    attributeAnonymizers.put(SchemaConstants.HOME_DIRECTORY_AT_OID, new CaseSensitiveStringAnonymizer(stringLatestValueMap));
    attributeAnonymizers.put(SchemaConstants.HOME_PHONE_AT_OID, new TelephoneNumberAnonymizer());
    attributeAnonymizers.put(SchemaConstants.HOME_POSTAL_ADDRESS_AT_OID, new StringAnonymizer(stringLatestValueMap));
    attributeAnonymizers.put(SchemaConstants.HOST_AT_OID, new StringAnonymizer(stringLatestValueMap));
    attributeAnonymizers.put(SchemaConstants.HOUSE_IDENTIFIER_AT_OID, new StringAnonymizer(stringLatestValueMap));
    attributeAnonymizers.put(SchemaConstants.JPEG_PHOTO_AT_OID, new BinaryAnonymizer(binaryLatestValueMap));
    attributeAnonymizers.put(SchemaConstants.LABELED_URI_AT_OID, new CaseSensitiveStringAnonymizer(stringLatestValueMap));
    attributeAnonymizers.put(SchemaConstants.LOCALITY_NAME_AT_OID, new StringAnonymizer(stringLatestValueMap));
    attributeAnonymizers.put(SchemaConstants.MAIL_AT_OID, new StringAnonymizer(stringLatestValueMap));
    attributeAnonymizers.put(SchemaConstants.MANAGER_AT_OID, new StringAnonymizer(stringLatestValueMap));
    attributeAnonymizers.put(SchemaConstants.MEMBER_UID_AT_OID, new StringAnonymizer(stringLatestValueMap));
    attributeAnonymizers.put(SchemaConstants.MOBILE_AT_OID, new TelephoneNumberAnonymizer());
    attributeAnonymizers.put(SchemaConstants.ORGANIZATION_NAME_AT_OID, new StringAnonymizer(stringLatestValueMap));
    attributeAnonymizers.put(SchemaConstants.ORGANIZATIONAL_UNIT_NAME_AT_OID, new StringAnonymizer(stringLatestValueMap));
    attributeAnonymizers.put(SchemaConstants.PAGER_AT_OID, new TelephoneNumberAnonymizer());
    attributeAnonymizers.put(SchemaConstants.POSTAL_ADDRESS_AT_OID, new StringAnonymizer(stringLatestValueMap));
    attributeAnonymizers.put(SchemaConstants.PHOTO_AT_OID, new BinaryAnonymizer(binaryLatestValueMap));
    attributeAnonymizers.put(SchemaConstants.SECRETARY_AT_OID, new StringAnonymizer(stringLatestValueMap));
    attributeAnonymizers.put(SchemaConstants.SEE_ALSO_AT_OID, new StringAnonymizer(stringLatestValueMap));
    attributeAnonymizers.put(SchemaConstants.SN_AT_OID, new StringAnonymizer(stringLatestValueMap));
    attributeAnonymizers.put(SchemaConstants.TELEPHONE_NUMBER_AT_OID, new TelephoneNumberAnonymizer(telephoneNumberLatestValueMap));
    attributeAnonymizers.put(SchemaConstants.UID_AT_OID, new StringAnonymizer(stringLatestValueMap));
    attributeAnonymizers.put(SchemaConstants.UID_NUMBER_AT_OID, new IntegerAnonymizer(integerLatestValueMap));
    attributeAnonymizers.put(SchemaConstants.USER_CERTIFICATE_AT_OID, new BinaryAnonymizer(binaryLatestValueMap));
    attributeAnonymizers.put(SchemaConstants.USER_PASSWORD_AT_OID, new BinaryAnonymizer(binaryLatestValueMap));
    attributeAnonymizers.put(SchemaConstants.USER_PKCS12_AT_OID, new BinaryAnonymizer(binaryLatestValueMap));
    attributeAnonymizers.put(SchemaConstants.USER_SMIME_CERTIFICATE_AT_OID, new BinaryAnonymizer(binaryLatestValueMap));
    attributeAnonymizers.put(SchemaConstants.X500_UNIQUE_IDENTIFIER_AT_OID, new BinaryAnonymizer(binaryLatestValueMap));
    attributeAnonymizers.put(SchemaConstants.FACSIMILE_TELEPHONE_NUMBER_AT_OID, new TelephoneNumberAnonymizer(telephoneNumberLatestValueMap));
}
Also used : StringAnonymizer(org.apache.directory.api.ldap.model.ldif.anonymizer.StringAnonymizer) CaseSensitiveStringAnonymizer(org.apache.directory.api.ldap.model.ldif.anonymizer.CaseSensitiveStringAnonymizer) IntegerAnonymizer(org.apache.directory.api.ldap.model.ldif.anonymizer.IntegerAnonymizer) BinaryAnonymizer(org.apache.directory.api.ldap.model.ldif.anonymizer.BinaryAnonymizer) TelephoneNumberAnonymizer(org.apache.directory.api.ldap.model.ldif.anonymizer.TelephoneNumberAnonymizer) CaseSensitiveStringAnonymizer(org.apache.directory.api.ldap.model.ldif.anonymizer.CaseSensitiveStringAnonymizer)

Example 2 with StringAnonymizer

use of org.apache.directory.api.ldap.model.ldif.anonymizer.StringAnonymizer in project directory-ldap-api by apache.

the class LdifAnonymizer method addAnonAttributeType.

/**
 * Add an attributeType that has to be anonymized
 *
 * @param attributeType the AttributeType that has to be anonymized
 * @throws LdapException If the attributeType cannot be added
 */
public void addAnonAttributeType(AttributeType attributeType) throws LdapException {
    schemaManager.add(attributeType);
    LdapSyntax syntax = attributeType.getSyntax();
    if (syntax.isHumanReadable()) {
        if (syntax.getOid().equals(SchemaConstants.INTEGER_SYNTAX)) {
            attributeAnonymizers.put(attributeType.getOid(), new IntegerAnonymizer());
        } else if (syntax.getOid().equals(SchemaConstants.DIRECTORY_STRING_SYNTAX)) {
            attributeAnonymizers.put(attributeType.getOid(), new StringAnonymizer());
        } else if (syntax.getOid().equals(SchemaConstants.TELEPHONE_NUMBER_SYNTAX)) {
            attributeAnonymizers.put(attributeType.getOid(), new TelephoneNumberAnonymizer());
        }
    } else {
        attributeAnonymizers.put(attributeType.getOid(), new BinaryAnonymizer());
    }
}
Also used : IntegerAnonymizer(org.apache.directory.api.ldap.model.ldif.anonymizer.IntegerAnonymizer) StringAnonymizer(org.apache.directory.api.ldap.model.ldif.anonymizer.StringAnonymizer) CaseSensitiveStringAnonymizer(org.apache.directory.api.ldap.model.ldif.anonymizer.CaseSensitiveStringAnonymizer) BinaryAnonymizer(org.apache.directory.api.ldap.model.ldif.anonymizer.BinaryAnonymizer) TelephoneNumberAnonymizer(org.apache.directory.api.ldap.model.ldif.anonymizer.TelephoneNumberAnonymizer) LdapSyntax(org.apache.directory.api.ldap.model.schema.LdapSyntax)

Aggregations

BinaryAnonymizer (org.apache.directory.api.ldap.model.ldif.anonymizer.BinaryAnonymizer)2 CaseSensitiveStringAnonymizer (org.apache.directory.api.ldap.model.ldif.anonymizer.CaseSensitiveStringAnonymizer)2 IntegerAnonymizer (org.apache.directory.api.ldap.model.ldif.anonymizer.IntegerAnonymizer)2 StringAnonymizer (org.apache.directory.api.ldap.model.ldif.anonymizer.StringAnonymizer)2 TelephoneNumberAnonymizer (org.apache.directory.api.ldap.model.ldif.anonymizer.TelephoneNumberAnonymizer)2 LdapSyntax (org.apache.directory.api.ldap.model.schema.LdapSyntax)1