Replace server's AdminTestCaseUtils by the SDK equivalent
Added InitializationUtils as a helper
1 files deleted
1 files added
54 files modified
| | |
| | | <configuration> |
| | | <includes> |
| | | <!-- Classes to have mocks with configuration defaults --> |
| | | <include>**/AdminTestCaseUtils.class</include> |
| | | <include>**/AdminTestCaseUtils$*.class</include> |
| | | <include>**/ConfigurationMock.class</include> |
| | | <include>**/ConfigurationMock$*.class</include> |
| | | </includes> |
| | |
| | | import org.testng.annotations.Test; |
| | | import org.testng.annotations.BeforeClass; |
| | | |
| | | import org.forgerock.opendj.config.server.AdminTestCaseUtils; |
| | | import org.forgerock.opendj.server.config.meta.PluginCfgDefn; |
| | | import org.forgerock.opendj.server.config.server.PluginCfg; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.extensions.InitializationUtils; |
| | | import org.opends.server.plugins.NullPlugin; |
| | | import org.opends.server.types.DisconnectReason; |
| | | import org.forgerock.opendj.ldap.DN; |
| | |
| | | "ds-cfg-plugin-type: intermediateResponse"); |
| | | |
| | | PluginCfg configuration = |
| | | AdminTestCaseUtils.getConfiguration(PluginCfgDefn.getInstance(), pluginEntry); |
| | | InitializationUtils.getConfiguration(PluginCfgDefn.getInstance(), pluginEntry); |
| | | |
| | | NullPlugin nullPlugin = new NullPlugin(); |
| | | DN pluginEntryDN = DN.valueOf("cn=Null Plugin,cn=Plugins,cn=config"); |
| | |
| | | "ds-cfg-plugin-type: intermediateResponse"); |
| | | |
| | | PluginCfg configuration = |
| | | AdminTestCaseUtils.getConfiguration(PluginCfgDefn.getInstance(), pluginEntry); |
| | | InitializationUtils.getConfiguration(PluginCfgDefn.getInstance(), pluginEntry); |
| | | |
| | | NullPlugin nullPlugin = new NullPlugin(); |
| | | |
| | |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.forgerock.opendj.ldap.schema.AttributeType; |
| | | import org.opends.server.TestCaseUtils; |
| | | import org.forgerock.opendj.config.server.AdminTestCaseUtils; |
| | | import org.forgerock.opendj.server.config.meta.PasswordPolicyCfgDefn; |
| | | import org.forgerock.opendj.server.config.server.PasswordPolicyCfg; |
| | | import org.opends.server.api.PasswordStorageScheme; |
| | | import org.opends.server.extensions.InitializationUtils; |
| | | import org.opends.server.types.Entry; |
| | | import org.opends.server.schema.UserPasswordSyntax; |
| | | import org.opends.server.tools.LDAPModify; |
| | | import org.opends.server.types.Attribute; |
| | | import org.opends.server.types.DirectoryException; |
| | | import org.opends.server.types.Entry; |
| | | import org.opends.server.types.InitializationException; |
| | | import org.opends.server.util.TimeThread; |
| | | import org.testng.annotations.BeforeClass; |
| | |
| | | throws Exception |
| | | { |
| | | PasswordPolicyCfg configuration = |
| | | AdminTestCaseUtils.getConfiguration(PasswordPolicyCfgDefn.getInstance(), e); |
| | | InitializationUtils.getConfiguration(PasswordPolicyCfgDefn.getInstance(), e); |
| | | |
| | | new PasswordPolicyFactory().createAuthenticationPolicy(configuration); |
| | | } |
| | |
| | | */ |
| | | package org.opends.server.extensions; |
| | | |
| | | |
| | | |
| | | import org.forgerock.opendj.config.server.AdminTestCaseUtils; |
| | | import org.forgerock.opendj.server.config.meta.AESPasswordStorageSchemeCfgDefn; |
| | | import org.forgerock.opendj.server.config.server.AESPasswordStorageSchemeCfg; |
| | | import org.opends.server.api.PasswordStorageScheme; |
| | | |
| | | |
| | | |
| | | /** |
| | | * A set of test cases for the AES password storage scheme. |
| | | */ |
| | | /** A set of test cases for the AES password storage scheme. */ |
| | | public class AESPasswordStorageSchemeTestCase |
| | | extends PasswordStorageSchemeTestCase |
| | | { |
| | | /** |
| | | * Creates a new instance of this storage scheme test case. |
| | | */ |
| | | /** Creates a new instance of this storage scheme test case. */ |
| | | public AESPasswordStorageSchemeTestCase() |
| | | { |
| | | super("cn=AES,cn=Password Storage Schemes,cn=config"); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Retrieves an initialized instance of this password storage scheme. |
| | | * |
| | | * @return An initialized instance of this password storage scheme. |
| | | * |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | protected PasswordStorageScheme getScheme() |
| | | throws Exception |
| | | protected PasswordStorageScheme<?> getScheme() throws Exception |
| | | { |
| | | AESPasswordStorageScheme scheme = new AESPasswordStorageScheme(); |
| | | |
| | | AESPasswordStorageSchemeCfg configuration = |
| | | AdminTestCaseUtils.getConfiguration( |
| | | AESPasswordStorageSchemeCfgDefn.getInstance(), |
| | | configEntry); |
| | | |
| | | scheme.initializePasswordStorageScheme(configuration); |
| | | return scheme; |
| | | return InitializationUtils.initializePasswordStorageScheme( |
| | | new AESPasswordStorageScheme(), configEntry, AESPasswordStorageSchemeCfgDefn.getInstance()); |
| | | } |
| | | } |
| | | |
| | |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.forgerock.opendj.ldap.ModificationType; |
| | | import org.opends.server.TestCaseUtils; |
| | | import org.forgerock.opendj.config.server.AdminTestCaseUtils; |
| | | import org.forgerock.opendj.server.config.meta.AttributeValuePasswordValidatorCfgDefn; |
| | | import org.forgerock.opendj.server.config.server.AttributeValuePasswordValidatorCfg; |
| | | import org.opends.server.core.ModifyOperationBasis; |
| | | import org.opends.server.protocols.internal.InternalClientConnection; |
| | | import org.opends.server.types.Attributes; |
| | |
| | | public void testInitializeWithValidConfigs(Entry e) |
| | | throws Exception |
| | | { |
| | | AttributeValuePasswordValidatorCfg configuration = |
| | | AdminTestCaseUtils.getConfiguration( |
| | | AttributeValuePasswordValidatorCfgDefn.getInstance(), e); |
| | | |
| | | AttributeValuePasswordValidator validator = |
| | | new AttributeValuePasswordValidator(); |
| | | validator.initializePasswordValidator(configuration); |
| | | AttributeValuePasswordValidator validator = initializePasswordValidator(e); |
| | | validator.finalizePasswordValidator(); |
| | | } |
| | | |
| | |
| | | public void testInitializeWithInvalidConfigs(Entry e) |
| | | throws Exception |
| | | { |
| | | AttributeValuePasswordValidatorCfg configuration = |
| | | AdminTestCaseUtils.getConfiguration( |
| | | AttributeValuePasswordValidatorCfgDefn.getInstance(), e); |
| | | |
| | | AttributeValuePasswordValidator validator = |
| | | new AttributeValuePasswordValidator(); |
| | | validator.initializePasswordValidator(configuration); |
| | | initializePasswordValidator(e); |
| | | } |
| | | |
| | | |
| | |
| | | "cn: Test User", |
| | | "userPassword: doesntmatter"); |
| | | |
| | | AttributeValuePasswordValidatorCfg configuration = |
| | | AdminTestCaseUtils.getConfiguration( |
| | | AttributeValuePasswordValidatorCfgDefn.getInstance(), |
| | | configEntry); |
| | | |
| | | AttributeValuePasswordValidator validator = |
| | | new AttributeValuePasswordValidator(); |
| | | validator.initializePasswordValidator(configuration); |
| | | AttributeValuePasswordValidator validator = initializePasswordValidator(configEntry); |
| | | |
| | | ByteString pwOS = ByteString.valueOfUtf8(password); |
| | | ArrayList<Modification> mods = CollectionUtils.newArrayList( |
| | |
| | | |
| | | validator.finalizePasswordValidator(); |
| | | } |
| | | } |
| | | |
| | | private AttributeValuePasswordValidator initializePasswordValidator(Entry configEntry) throws ConfigException, InitializationException { |
| | | return InitializationUtils.initializePasswordValidator( |
| | | new AttributeValuePasswordValidator(), configEntry, AttributeValuePasswordValidatorCfgDefn.getInstance()); |
| | | } |
| | | } |
| | |
| | | */ |
| | | package org.opends.server.extensions; |
| | | |
| | | |
| | | |
| | | import org.forgerock.opendj.config.server.AdminTestCaseUtils; |
| | | import org.forgerock.opendj.server.config.meta.Base64PasswordStorageSchemeCfgDefn; |
| | | import org.forgerock.opendj.server.config.server.Base64PasswordStorageSchemeCfg; |
| | | import org.opends.server.api.PasswordStorageScheme; |
| | | |
| | | |
| | | |
| | | /** |
| | | * A set of test cases for the base64 password storage scheme. |
| | | */ |
| | |
| | | * |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | protected PasswordStorageScheme getScheme() |
| | | throws Exception |
| | | protected PasswordStorageScheme<?> getScheme() throws Exception |
| | | { |
| | | Base64PasswordStorageScheme scheme = new Base64PasswordStorageScheme(); |
| | | |
| | | Base64PasswordStorageSchemeCfg configuration = |
| | | AdminTestCaseUtils.getConfiguration( |
| | | Base64PasswordStorageSchemeCfgDefn.getInstance(), |
| | | configEntry |
| | | ); |
| | | |
| | | scheme.initializePasswordStorageScheme(configuration); |
| | | return scheme; |
| | | return InitializationUtils.initializePasswordStorageScheme( |
| | | new Base64PasswordStorageScheme(), configEntry, Base64PasswordStorageSchemeCfgDefn.getInstance()); |
| | | } |
| | | } |
| | | |
| | |
| | | package org.opends.server.extensions; |
| | | |
| | | import org.forgerock.opendj.server.config.meta.BcryptPasswordStorageSchemeCfgDefn; |
| | | import org.forgerock.opendj.server.config.server.BcryptPasswordStorageSchemeCfg; |
| | | import org.forgerock.opendj.config.server.AdminTestCaseUtils; |
| | | import org.opends.server.api.PasswordStorageScheme; |
| | | import org.testng.annotations.DataProvider; |
| | | import org.testng.annotations.Test; |
| | |
| | | @Override |
| | | protected PasswordStorageScheme<?> getScheme() throws Exception |
| | | { |
| | | BcryptPasswordStorageScheme scheme = |
| | | new BcryptPasswordStorageScheme(); |
| | | |
| | | BcryptPasswordStorageSchemeCfg configuration = |
| | | AdminTestCaseUtils.getConfiguration(BcryptPasswordStorageSchemeCfgDefn.getInstance(), configEntry); |
| | | |
| | | scheme.initializePasswordStorageScheme(configuration); |
| | | return scheme; |
| | | return InitializationUtils.initializePasswordStorageScheme( |
| | | new BcryptPasswordStorageScheme(), configEntry, BcryptPasswordStorageSchemeCfgDefn.getInstance()); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | package org.opends.server.extensions; |
| | | |
| | | |
| | | |
| | | import org.forgerock.opendj.config.server.AdminTestCaseUtils; |
| | | import org.forgerock.opendj.server.config.meta.BlowfishPasswordStorageSchemeCfgDefn; |
| | | import org.forgerock.opendj.server.config.server.BlowfishPasswordStorageSchemeCfg; |
| | | import org.opends.server.api.PasswordStorageScheme; |
| | | |
| | | |
| | | |
| | | /** |
| | | * A set of test cases for the Blowfish password storage scheme. |
| | | */ |
| | |
| | | * |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | protected PasswordStorageScheme getScheme() |
| | | throws Exception |
| | | protected PasswordStorageScheme<?> getScheme() throws Exception |
| | | { |
| | | BlowfishPasswordStorageScheme scheme = new BlowfishPasswordStorageScheme(); |
| | | |
| | | BlowfishPasswordStorageSchemeCfg configuration = |
| | | AdminTestCaseUtils.getConfiguration( |
| | | BlowfishPasswordStorageSchemeCfgDefn.getInstance(), |
| | | configEntry); |
| | | |
| | | scheme.initializePasswordStorageScheme(configuration); |
| | | return scheme; |
| | | return InitializationUtils.initializePasswordStorageScheme( |
| | | new BlowfishPasswordStorageScheme(), configEntry, BlowfishPasswordStorageSchemeCfgDefn.getInstance()); |
| | | } |
| | | } |
| | | |
| | |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.opends.server.TestCaseUtils; |
| | | import org.forgerock.opendj.config.server.AdminTestCaseUtils; |
| | | import org.forgerock.opendj.server.config.meta.CramMD5SASLMechanismHandlerCfgDefn; |
| | | import org.forgerock.opendj.server.config.server.CramMD5SASLMechanismHandlerCfg; |
| | | import org.opends.server.core.BindOperation; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.protocols.internal.InternalClientConnection; |
| | |
| | | import static org.opends.server.util.ServerConstants.*; |
| | | import static org.testng.Assert.*; |
| | | |
| | | /** |
| | | * A set of test cases for the CRAM-MD5 SASL mechanism handler. |
| | | */ |
| | | /** A set of test cases for the CRAM-MD5 SASL mechanism handler. */ |
| | | @SuppressWarnings("javadoc") |
| | | public class CRAMMD5SASLMechanismHandlerTestCase |
| | | extends ExtensionsTestCase |
| | | { |
| | | /** |
| | | * Ensures that the Directory Server is running. |
| | | * |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | @BeforeClass |
| | | public void startServer() throws Exception |
| | | { |
| | |
| | | public void testInitializeWithInvalidConfigs(Entry e) |
| | | throws Exception |
| | | { |
| | | CramMD5SASLMechanismHandlerCfg configuration = |
| | | AdminTestCaseUtils.getConfiguration( |
| | | CramMD5SASLMechanismHandlerCfgDefn.getInstance(), |
| | | e); |
| | | |
| | | CRAMMD5SASLMechanismHandler handler = new CRAMMD5SASLMechanismHandler(); |
| | | handler.initializeSASLMechanismHandler(configuration); |
| | | InitializationUtils.initializeSASLMechanismHandler( |
| | | new CRAMMD5SASLMechanismHandler(), e, CramMD5SASLMechanismHandlerCfgDefn.getInstance()); |
| | | } |
| | | |
| | | |
| | |
| | | import org.opends.server.TestCaseUtils; |
| | | import org.forgerock.i18n.LocalizableMessageBuilder; |
| | | import org.forgerock.opendj.server.config.meta.CharacterSetPasswordValidatorCfgDefn; |
| | | import org.forgerock.opendj.server.config.server.CharacterSetPasswordValidatorCfg; |
| | | import org.forgerock.opendj.config.server.AdminTestCaseUtils; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.opends.server.core.ModifyOperationBasis; |
| | | import org.opends.server.protocols.internal.InternalClientConnection; |
| | |
| | | public void testInitializeWithValidConfigs(Entry e) |
| | | throws Exception |
| | | { |
| | | CharacterSetPasswordValidatorCfg configuration = |
| | | AdminTestCaseUtils.getConfiguration( |
| | | CharacterSetPasswordValidatorCfgDefn.getInstance(), e); |
| | | |
| | | CharacterSetPasswordValidator validator = |
| | | new CharacterSetPasswordValidator(); |
| | | validator.initializePasswordValidator(configuration); |
| | | CharacterSetPasswordValidator validator = initializePasswordValidator(e); |
| | | validator.finalizePasswordValidator(); |
| | | } |
| | | |
| | | |
| | | private CharacterSetPasswordValidator initializePasswordValidator(Entry e) throws ConfigException, InitializationException { |
| | | return InitializationUtils.initializePasswordValidator( |
| | | new CharacterSetPasswordValidator(), e, CharacterSetPasswordValidatorCfgDefn.getInstance()); |
| | | } |
| | | |
| | | /** |
| | | * Retrieves a set of invalid configuration entries. |
| | |
| | | public void testInitializeWithInvalidConfigs(Entry e) |
| | | throws Exception |
| | | { |
| | | CharacterSetPasswordValidatorCfg configuration = |
| | | AdminTestCaseUtils.getConfiguration( |
| | | CharacterSetPasswordValidatorCfgDefn.getInstance(), e); |
| | | |
| | | CharacterSetPasswordValidator validator = |
| | | new CharacterSetPasswordValidator(); |
| | | validator.initializePasswordValidator(configuration); |
| | | initializePasswordValidator(e); |
| | | |
| | | StringBuilder buffer = new StringBuilder(); |
| | | for (StringBuilder line : e.toLDIF()) |
| | |
| | | "cn: Test User", |
| | | "userPassword: doesntmatter"); |
| | | |
| | | CharacterSetPasswordValidatorCfg configuration = |
| | | AdminTestCaseUtils.getConfiguration( |
| | | CharacterSetPasswordValidatorCfgDefn.getInstance(), |
| | | configEntry); |
| | | |
| | | CharacterSetPasswordValidator validator = |
| | | new CharacterSetPasswordValidator(); |
| | | validator.initializePasswordValidator(configuration); |
| | | CharacterSetPasswordValidator validator = initializePasswordValidator(configEntry); |
| | | |
| | | ByteString pwOS = ByteString.valueOfUtf8(password); |
| | | ArrayList<Modification> mods = newArrayList( |
| | |
| | | */ |
| | | package org.opends.server.extensions; |
| | | |
| | | |
| | | |
| | | import org.forgerock.opendj.config.server.AdminTestCaseUtils; |
| | | import org.forgerock.opendj.server.config.meta.ClearPasswordStorageSchemeCfgDefn; |
| | | import org.forgerock.opendj.server.config.server.ClearPasswordStorageSchemeCfg; |
| | | import org.opends.server.api.PasswordStorageScheme; |
| | | |
| | | |
| | | |
| | | /** |
| | | * A set of test cases for the clear password storage scheme. |
| | | */ |
| | | /** A set of test cases for the clear password storage scheme. */ |
| | | public class ClearPasswordStorageSchemeTestCase |
| | | extends PasswordStorageSchemeTestCase |
| | | { |
| | | /** |
| | | * Creates a new instance of this storage scheme test case. |
| | | */ |
| | | /** Creates a new instance of this storage scheme test case. */ |
| | | public ClearPasswordStorageSchemeTestCase() |
| | | { |
| | | super("cn=Clear,cn=Password Storage Schemes,cn=config"); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Retrieves an initialized instance of this password storage scheme. |
| | | * |
| | | * @return An initialized instance of this password storage scheme. |
| | | * |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | protected PasswordStorageScheme getScheme() |
| | | throws Exception |
| | | protected PasswordStorageScheme<?> getScheme() throws Exception |
| | | { |
| | | ClearPasswordStorageScheme scheme = new ClearPasswordStorageScheme(); |
| | | |
| | | ClearPasswordStorageSchemeCfg configuration = |
| | | AdminTestCaseUtils.getConfiguration( |
| | | ClearPasswordStorageSchemeCfgDefn.getInstance(), |
| | | configEntry |
| | | ); |
| | | |
| | | scheme.initializePasswordStorageScheme(configuration); |
| | | return scheme; |
| | | return InitializationUtils.initializePasswordStorageScheme( |
| | | new ClearPasswordStorageScheme(), configEntry, ClearPasswordStorageSchemeCfgDefn.getInstance()); |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.opends.server.TestCaseUtils; |
| | | import org.forgerock.opendj.config.server.AdminTestCaseUtils; |
| | | import org.forgerock.opendj.server.config.meta.CryptPasswordStorageSchemeCfgDefn; |
| | | import org.forgerock.opendj.server.config.server.CryptPasswordStorageSchemeCfg; |
| | | import org.opends.server.types.Entry; |
| | | import org.testng.annotations.BeforeClass; |
| | | import org.testng.annotations.DataProvider; |
| | |
| | | |
| | | import static org.opends.server.extensions.PasswordStorageSchemeTestCase.*; |
| | | |
| | | |
| | | /** |
| | | * A set of test cases for the crypt password storage scheme. |
| | | */ |
| | |
| | | private CryptPasswordStorageScheme getScheme(String algo) |
| | | throws Exception |
| | | { |
| | | CryptPasswordStorageScheme scheme = |
| | | new CryptPasswordStorageScheme(); |
| | | Entry e = TestCaseUtils.makeEntry( |
| | | "dn: cn=CRYPT,cn=Password Storage Schemes,cn=config", |
| | | "objectClass: top", |
| | |
| | | "ds-cfg-java-class: org.opends.server.extensions.CryptPasswordStorageScheme", |
| | | "ds-cfg-enabled: true", |
| | | "ds-cfg-crypt-password-storage-encryption-algrithm: " + algo |
| | | ); |
| | | CryptPasswordStorageSchemeCfg configuration = |
| | | AdminTestCaseUtils.getConfiguration( |
| | | CryptPasswordStorageSchemeCfgDefn.getInstance(), |
| | | e); |
| | | |
| | | scheme.initializePasswordStorageScheme(configuration); |
| | | return scheme; |
| | | ); |
| | | return InitializationUtils.initializePasswordStorageScheme( |
| | | new CryptPasswordStorageScheme(), e, CryptPasswordStorageSchemeCfgDefn.getInstance()); |
| | | } |
| | | } |
| | | |
| | |
| | | */ |
| | | package org.opends.server.extensions; |
| | | |
| | | |
| | | |
| | | import java.lang.reflect.Method; |
| | | import java.util.ArrayList; |
| | | import java.util.SortedMap; |
| | | import java.util.TreeMap; |
| | | |
| | | import org.opends.server.TestCaseUtils; |
| | | import org.forgerock.opendj.config.server.AdminTestCaseUtils; |
| | | import org.testng.annotations.BeforeClass; |
| | | import org.forgerock.opendj.server.config.meta.*; |
| | | import org.forgerock.opendj.server.config.server.EntryCacheCfg; |
| | |
| | | |
| | | import static org.testng.Assert.*; |
| | | |
| | | |
| | | |
| | | /** |
| | | * A set of test cases for default entry cache implementation. |
| | | */ |
| | |
| | | "ds-cfg-include-filter: uid=softref*", |
| | | "ds-cfg-include-filter: uid=test1*", |
| | | "ds-cfg-exclude-filter: uid=test0*"); |
| | | softRefCache.initializeEntryCache(AdminTestCaseUtils.getConfiguration( |
| | | softRefCache.initializeEntryCache(InitializationUtils.getConfiguration( |
| | | SoftReferenceEntryCacheCfgDefn.getInstance(), cacheSoftReferenceConfigEntry)); |
| | | cacheOrderMap.put(1, softRefCache); |
| | | |
| | |
| | | "ds-cfg-include-filter: uid=fifo*", |
| | | "ds-cfg-include-filter: uid=test2*", |
| | | "ds-cfg-include-filter: uid=test0*"); |
| | | fifoCache.initializeEntryCache(AdminTestCaseUtils.getConfiguration( |
| | | fifoCache.initializeEntryCache(InitializationUtils.getConfiguration( |
| | | FIFOEntryCacheCfgDefn.getInstance(), cacheFIFOConfigEntry)); |
| | | cacheOrderMap.put(2, fifoCache); |
| | | |
| | |
| | | import org.opends.server.TestCaseUtils; |
| | | import org.forgerock.i18n.LocalizableMessageBuilder; |
| | | import org.forgerock.opendj.server.config.meta.DictionaryPasswordValidatorCfgDefn; |
| | | import org.forgerock.opendj.server.config.server.DictionaryPasswordValidatorCfg; |
| | | import org.forgerock.opendj.config.server.AdminTestCaseUtils; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.opends.server.core.ModifyOperationBasis; |
| | | import org.opends.server.protocols.internal.InternalClientConnection; |
| | |
| | | public void testInitializeWithValidConfigs(Entry e) |
| | | throws Exception |
| | | { |
| | | DictionaryPasswordValidatorCfg configuration = |
| | | AdminTestCaseUtils.getConfiguration( |
| | | DictionaryPasswordValidatorCfgDefn.getInstance(), e); |
| | | |
| | | DictionaryPasswordValidator validator = |
| | | new DictionaryPasswordValidator(); |
| | | validator.initializePasswordValidator(configuration); |
| | | DictionaryPasswordValidator validator = initializePasswordValidator(e); |
| | | validator.finalizePasswordValidator(); |
| | | } |
| | | |
| | |
| | | public void testInitializeWithInvalidConfigs(Entry e) |
| | | throws Exception |
| | | { |
| | | DictionaryPasswordValidatorCfg configuration = |
| | | AdminTestCaseUtils.getConfiguration( |
| | | DictionaryPasswordValidatorCfgDefn.getInstance(), e); |
| | | |
| | | DictionaryPasswordValidator validator = |
| | | new DictionaryPasswordValidator(); |
| | | validator.initializePasswordValidator(configuration); |
| | | initializePasswordValidator(e); |
| | | } |
| | | |
| | | |
| | |
| | | "cn: Test User", |
| | | "userPassword: doesntmatter"); |
| | | |
| | | DictionaryPasswordValidatorCfg configuration = |
| | | AdminTestCaseUtils.getConfiguration( |
| | | DictionaryPasswordValidatorCfgDefn.getInstance(), |
| | | configEntry); |
| | | |
| | | DictionaryPasswordValidator validator = |
| | | new DictionaryPasswordValidator(); |
| | | validator.initializePasswordValidator(configuration); |
| | | DictionaryPasswordValidator validator = initializePasswordValidator(configEntry); |
| | | |
| | | ByteString pwOS = ByteString.valueOfUtf8(password); |
| | | ArrayList<Modification> mods = newArrayList( |
| | |
| | | |
| | | validator.finalizePasswordValidator(); |
| | | } |
| | | |
| | | private DictionaryPasswordValidator initializePasswordValidator(Entry configEntry) |
| | | throws ConfigException, InitializationException { |
| | | return InitializationUtils.initializePasswordValidator( |
| | | new DictionaryPasswordValidator(), configEntry, DictionaryPasswordValidatorCfgDefn.getInstance()); |
| | | } |
| | | } |
| | | |
| | |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.opends.server.TestCaseUtils; |
| | | import org.forgerock.opendj.config.server.AdminTestCaseUtils; |
| | | import org.forgerock.opendj.server.config.meta.DigestMD5SASLMechanismHandlerCfgDefn; |
| | | import org.forgerock.opendj.server.config.server.DigestMD5SASLMechanismHandlerCfg; |
| | | import org.opends.server.core.BindOperation; |
| | | import org.opends.server.core.DeleteOperation; |
| | | import org.opends.server.core.DirectoryServer; |
| | |
| | | public void testInitializeWithInvalidConfigs(Entry e) |
| | | throws Exception |
| | | { |
| | | DigestMD5SASLMechanismHandlerCfg configuration = |
| | | AdminTestCaseUtils.getConfiguration( |
| | | DigestMD5SASLMechanismHandlerCfgDefn.getInstance(), |
| | | e); |
| | | |
| | | DigestMD5SASLMechanismHandler handler = new DigestMD5SASLMechanismHandler(); |
| | | handler.initializeSASLMechanismHandler(configuration); |
| | | InitializationUtils.initializeSASLMechanismHandler( |
| | | new DigestMD5SASLMechanismHandler(), e, DigestMD5SASLMechanismHandlerCfgDefn.getInstance()); |
| | | } |
| | | |
| | | |
| | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.opends.server.TestCaseUtils; |
| | | import org.forgerock.opendj.config.server.AdminTestCaseUtils; |
| | | import org.forgerock.opendj.server.config.meta.ErrorLogAccountStatusNotificationHandlerCfgDefn; |
| | | import org.forgerock.opendj.server.config.server.ErrorLogAccountStatusNotificationHandlerCfg; |
| | | import org.opends.server.api.AccountStatusNotificationHandler; |
| | | import org.opends.server.api.AuthenticationPolicy; |
| | | import org.opends.server.types.Entry; |
| | |
| | | import org.opends.server.types.AccountStatusNotificationProperty; |
| | | import org.opends.server.types.AccountStatusNotificationType; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.opends.server.types.Entry; |
| | | import org.opends.server.types.InitializationException; |
| | | import org.testng.annotations.BeforeClass; |
| | | import org.testng.annotations.DataProvider; |
| | |
| | | public void testInvalidConfigs(Entry configEntry) |
| | | throws Exception |
| | | { |
| | | ErrorLogAccountStatusNotificationHandler handler = |
| | | new ErrorLogAccountStatusNotificationHandler(); |
| | | ErrorLogAccountStatusNotificationHandlerCfg configuration = |
| | | AdminTestCaseUtils.getConfiguration( |
| | | ErrorLogAccountStatusNotificationHandlerCfgDefn.getInstance(), |
| | | configEntry |
| | | ); |
| | | handler.initializeStatusNotificationHandler(configuration); |
| | | InitializationUtils.initializeStatusNotificationHandler( |
| | | new ErrorLogAccountStatusNotificationHandler(), configEntry, ErrorLogAccountStatusNotificationHandlerCfgDefn.getInstance()); |
| | | } |
| | | |
| | | |
| | |
| | | import org.forgerock.opendj.ldap.requests.ModifyRequest; |
| | | import org.forgerock.opendj.ldap.schema.AttributeType; |
| | | import org.opends.server.TestCaseUtils; |
| | | import org.forgerock.opendj.config.server.AdminTestCaseUtils; |
| | | import org.forgerock.opendj.server.config.meta.ExactMatchIdentityMapperCfgDefn; |
| | | import org.forgerock.opendj.server.config.server.ExactMatchIdentityMapperCfg; |
| | | import org.opends.server.api.IdentityMapper; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.core.ModifyOperation; |
| | |
| | | public void testValidConfigs(Entry e) |
| | | throws Exception |
| | | { |
| | | ExactMatchIdentityMapperCfg configuration = |
| | | AdminTestCaseUtils.getConfiguration( |
| | | ExactMatchIdentityMapperCfgDefn.getInstance(), e); |
| | | ExactMatchIdentityMapper mapper = new ExactMatchIdentityMapper(); |
| | | mapper.initializeIdentityMapper(configuration); |
| | | ExactMatchIdentityMapper mapper = initializeIdentityMapper(e); |
| | | mapper.finalizeIdentityMapper(); |
| | | } |
| | | |
| | |
| | | public void testInvalidConfigs(Entry e) |
| | | throws Exception |
| | | { |
| | | ExactMatchIdentityMapperCfg configuration = |
| | | AdminTestCaseUtils.getConfiguration( |
| | | ExactMatchIdentityMapperCfgDefn.getInstance(), e); |
| | | ExactMatchIdentityMapper mapper = new ExactMatchIdentityMapper(); |
| | | mapper.initializeIdentityMapper(configuration); |
| | | initializeIdentityMapper(e); |
| | | } |
| | | |
| | | |
| | |
| | | throws Exception |
| | | { |
| | | DN mapperDN = DN.valueOf(MAPPER_DN); |
| | | IdentityMapper mapper = DirectoryServer.getIdentityMapper(mapperDN); |
| | | IdentityMapper<?> mapper = DirectoryServer.getIdentityMapper(mapperDN); |
| | | assertNotNull(mapper); |
| | | assertTrue(mapper instanceof ExactMatchIdentityMapper); |
| | | } |
| | |
| | | "ds-cfg-enabled: true", |
| | | "ds-cfg-match-attribute: uid"); |
| | | |
| | | ExactMatchIdentityMapperCfg configuration = |
| | | AdminTestCaseUtils.getConfiguration( |
| | | ExactMatchIdentityMapperCfgDefn.getInstance(), |
| | | mapperEntry); |
| | | ExactMatchIdentityMapper mapper = new ExactMatchIdentityMapper(); |
| | | mapper.initializeIdentityMapper(configuration); |
| | | ExactMatchIdentityMapper mapper = initializeIdentityMapper(mapperEntry); |
| | | |
| | | |
| | | // Create a user entry and add it to the directory. |
| | |
| | | "ds-cfg-match-attribute: uid", |
| | | "ds-cfg-match-base-dn: o=test"); |
| | | |
| | | ExactMatchIdentityMapperCfg configuration = |
| | | AdminTestCaseUtils.getConfiguration( |
| | | ExactMatchIdentityMapperCfgDefn.getInstance(), |
| | | mapperEntry); |
| | | ExactMatchIdentityMapper mapper = new ExactMatchIdentityMapper(); |
| | | mapper.initializeIdentityMapper(configuration); |
| | | ExactMatchIdentityMapper mapper = initializeIdentityMapper(mapperEntry); |
| | | |
| | | |
| | | // Create a user entry and add it to the directory. |
| | |
| | | "ds-cfg-match-attribute: uid", |
| | | "ds-cfg-match-base-dn: o=notdefined"); |
| | | |
| | | ExactMatchIdentityMapperCfg configuration = |
| | | AdminTestCaseUtils.getConfiguration( |
| | | ExactMatchIdentityMapperCfgDefn.getInstance(), |
| | | mapperEntry); |
| | | ExactMatchIdentityMapper mapper = new ExactMatchIdentityMapper(); |
| | | mapper.initializeIdentityMapper(configuration); |
| | | ExactMatchIdentityMapper mapper = initializeIdentityMapper(mapperEntry); |
| | | |
| | | |
| | | // Create a user entry and add it to the directory. |
| | |
| | | "ds-cfg-match-attribute: uid", |
| | | "ds-cfg-match-base-dn: o=test"); |
| | | |
| | | ExactMatchIdentityMapperCfg configuration = |
| | | AdminTestCaseUtils.getConfiguration( |
| | | ExactMatchIdentityMapperCfgDefn.getInstance(), |
| | | mapperEntry); |
| | | ExactMatchIdentityMapper mapper = new ExactMatchIdentityMapper(); |
| | | mapper.initializeIdentityMapper(configuration); |
| | | ExactMatchIdentityMapper mapper = initializeIdentityMapper(mapperEntry); |
| | | |
| | | |
| | | // Create a user entry and add it to the directory. |
| | |
| | | "ds-cfg-match-attribute: cn", |
| | | "ds-cfg-match-base-dn: o=test"); |
| | | |
| | | ExactMatchIdentityMapperCfg configuration = |
| | | AdminTestCaseUtils.getConfiguration( |
| | | ExactMatchIdentityMapperCfgDefn.getInstance(), |
| | | mapperEntry); |
| | | ExactMatchIdentityMapper mapper = new ExactMatchIdentityMapper(); |
| | | mapper.initializeIdentityMapper(configuration); |
| | | ExactMatchIdentityMapper mapper = initializeIdentityMapper(mapperEntry); |
| | | |
| | | |
| | | // Create two user entries and add them to the directory. |
| | |
| | | "ds-cfg-match-attribute: uid", |
| | | "ds-cfg-match-attribute: cn"); |
| | | |
| | | ExactMatchIdentityMapperCfg configuration = |
| | | AdminTestCaseUtils.getConfiguration( |
| | | ExactMatchIdentityMapperCfgDefn.getInstance(), |
| | | mapperEntry); |
| | | ExactMatchIdentityMapper mapper = new ExactMatchIdentityMapper(); |
| | | mapper.initializeIdentityMapper(configuration); |
| | | ExactMatchIdentityMapper mapper = initializeIdentityMapper(mapperEntry); |
| | | |
| | | |
| | | // Create a user entry and add it to the directory. |
| | |
| | | "ds-cfg-match-attribute: uid", |
| | | "ds-cfg-match-attribute: cn"); |
| | | |
| | | ExactMatchIdentityMapperCfg configuration = |
| | | AdminTestCaseUtils.getConfiguration( |
| | | ExactMatchIdentityMapperCfgDefn.getInstance(), |
| | | mapperEntry); |
| | | ExactMatchIdentityMapper mapper = new ExactMatchIdentityMapper(); |
| | | mapper.initializeIdentityMapper(configuration); |
| | | ExactMatchIdentityMapper mapper = initializeIdentityMapper(mapperEntry); |
| | | |
| | | |
| | | // Create a user entry and add it to the directory. |
| | |
| | | "ds-cfg-match-attribute: uid", |
| | | "ds-cfg-match-attribute: cn"); |
| | | |
| | | ExactMatchIdentityMapperCfg configuration = |
| | | AdminTestCaseUtils.getConfiguration( |
| | | ExactMatchIdentityMapperCfgDefn.getInstance(), |
| | | mapperEntry); |
| | | ExactMatchIdentityMapper mapper = new ExactMatchIdentityMapper(); |
| | | mapper.initializeIdentityMapper(configuration); |
| | | ExactMatchIdentityMapper mapper = initializeIdentityMapper(mapperEntry); |
| | | |
| | | |
| | | // Create a user entry and add it to the directory. |
| | |
| | | mapper.finalizeIdentityMapper(); |
| | | } |
| | | |
| | | |
| | | private ExactMatchIdentityMapper initializeIdentityMapper(Entry mapperEntry) |
| | | throws ConfigException, InitializationException { |
| | | return InitializationUtils.initializeIdentityMapper( |
| | | new ExactMatchIdentityMapper(), mapperEntry, ExactMatchIdentityMapperCfgDefn.getInstance()); |
| | | } |
| | | |
| | | /** |
| | | * Tests that an internal modification to change the map attribute will take |
| | |
| | | throws Exception |
| | | { |
| | | DN mapperDN = DN.valueOf(MAPPER_DN); |
| | | IdentityMapper mapper = DirectoryServer.getIdentityMapper(mapperDN); |
| | | IdentityMapper<?> mapper = DirectoryServer.getIdentityMapper(mapperDN); |
| | | assertNotNull(mapper); |
| | | assertTrue(mapper instanceof ExactMatchIdentityMapper); |
| | | |
| | |
| | | throws Exception |
| | | { |
| | | DN mapperDN = DN.valueOf(MAPPER_DN); |
| | | IdentityMapper mapper = DirectoryServer.getIdentityMapper(mapperDN); |
| | | IdentityMapper<?> mapper = DirectoryServer.getIdentityMapper(mapperDN); |
| | | assertNotNull(mapper); |
| | | assertTrue(mapper instanceof ExactMatchIdentityMapper); |
| | | |
| | |
| | | import org.forgerock.opendj.ldap.ModificationType; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.opends.server.TestCaseUtils; |
| | | import org.forgerock.opendj.config.server.AdminTestCaseUtils; |
| | | import org.forgerock.opendj.server.config.meta.ExternalSASLMechanismHandlerCfgDefn; |
| | | import org.forgerock.opendj.server.config.server.ExternalSASLMechanismHandlerCfg; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.core.ModifyOperation; |
| | | import org.opends.server.protocols.internal.InternalClientConnection; |
| | |
| | | public void testInvalidConfigs(Entry e) |
| | | throws Exception |
| | | { |
| | | ExternalSASLMechanismHandlerCfg configuration = |
| | | AdminTestCaseUtils.getConfiguration( |
| | | ExternalSASLMechanismHandlerCfgDefn.getInstance(), |
| | | e); |
| | | |
| | | ExternalSASLMechanismHandler handler = new ExternalSASLMechanismHandler(); |
| | | handler.initializeSASLMechanismHandler(configuration); |
| | | InitializationUtils.initializeSASLMechanismHandler( |
| | | new ExternalSASLMechanismHandler(), e, ExternalSASLMechanismHandlerCfgDefn.getInstance()); |
| | | } |
| | | |
| | | |
| | |
| | | */ |
| | | package org.opends.server.extensions; |
| | | |
| | | |
| | | |
| | | import java.util.ArrayList; |
| | | |
| | | import org.opends.server.TestCaseUtils; |
| | | import org.forgerock.opendj.config.server.AdminTestCaseUtils; |
| | | import org.testng.annotations.BeforeClass; |
| | | import org.forgerock.opendj.server.config.meta.*; |
| | | import org.forgerock.opendj.server.config.server.FIFOEntryCacheCfg; |
| | |
| | | |
| | | import static org.testng.Assert.*; |
| | | |
| | | |
| | | |
| | | /** |
| | | * A set of test cases for FIFO entry cache implementation. |
| | | */ |
| | |
| | | "ds-cfg-java-class: org.opends.server.extensions.FIFOEntryCache", |
| | | "ds-cfg-enabled: true", |
| | | "ds-cfg-max-entries: " + super.MAXENTRIES); |
| | | super.configuration = AdminTestCaseUtils.getConfiguration( |
| | | super.configuration = InitializationUtils.getConfiguration( |
| | | FIFOEntryCacheCfgDefn.getInstance(), cacheConfigEntry); |
| | | |
| | | // Force GC to make sure we have enough memory for |
| | |
| | | import org.testng.annotations.Test; |
| | | |
| | | import org.opends.server.TestCaseUtils; |
| | | import org.forgerock.opendj.config.server.AdminTestCaseUtils; |
| | | import org.forgerock.opendj.server.config.meta.FileBasedKeyManagerProviderCfgDefn; |
| | | import org.forgerock.opendj.server.config.server.FileBasedKeyManagerProviderCfg; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.types.Entry; |
| | |
| | | public void testVvalidConfigs(Entry e) |
| | | throws Exception |
| | | { |
| | | FileBasedKeyManagerProviderCfg configuration = |
| | | AdminTestCaseUtils.getConfiguration( |
| | | FileBasedKeyManagerProviderCfgDefn.getInstance(), e); |
| | | |
| | | FileBasedKeyManagerProvider provider = new FileBasedKeyManagerProvider(); |
| | | provider.initializeKeyManagerProvider(configuration); |
| | | FileBasedKeyManagerProvider provider = initializeKeyManagerProvider(e); |
| | | provider.finalizeKeyManagerProvider(); |
| | | } |
| | | |
| | |
| | | public void testInvalidConfigs(Entry e) |
| | | throws Exception |
| | | { |
| | | FileBasedKeyManagerProviderCfg configuration = |
| | | AdminTestCaseUtils.getConfiguration( |
| | | FileBasedKeyManagerProviderCfgDefn.getInstance(), e); |
| | | initializeKeyManagerProvider(e); |
| | | } |
| | | |
| | | |
| | | FileBasedKeyManagerProvider provider = new FileBasedKeyManagerProvider(); |
| | | provider.initializeKeyManagerProvider(configuration); |
| | | private FileBasedKeyManagerProvider initializeKeyManagerProvider(Entry e) throws ConfigException, InitializationException { |
| | | return InitializationUtils.initializeKeyManagerProvider( |
| | | new FileBasedKeyManagerProvider(), e, FileBasedKeyManagerProviderCfgDefn.getInstance()); |
| | | } |
| | | } |
| | | |
| | |
| | | */ |
| | | package org.opends.server.extensions; |
| | | |
| | | |
| | | |
| | | import java.io.File; |
| | | import java.io.FileWriter; |
| | | import java.util.List; |
| | |
| | | import org.testng.annotations.Test; |
| | | |
| | | import org.opends.server.TestCaseUtils; |
| | | import org.forgerock.opendj.config.server.AdminTestCaseUtils; |
| | | import org.forgerock.opendj.server.config.meta.FileBasedTrustManagerProviderCfgDefn; |
| | | import org.forgerock.opendj.server.config.server.FileBasedTrustManagerProviderCfg; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.types.Entry; |
| | |
| | | |
| | | import static org.opends.server.util.ServerConstants.*; |
| | | |
| | | |
| | | |
| | | /** |
| | | * A set of test cases for the file-based trust manager provider. |
| | | */ |
| | |
| | | public void testVvalidConfigs(Entry e) |
| | | throws Exception |
| | | { |
| | | FileBasedTrustManagerProviderCfg configuration = |
| | | AdminTestCaseUtils.getConfiguration( |
| | | FileBasedTrustManagerProviderCfgDefn.getInstance(), e); |
| | | |
| | | FileBasedTrustManagerProvider provider = new FileBasedTrustManagerProvider(); |
| | | provider.initializeTrustManagerProvider(configuration); |
| | | provider.finalizeTrustManagerProvider(); |
| | | FileBasedTrustManagerProvider provider = initializeTrustManagerProvider(e); |
| | | provider.finalizeTrustManagerProvider(); |
| | | } |
| | | |
| | | |
| | |
| | | public void testInvalidConfigs(Entry e) |
| | | throws Exception |
| | | { |
| | | FileBasedTrustManagerProviderCfg configuration = |
| | | AdminTestCaseUtils.getConfiguration( |
| | | FileBasedTrustManagerProviderCfgDefn.getInstance(), e); |
| | | |
| | | FileBasedTrustManagerProvider provider = |
| | | new FileBasedTrustManagerProvider(); |
| | | provider.initializeTrustManagerProvider(configuration); |
| | | initializeTrustManagerProvider(e); |
| | | for (StringBuilder sb : e.toLDIF()) |
| | | { |
| | | System.err.println(sb.toString()); |
| | | } |
| | | } |
| | | } |
| | | |
| | | private FileBasedTrustManagerProvider initializeTrustManagerProvider(Entry e) throws ConfigException, InitializationException { |
| | | return InitializationUtils.initializeTrustManagerProvider( |
| | | new FileBasedTrustManagerProvider(), e, FileBasedTrustManagerProviderCfgDefn.getInstance()); |
| | | } |
| | | } |
| | |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.forgerock.opendj.ldap.requests.ModifyRequest; |
| | | import org.opends.server.TestCaseUtils; |
| | | import org.forgerock.opendj.config.server.AdminTestCaseUtils; |
| | | import org.forgerock.opendj.server.config.meta.FingerprintCertificateMapperCfgDefn; |
| | | import org.forgerock.opendj.server.config.server.FingerprintCertificateMapperCfg; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.core.ModifyOperation; |
| | | import org.opends.server.tools.LDAPSearch; |
| | |
| | | public void testInvalidConfigs(Entry e) |
| | | throws Exception |
| | | { |
| | | FingerprintCertificateMapperCfg configuration = |
| | | AdminTestCaseUtils.getConfiguration( |
| | | FingerprintCertificateMapperCfgDefn.getInstance(), |
| | | e); |
| | | |
| | | FingerprintCertificateMapper mapper = new FingerprintCertificateMapper(); |
| | | mapper.initializeCertificateMapper(configuration); |
| | | InitializationUtils.initializeCertificateMapper( |
| | | new FingerprintCertificateMapper(), e, FingerprintCertificateMapperCfgDefn.getInstance()); |
| | | } |
| | | |
| | | |
| New file |
| | |
| | | /* |
| | | * The contents of this file are subject to the terms of the Common Development and |
| | | * Distribution License (the License). You may not use this file except in compliance with the |
| | | * License. |
| | | * |
| | | * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the |
| | | * specific language governing permission and limitations under the License. |
| | | * |
| | | * When distributing Covered Software, include this CDDL Header Notice in each file and include |
| | | * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL |
| | | * Header, with the fields enclosed by brackets [] replaced by your own identifying |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2016 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.extensions; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.opendj.adapter.server3x.Converters; |
| | | import org.forgerock.opendj.config.Configuration; |
| | | import org.forgerock.opendj.config.ManagedObjectDefinition; |
| | | import org.forgerock.opendj.config.server.AdminTestCaseUtils; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.forgerock.opendj.config.server.ServerManagementContext; |
| | | import org.forgerock.opendj.server.config.server.AccountStatusNotificationHandlerCfg; |
| | | import org.forgerock.opendj.server.config.server.CertificateMapperCfg; |
| | | import org.forgerock.opendj.server.config.server.ExtendedOperationHandlerCfg; |
| | | import org.forgerock.opendj.server.config.server.IdentityMapperCfg; |
| | | import org.forgerock.opendj.server.config.server.KeyManagerProviderCfg; |
| | | import org.forgerock.opendj.server.config.server.PasswordGeneratorCfg; |
| | | import org.forgerock.opendj.server.config.server.PasswordStorageSchemeCfg; |
| | | import org.forgerock.opendj.server.config.server.PasswordValidatorCfg; |
| | | import org.forgerock.opendj.server.config.server.PluginCfg; |
| | | import org.forgerock.opendj.server.config.server.SASLMechanismHandlerCfg; |
| | | import org.forgerock.opendj.server.config.server.TrustManagerProviderCfg; |
| | | import org.opends.server.TestCaseUtils; |
| | | import org.opends.server.api.AccountStatusNotificationHandler; |
| | | import org.opends.server.api.CertificateMapper; |
| | | import org.opends.server.api.ExtendedOperationHandler; |
| | | import org.opends.server.api.IdentityMapper; |
| | | import org.opends.server.api.KeyManagerProvider; |
| | | import org.opends.server.api.PasswordGenerator; |
| | | import org.opends.server.api.PasswordStorageScheme; |
| | | import org.opends.server.api.PasswordValidator; |
| | | import org.opends.server.api.SASLMechanismHandler; |
| | | import org.opends.server.api.TrustManagerProvider; |
| | | import org.opends.server.api.plugin.DirectoryServerPlugin; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.types.Entry; |
| | | import org.opends.server.types.InitializationException; |
| | | |
| | | public final class InitializationUtils { |
| | | |
| | | private InitializationUtils() { |
| | | // private to prevent instantiation of util class |
| | | } |
| | | |
| | | public static <M extends CertificateMapper<C>, C extends CertificateMapperCfg> M initializeCertificateMapper( |
| | | M mapper, Entry e, ManagedObjectDefinition<?, C> cfgDefn) throws ConfigException, InitializationException { |
| | | mapper.initializeCertificateMapper(getConfiguration(cfgDefn, e)); |
| | | return mapper; |
| | | } |
| | | |
| | | public static <H extends ExtendedOperationHandler<C>, C extends ExtendedOperationHandlerCfg> H initializeExtendedOperationHandler( |
| | | H handler, Entry e, ManagedObjectDefinition<?, C> cfgDefn) throws ConfigException, InitializationException { |
| | | handler.initializeExtendedOperationHandler(getConfiguration(cfgDefn, e)); |
| | | return handler; |
| | | } |
| | | |
| | | public static <P extends KeyManagerProvider<C>, C extends KeyManagerProviderCfg> P initializeKeyManagerProvider( |
| | | P provider, Entry e, ManagedObjectDefinition<?, C> cfgDefn) throws ConfigException, InitializationException { |
| | | provider.initializeKeyManagerProvider(getConfiguration(cfgDefn, e)); |
| | | return provider; |
| | | } |
| | | |
| | | public static <M extends IdentityMapper<C>, C extends IdentityMapperCfg> M initializeIdentityMapper( |
| | | M mapper, Entry e, ManagedObjectDefinition<?, C> cfgDefn) throws ConfigException, InitializationException { |
| | | mapper.initializeIdentityMapper(getConfiguration(cfgDefn, e)); |
| | | return mapper; |
| | | } |
| | | |
| | | public static <G extends AccountStatusNotificationHandler<C>, C extends AccountStatusNotificationHandlerCfg> |
| | | G initializeStatusNotificationHandler(G generator, Entry e, ManagedObjectDefinition<?, C> cfgDefn) |
| | | throws ConfigException, InitializationException { |
| | | generator.initializeStatusNotificationHandler(getConfiguration(cfgDefn, e)); |
| | | return generator; |
| | | } |
| | | |
| | | public static <G extends PasswordGenerator<C>, C extends PasswordGeneratorCfg> G initializePasswordGenerator( |
| | | G generator, Entry e, ManagedObjectDefinition<?, C> cfgDefn) throws ConfigException, InitializationException { |
| | | generator.initializePasswordGenerator(getConfiguration(cfgDefn, e)); |
| | | return generator; |
| | | } |
| | | |
| | | public static <S extends PasswordStorageScheme<C>, C extends PasswordStorageSchemeCfg> |
| | | S initializePasswordStorageScheme(S scheme, Entry cfgEntry, ManagedObjectDefinition<?, C> cfgDefn) |
| | | throws ConfigException, InitializationException { |
| | | scheme.initializePasswordStorageScheme(getConfiguration(cfgDefn, cfgEntry)); |
| | | return scheme; |
| | | } |
| | | |
| | | public static <V extends PasswordValidator<C>, C extends PasswordValidatorCfg> V initializePasswordValidator( |
| | | V validator, Entry cfgEntry, ManagedObjectDefinition<?, C> cfgDefn) |
| | | throws ConfigException, InitializationException { |
| | | validator.initializePasswordValidator(getConfiguration(cfgDefn, cfgEntry)); |
| | | return validator; |
| | | } |
| | | |
| | | public static <P extends DirectoryServerPlugin<C>, C extends PluginCfg> P initializePlugin( |
| | | P plugin, Entry e, ManagedObjectDefinition<?, C> cfgDefn) throws ConfigException, InitializationException { |
| | | plugin.initializePlugin(TestCaseUtils.getPluginTypes(e), getConfiguration(cfgDefn, e)); |
| | | return plugin; |
| | | } |
| | | |
| | | public static <H extends SASLMechanismHandler<C>,C extends SASLMechanismHandlerCfg> H initializeSASLMechanismHandler( |
| | | H handler, Entry e, ManagedObjectDefinition<?, C> cfgDefn) throws ConfigException, InitializationException { |
| | | handler.initializeSASLMechanismHandler(getConfiguration(cfgDefn, e)); |
| | | return handler; |
| | | } |
| | | |
| | | public static <P extends TrustManagerProvider<C>,C extends TrustManagerProviderCfg> P initializeTrustManagerProvider( |
| | | P provider, Entry e, ManagedObjectDefinition<?, C> cfgDefn) throws ConfigException, InitializationException { |
| | | provider.initializeTrustManagerProvider(getConfiguration(cfgDefn, e)); |
| | | return provider; |
| | | } |
| | | |
| | | public static <C extends Configuration> C getConfiguration(ManagedObjectDefinition<?, C> cfgDefn, Entry cfgEntry) |
| | | throws ConfigException { |
| | | ServerManagementContext context = DirectoryServer.getInstance().getServerContext().getServerManagementContext(); |
| | | try { |
| | | return AdminTestCaseUtils.getConfiguration(context, cfgDefn, Converters.from(cfgEntry)); |
| | | } catch (IllegalArgumentException e) { |
| | | throw new ConfigException(LocalizableMessage.raw(""), e); |
| | | } |
| | | } |
| | | } |
| | |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.opends.server.TestCaseUtils; |
| | | import org.forgerock.opendj.config.server.AdminTestCaseUtils; |
| | | import org.forgerock.opendj.server.config.meta.LengthBasedPasswordValidatorCfgDefn; |
| | | import org.forgerock.opendj.server.config.server.LengthBasedPasswordValidatorCfg; |
| | | import org.opends.server.core.ModifyOperationBasis; |
| | | import org.opends.server.types.Attributes; |
| | | import org.opends.server.types.Control; |
| | |
| | | public void testInitializeWithValidConfigs(Entry e) |
| | | throws Exception |
| | | { |
| | | LengthBasedPasswordValidatorCfg configuration = |
| | | AdminTestCaseUtils.getConfiguration( |
| | | LengthBasedPasswordValidatorCfgDefn.getInstance(), |
| | | e); |
| | | |
| | | LengthBasedPasswordValidator validator = new LengthBasedPasswordValidator(); |
| | | validator.initializePasswordValidator(configuration); |
| | | initializePasswordValidator(e); |
| | | } |
| | | |
| | | |
| | |
| | | public void testInitializeWithInvalidConfigs(Entry e) |
| | | throws Exception |
| | | { |
| | | LengthBasedPasswordValidatorCfg configuration = |
| | | AdminTestCaseUtils.getConfiguration( |
| | | LengthBasedPasswordValidatorCfgDefn.getInstance(), |
| | | e); |
| | | |
| | | LengthBasedPasswordValidator validator = new LengthBasedPasswordValidator(); |
| | | validator.initializePasswordValidator(configuration); |
| | | initializePasswordValidator(e); |
| | | } |
| | | |
| | | |
| | |
| | | "ds-cfg-min-password-length: 0", |
| | | "ds-cfg-max-password-length: 0"); |
| | | |
| | | LengthBasedPasswordValidatorCfg configuration = |
| | | AdminTestCaseUtils.getConfiguration( |
| | | LengthBasedPasswordValidatorCfgDefn.getInstance(), |
| | | validatorEntry); |
| | | |
| | | LengthBasedPasswordValidator validator = new LengthBasedPasswordValidator(); |
| | | validator.initializePasswordValidator(configuration); |
| | | LengthBasedPasswordValidator validator = initializePasswordValidator(validatorEntry); |
| | | |
| | | StringBuilder buffer = new StringBuilder(); |
| | | for (int i=0; i < 20; i++) |
| | |
| | | validator.finalizePasswordValidator(); |
| | | } |
| | | |
| | | private LengthBasedPasswordValidator initializePasswordValidator(Entry validatorEntry) throws ConfigException, InitializationException { |
| | | return InitializationUtils.initializePasswordValidator( |
| | | new LengthBasedPasswordValidator(), validatorEntry, LengthBasedPasswordValidatorCfgDefn.getInstance()); |
| | | } |
| | | |
| | | private ModifyOperationBasis newModifyOperation(StringBuilder buffer) throws DirectoryException |
| | | { |
| | | ArrayList<Modification> mods = newArrayList( |
| | |
| | | "ds-cfg-min-password-length: 10", |
| | | "ds-cfg-max-password-length: 0"); |
| | | |
| | | LengthBasedPasswordValidatorCfg configuration = |
| | | AdminTestCaseUtils.getConfiguration( |
| | | LengthBasedPasswordValidatorCfgDefn.getInstance(), |
| | | validatorEntry); |
| | | |
| | | LengthBasedPasswordValidator validator = new LengthBasedPasswordValidator(); |
| | | validator.initializePasswordValidator(configuration); |
| | | LengthBasedPasswordValidator validator = initializePasswordValidator(validatorEntry); |
| | | |
| | | StringBuilder buffer = new StringBuilder(); |
| | | for (int i=0; i < 20; i++) |
| | |
| | | "ds-cfg-min-password-length: 0", |
| | | "ds-cfg-max-password-length: 10"); |
| | | |
| | | LengthBasedPasswordValidatorCfg configuration = |
| | | AdminTestCaseUtils.getConfiguration( |
| | | LengthBasedPasswordValidatorCfgDefn.getInstance(), |
| | | validatorEntry); |
| | | |
| | | LengthBasedPasswordValidator validator = new LengthBasedPasswordValidator(); |
| | | validator.initializePasswordValidator(configuration); |
| | | LengthBasedPasswordValidator validator = initializePasswordValidator(validatorEntry); |
| | | |
| | | StringBuilder buffer = new StringBuilder(); |
| | | for (int i=0; i < 20; i++) |
| | |
| | | "ds-cfg-min-password-length: 6", |
| | | "ds-cfg-max-password-length: 10"); |
| | | |
| | | LengthBasedPasswordValidatorCfg configuration = |
| | | AdminTestCaseUtils.getConfiguration( |
| | | LengthBasedPasswordValidatorCfgDefn.getInstance(), |
| | | validatorEntry); |
| | | |
| | | LengthBasedPasswordValidator validator = new LengthBasedPasswordValidator(); |
| | | validator.initializePasswordValidator(configuration); |
| | | LengthBasedPasswordValidator validator = initializePasswordValidator(validatorEntry); |
| | | |
| | | StringBuilder buffer = new StringBuilder(); |
| | | for (int i=0; i < 20; i++) |
| | |
| | | */ |
| | | package org.opends.server.extensions; |
| | | |
| | | |
| | | |
| | | import org.forgerock.opendj.config.server.AdminTestCaseUtils; |
| | | import org.forgerock.opendj.server.config.meta.MD5PasswordStorageSchemeCfgDefn; |
| | | import org.forgerock.opendj.server.config.server.MD5PasswordStorageSchemeCfg; |
| | | import org.opends.server.api.PasswordStorageScheme; |
| | | |
| | | |
| | | |
| | | /** |
| | | * A set of test cases for the MD5 password storage scheme. |
| | | */ |
| | | /** A set of test cases for the MD5 password storage scheme. */ |
| | | public class MD5PasswordStorageSchemeTestCase |
| | | extends PasswordStorageSchemeTestCase |
| | | { |
| | | /** |
| | | * Creates a new instance of this storage scheme test case. |
| | | */ |
| | | /** Creates a new instance of this storage scheme test case. */ |
| | | public MD5PasswordStorageSchemeTestCase() |
| | | { |
| | | super("cn=MD5,cn=Password Storage Schemes,cn=config"); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Retrieves an initialized instance of this password storage scheme. |
| | | * |
| | | * @return An initialized instance of this password storage scheme. |
| | | * |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | protected PasswordStorageScheme getScheme() |
| | | throws Exception |
| | | protected PasswordStorageScheme<?> getScheme() throws Exception |
| | | { |
| | | MD5PasswordStorageScheme scheme = new MD5PasswordStorageScheme(); |
| | | |
| | | MD5PasswordStorageSchemeCfg configuration = |
| | | AdminTestCaseUtils.getConfiguration( |
| | | MD5PasswordStorageSchemeCfgDefn.getInstance(), |
| | | configEntry |
| | | ); |
| | | |
| | | scheme.initializePasswordStorageScheme(configuration); |
| | | return scheme; |
| | | return InitializationUtils.initializePasswordStorageScheme( |
| | | new MD5PasswordStorageScheme(), configEntry, MD5PasswordStorageSchemeCfgDefn.getInstance()); |
| | | } |
| | | } |
| | | |
| | |
| | | */ |
| | | package org.opends.server.extensions; |
| | | |
| | | import org.forgerock.opendj.config.server.AdminTestCaseUtils; |
| | | import org.forgerock.opendj.server.config.meta.PBKDF2PasswordStorageSchemeCfgDefn; |
| | | import org.forgerock.opendj.server.config.server.PBKDF2PasswordStorageSchemeCfg; |
| | | import org.opends.server.api.PasswordStorageScheme; |
| | | import org.opends.server.types.DirectoryException; |
| | | import org.testng.annotations.DataProvider; |
| | |
| | | @Override |
| | | protected PasswordStorageScheme<?> getScheme() throws Exception |
| | | { |
| | | PBKDF2PasswordStorageScheme scheme = |
| | | new PBKDF2PasswordStorageScheme(); |
| | | |
| | | PBKDF2PasswordStorageSchemeCfg configuration = |
| | | AdminTestCaseUtils.getConfiguration( |
| | | PBKDF2PasswordStorageSchemeCfgDefn.getInstance(), |
| | | configEntry |
| | | ); |
| | | |
| | | scheme.initializePasswordStorageScheme(configuration); |
| | | return scheme; |
| | | return InitializationUtils.initializePasswordStorageScheme( |
| | | new PBKDF2PasswordStorageScheme(), configEntry, PBKDF2PasswordStorageSchemeCfgDefn.getInstance()); |
| | | } |
| | | |
| | | @Override |
| | |
| | | */ |
| | | package org.opends.server.extensions; |
| | | |
| | | import org.forgerock.opendj.config.server.AdminTestCaseUtils; |
| | | import org.forgerock.opendj.server.config.meta.PKCS5S2PasswordStorageSchemeCfgDefn; |
| | | import org.forgerock.opendj.server.config.server.PKCS5S2PasswordStorageSchemeCfg; |
| | | import org.opends.server.api.PasswordStorageScheme; |
| | | import org.opends.server.types.DirectoryException; |
| | | import org.testng.annotations.DataProvider; |
| | |
| | | @Override |
| | | protected PasswordStorageScheme<?> getScheme() throws Exception |
| | | { |
| | | PKCS5S2PasswordStorageScheme scheme = |
| | | new PKCS5S2PasswordStorageScheme(); |
| | | |
| | | PKCS5S2PasswordStorageSchemeCfg configuration = |
| | | AdminTestCaseUtils.getConfiguration( |
| | | PKCS5S2PasswordStorageSchemeCfgDefn.getInstance(), |
| | | configEntry |
| | | ); |
| | | |
| | | scheme.initializePasswordStorageScheme(configuration); |
| | | return scheme; |
| | | return InitializationUtils.initializePasswordStorageScheme( |
| | | new PKCS5S2PasswordStorageScheme(), configEntry, PKCS5S2PasswordStorageSchemeCfgDefn.getInstance()); |
| | | } |
| | | |
| | | /** |
| | |
| | | import org.forgerock.opendj.ldap.requests.Requests; |
| | | import org.forgerock.opendj.ldap.schema.AttributeType; |
| | | import org.opends.server.TestCaseUtils; |
| | | import org.forgerock.opendj.config.server.AdminTestCaseUtils; |
| | | import org.forgerock.opendj.server.config.meta.PasswordModifyExtendedOperationHandlerCfgDefn; |
| | | import org.forgerock.opendj.server.config.server.PasswordModifyExtendedOperationHandlerCfg; |
| | | import org.opends.server.core.BindOperation; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.core.ExtendedOperation; |
| | |
| | | public void testInitializeWithInvalidConfigs(Entry e) |
| | | throws Exception |
| | | { |
| | | PasswordModifyExtendedOperationHandlerCfg configuration = |
| | | AdminTestCaseUtils.getConfiguration(PasswordModifyExtendedOperationHandlerCfgDefn.getInstance(), e); |
| | | |
| | | PasswordModifyExtendedOperation handler = new PasswordModifyExtendedOperation(); |
| | | handler.initializeExtendedOperationHandler(configuration); |
| | | InitializationUtils.initializeExtendedOperationHandler( |
| | | new PasswordModifyExtendedOperation(), e, PasswordModifyExtendedOperationHandlerCfgDefn.getInstance()); |
| | | } |
| | | |
| | | |
| | |
| | | */ |
| | | package org.opends.server.extensions; |
| | | |
| | | |
| | | |
| | | import org.forgerock.opendj.config.server.AdminTestCaseUtils; |
| | | import org.forgerock.opendj.server.config.meta.RC4PasswordStorageSchemeCfgDefn; |
| | | import org.forgerock.opendj.server.config.server.RC4PasswordStorageSchemeCfg; |
| | | import org.opends.server.api.PasswordStorageScheme; |
| | | |
| | | |
| | | |
| | | /** |
| | | * A set of test cases for the RC4 password storage scheme. |
| | | */ |
| | | /** A set of test cases for the RC4 password storage scheme. */ |
| | | public class RC4PasswordStorageSchemeTestCase |
| | | extends PasswordStorageSchemeTestCase |
| | | { |
| | | /** |
| | | * Creates a new instance of this storage scheme test case. |
| | | */ |
| | | /** Creates a new instance of this storage scheme test case. */ |
| | | public RC4PasswordStorageSchemeTestCase() |
| | | { |
| | | super("cn=RC4,cn=Password Storage Schemes,cn=config"); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Retrieves an initialized instance of this password storage scheme. |
| | | * |
| | | * @return An initialized instance of this password storage scheme. |
| | | * |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | protected PasswordStorageScheme getScheme() |
| | | throws Exception |
| | | protected PasswordStorageScheme<?> getScheme() throws Exception |
| | | { |
| | | RC4PasswordStorageScheme scheme = new RC4PasswordStorageScheme(); |
| | | |
| | | RC4PasswordStorageSchemeCfg configuration = |
| | | AdminTestCaseUtils.getConfiguration( |
| | | RC4PasswordStorageSchemeCfgDefn.getInstance(), |
| | | configEntry); |
| | | |
| | | scheme.initializePasswordStorageScheme(configuration); |
| | | return scheme; |
| | | return InitializationUtils.initializePasswordStorageScheme( |
| | | new RC4PasswordStorageScheme(), configEntry, RC4PasswordStorageSchemeCfgDefn.getInstance()); |
| | | } |
| | | } |
| | | |
| | |
| | | */ |
| | | package org.opends.server.extensions; |
| | | |
| | | |
| | | |
| | | import java.util.List; |
| | | |
| | | import org.testng.annotations.BeforeClass; |
| | |
| | | import org.testng.annotations.Test; |
| | | |
| | | import org.opends.server.TestCaseUtils; |
| | | import org.forgerock.opendj.config.server.AdminTestCaseUtils; |
| | | import org.forgerock.opendj.server.config.meta.RandomPasswordGeneratorCfgDefn; |
| | | import org.forgerock.opendj.server.config.server.RandomPasswordGeneratorCfg; |
| | | import org.opends.server.types.Entry; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.opends.server.types.Entry; |
| | | import org.opends.server.types.InitializationException; |
| | | |
| | | import static org.testng.Assert.*; |
| | | |
| | | |
| | | |
| | | /** |
| | | * A set of test cases for the random password generator. |
| | | */ |
| | |
| | | Entry configEntry = DirectoryServer.getConfigEntry(dn); |
| | | assertNotNull(configEntry); |
| | | |
| | | RandomPasswordGeneratorCfg configuration = |
| | | AdminTestCaseUtils.getConfiguration( |
| | | RandomPasswordGeneratorCfgDefn.getInstance(), |
| | | configEntry); |
| | | |
| | | RandomPasswordGenerator generator = new RandomPasswordGenerator(); |
| | | generator.initializePasswordGenerator(configuration); |
| | | RandomPasswordGenerator generator = InitializationUtils.initializePasswordGenerator( |
| | | new RandomPasswordGenerator(), configEntry, RandomPasswordGeneratorCfgDefn.getInstance()); |
| | | assertNotNull(generator.generatePassword(null)); |
| | | generator.finalizePasswordGenerator(); |
| | | } |
| | |
| | | public void testInvalidConfigurations(Entry entry) |
| | | throws Exception |
| | | { |
| | | RandomPasswordGeneratorCfg configuration = |
| | | AdminTestCaseUtils.getConfiguration( |
| | | RandomPasswordGeneratorCfgDefn.getInstance(), |
| | | entry); |
| | | |
| | | RandomPasswordGenerator generator = new RandomPasswordGenerator(); |
| | | generator.initializePasswordGenerator(configuration); |
| | | InitializationUtils.initializePasswordGenerator( |
| | | new RandomPasswordGenerator(), entry, RandomPasswordGeneratorCfgDefn.getInstance()); |
| | | } |
| | | } |
| | | |
| | |
| | | */ |
| | | package org.opends.server.extensions; |
| | | |
| | | |
| | | |
| | | import java.util.LinkedList; |
| | | |
| | | import org.testng.annotations.BeforeClass; |
| | |
| | | |
| | | import org.opends.server.TestCaseUtils; |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.opendj.config.server.AdminTestCaseUtils; |
| | | import org.forgerock.opendj.server.config.meta. |
| | | RegularExpressionIdentityMapperCfgDefn; |
| | | import org.forgerock.opendj.server.config.server.RegularExpressionIdentityMapperCfg; |
| | |
| | | |
| | | import static org.testng.Assert.*; |
| | | |
| | | |
| | | |
| | | /** |
| | | * A set of test cases for the regular expression identity mapper. |
| | | */ |
| | |
| | | "ds-cfg-match-pattern: :-(", |
| | | "ds-cfg-replace-pattern: $1"); |
| | | |
| | | RegularExpressionIdentityMapperCfg configuration = |
| | | AdminTestCaseUtils.getConfiguration( |
| | | RegularExpressionIdentityMapperCfgDefn.getInstance(), |
| | | mapperEntry); |
| | | RegularExpressionIdentityMapperCfg configuration = getConfiguration(mapperEntry); |
| | | RegularExpressionIdentityMapper mapper = |
| | | new RegularExpressionIdentityMapper(); |
| | | assertFalse(mapper.isConfigurationAcceptable(configuration, |
| | |
| | | "ds-cfg-match-pattern: ^([^@]+)@.+$", |
| | | "ds-cfg-replace-pattern: $1"); |
| | | |
| | | RegularExpressionIdentityMapperCfg configuration = |
| | | AdminTestCaseUtils.getConfiguration( |
| | | RegularExpressionIdentityMapperCfgDefn.getInstance(), |
| | | mapperEntry); |
| | | RegularExpressionIdentityMapperCfg configuration = getConfiguration(mapperEntry); |
| | | RegularExpressionIdentityMapper mapper = |
| | | new RegularExpressionIdentityMapper(); |
| | | assertFalse(mapper.isConfigurationAcceptable(configuration, |
| | |
| | | mapper.initializeIdentityMapper(configuration); |
| | | } |
| | | |
| | | private RegularExpressionIdentityMapper initializeIdentityMapper(Entry mapperEntry) |
| | | throws ConfigException, InitializationException { |
| | | RegularExpressionIdentityMapperCfg configuration = getConfiguration(mapperEntry); |
| | | RegularExpressionIdentityMapper mapper = new RegularExpressionIdentityMapper(); |
| | | assertTrue(mapper.isConfigurationAcceptable(configuration, new LinkedList<LocalizableMessage>())); |
| | | mapper.initializeIdentityMapper(configuration); |
| | | return mapper; |
| | | } |
| | | |
| | | private RegularExpressionIdentityMapperCfg getConfiguration(Entry mapperEntry) throws ConfigException { |
| | | return InitializationUtils.getConfiguration(RegularExpressionIdentityMapperCfgDefn.getInstance(), mapperEntry); |
| | | } |
| | | |
| | | /** |
| | | * Tests the {@code getEntryForID} method with a simple match with only one |
| | |
| | | "ds-cfg-match-pattern: ^([^@]+)@.+$", |
| | | "ds-cfg-replace-pattern: $1"); |
| | | |
| | | RegularExpressionIdentityMapperCfg configuration = |
| | | AdminTestCaseUtils.getConfiguration( |
| | | RegularExpressionIdentityMapperCfgDefn.getInstance(), |
| | | mapperEntry); |
| | | RegularExpressionIdentityMapper mapper = |
| | | new RegularExpressionIdentityMapper(); |
| | | assertTrue(mapper.isConfigurationAcceptable(configuration, |
| | | new LinkedList<LocalizableMessage>())); |
| | | mapper.initializeIdentityMapper(configuration); |
| | | RegularExpressionIdentityMapper mapper = initializeIdentityMapper(mapperEntry); |
| | | |
| | | |
| | | |
| | |
| | | "ds-cfg-match-pattern: ^([^@]+)@.+$", |
| | | "ds-cfg-replace-pattern: $1"); |
| | | |
| | | RegularExpressionIdentityMapperCfg configuration = |
| | | AdminTestCaseUtils.getConfiguration( |
| | | RegularExpressionIdentityMapperCfgDefn.getInstance(), |
| | | mapperEntry); |
| | | RegularExpressionIdentityMapper mapper = |
| | | new RegularExpressionIdentityMapper(); |
| | | assertTrue(mapper.isConfigurationAcceptable(configuration, |
| | | new LinkedList<LocalizableMessage>())); |
| | | mapper.initializeIdentityMapper(configuration); |
| | | RegularExpressionIdentityMapper mapper = initializeIdentityMapper(mapperEntry); |
| | | |
| | | |
| | | |
| | |
| | | "ds-cfg-match-pattern: ^([^@]+)@.+$", |
| | | "ds-cfg-replace-pattern: $1"); |
| | | |
| | | RegularExpressionIdentityMapperCfg configuration = |
| | | AdminTestCaseUtils.getConfiguration( |
| | | RegularExpressionIdentityMapperCfgDefn.getInstance(), |
| | | mapperEntry); |
| | | RegularExpressionIdentityMapper mapper = |
| | | new RegularExpressionIdentityMapper(); |
| | | assertTrue(mapper.isConfigurationAcceptable(configuration, |
| | | new LinkedList<LocalizableMessage>())); |
| | | mapper.initializeIdentityMapper(configuration); |
| | | RegularExpressionIdentityMapper mapper = initializeIdentityMapper(mapperEntry); |
| | | |
| | | |
| | | |
| | |
| | | "ds-cfg-match-pattern: ^([^@]+)@.+$", |
| | | "ds-cfg-replace-pattern: $1"); |
| | | |
| | | RegularExpressionIdentityMapperCfg configuration = |
| | | AdminTestCaseUtils.getConfiguration( |
| | | RegularExpressionIdentityMapperCfgDefn.getInstance(), |
| | | mapperEntry); |
| | | RegularExpressionIdentityMapper mapper = |
| | | new RegularExpressionIdentityMapper(); |
| | | assertTrue(mapper.isConfigurationAcceptable(configuration, |
| | | new LinkedList<LocalizableMessage>())); |
| | | mapper.initializeIdentityMapper(configuration); |
| | | RegularExpressionIdentityMapper mapper = initializeIdentityMapper(mapperEntry); |
| | | |
| | | |
| | | |
| | |
| | | "ds-cfg-match-pattern: ^([^@]+)@.+$", |
| | | "ds-cfg-replace-pattern: $1"); |
| | | |
| | | RegularExpressionIdentityMapperCfg configuration = |
| | | AdminTestCaseUtils.getConfiguration( |
| | | RegularExpressionIdentityMapperCfgDefn.getInstance(), |
| | | mapperEntry); |
| | | RegularExpressionIdentityMapper mapper = |
| | | new RegularExpressionIdentityMapper(); |
| | | assertTrue(mapper.isConfigurationAcceptable(configuration, |
| | | new LinkedList<LocalizableMessage>())); |
| | | mapper.initializeIdentityMapper(configuration); |
| | | RegularExpressionIdentityMapper mapper = initializeIdentityMapper(mapperEntry); |
| | | |
| | | |
| | | |
| | |
| | | "ds-cfg-match-pattern: ^([^@]+)@.+$", |
| | | "ds-cfg-replace-pattern: $1"); |
| | | |
| | | RegularExpressionIdentityMapperCfg configuration = |
| | | AdminTestCaseUtils.getConfiguration( |
| | | RegularExpressionIdentityMapperCfgDefn.getInstance(), |
| | | mapperEntry); |
| | | RegularExpressionIdentityMapper mapper = |
| | | new RegularExpressionIdentityMapper(); |
| | | assertTrue(mapper.isConfigurationAcceptable(configuration, |
| | | new LinkedList<LocalizableMessage>())); |
| | | mapper.initializeIdentityMapper(configuration); |
| | | RegularExpressionIdentityMapper mapper = initializeIdentityMapper(mapperEntry); |
| | | |
| | | |
| | | |
| | |
| | | "ds-cfg-match-attribute: uid", |
| | | "ds-cfg-match-pattern: @.+$"); |
| | | |
| | | RegularExpressionIdentityMapperCfg configuration = |
| | | AdminTestCaseUtils.getConfiguration( |
| | | RegularExpressionIdentityMapperCfgDefn.getInstance(), |
| | | mapperEntry); |
| | | RegularExpressionIdentityMapper mapper = |
| | | new RegularExpressionIdentityMapper(); |
| | | assertTrue(mapper.isConfigurationAcceptable(configuration, |
| | | new LinkedList<LocalizableMessage>())); |
| | | mapper.initializeIdentityMapper(configuration); |
| | | RegularExpressionIdentityMapper mapper = initializeIdentityMapper(mapperEntry); |
| | | |
| | | |
| | | |
| | |
| | | "ds-cfg-match-pattern: ^(.*)$", |
| | | "ds-cfg-replace-pattern: $1@example.com"); |
| | | |
| | | RegularExpressionIdentityMapperCfg configuration = |
| | | AdminTestCaseUtils.getConfiguration( |
| | | RegularExpressionIdentityMapperCfgDefn.getInstance(), |
| | | mapperEntry); |
| | | RegularExpressionIdentityMapper mapper = |
| | | new RegularExpressionIdentityMapper(); |
| | | assertTrue(mapper.isConfigurationAcceptable(configuration, |
| | | new LinkedList<LocalizableMessage>())); |
| | | mapper.initializeIdentityMapper(configuration); |
| | | RegularExpressionIdentityMapper mapper = initializeIdentityMapper(mapperEntry); |
| | | |
| | | |
| | | |
| | |
| | | "ds-cfg-match-pattern: ^([^@]+)@.+$", |
| | | "ds-cfg-replace-pattern: $1"); |
| | | |
| | | RegularExpressionIdentityMapperCfg configuration = |
| | | AdminTestCaseUtils.getConfiguration( |
| | | RegularExpressionIdentityMapperCfgDefn.getInstance(), |
| | | mapperEntry); |
| | | RegularExpressionIdentityMapper mapper = |
| | | new RegularExpressionIdentityMapper(); |
| | | assertTrue(mapper.isConfigurationAcceptable(configuration, |
| | | new LinkedList<LocalizableMessage>())); |
| | | mapper.initializeIdentityMapper(configuration); |
| | | RegularExpressionIdentityMapper mapper = initializeIdentityMapper(mapperEntry); |
| | | |
| | | |
| | | |
| | |
| | | "ds-cfg-match-pattern: ^([^@]+)@.+$", |
| | | "ds-cfg-replace-pattern: $1"); |
| | | |
| | | RegularExpressionIdentityMapperCfg configuration = |
| | | AdminTestCaseUtils.getConfiguration( |
| | | RegularExpressionIdentityMapperCfgDefn.getInstance(), |
| | | mapperEntry); |
| | | RegularExpressionIdentityMapper mapper = |
| | | new RegularExpressionIdentityMapper(); |
| | | assertTrue(mapper.isConfigurationAcceptable(configuration, |
| | | new LinkedList<LocalizableMessage>())); |
| | | mapper.initializeIdentityMapper(configuration); |
| | | RegularExpressionIdentityMapper mapper = initializeIdentityMapper(mapperEntry); |
| | | |
| | | |
| | | |
| | |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.opends.server.TestCaseUtils; |
| | | import org.forgerock.opendj.config.server.AdminTestCaseUtils; |
| | | import org.forgerock.opendj.server.config.meta.RepeatedCharactersPasswordValidatorCfgDefn; |
| | | import org.forgerock.opendj.server.config.server.RepeatedCharactersPasswordValidatorCfg; |
| | | import org.opends.server.core.ModifyOperationBasis; |
| | |
| | | public void testInitializeWithValidConfigs(Entry e) |
| | | throws Exception |
| | | { |
| | | RepeatedCharactersPasswordValidatorCfg configuration = |
| | | AdminTestCaseUtils.getConfiguration( |
| | | RepeatedCharactersPasswordValidatorCfgDefn.getInstance(), e); |
| | | |
| | | RepeatedCharactersPasswordValidator validator = |
| | | new RepeatedCharactersPasswordValidator(); |
| | | validator.initializePasswordValidator(configuration); |
| | | RepeatedCharactersPasswordValidator validator = initializePasswordValidator(e); |
| | | validator.finalizePasswordValidator(); |
| | | } |
| | | |
| | |
| | | public void testInitializeWithInvalidConfigs(Entry e) |
| | | throws Exception |
| | | { |
| | | RepeatedCharactersPasswordValidatorCfg configuration = |
| | | AdminTestCaseUtils.getConfiguration( |
| | | RepeatedCharactersPasswordValidatorCfgDefn.getInstance(), e); |
| | | |
| | | RepeatedCharactersPasswordValidator validator = |
| | | new RepeatedCharactersPasswordValidator(); |
| | | validator.initializePasswordValidator(configuration); |
| | | initializePasswordValidator(e); |
| | | } |
| | | |
| | | |
| | | private RepeatedCharactersPasswordValidator initializePasswordValidator(Entry e) |
| | | throws ConfigException, InitializationException { |
| | | return InitializationUtils.initializePasswordValidator( |
| | | new RepeatedCharactersPasswordValidator(), e, RepeatedCharactersPasswordValidatorCfgDefn.getInstance()); |
| | | } |
| | | |
| | | /** |
| | | * Tests the {@code passwordIsAcceptable} method with a password that falls |
| | |
| | | "ds-cfg-max-consecutive-length: 0", |
| | | "ds-cfg-case-sensitive-validation: true"); |
| | | |
| | | RepeatedCharactersPasswordValidatorCfg configuration = |
| | | AdminTestCaseUtils.getConfiguration( |
| | | RepeatedCharactersPasswordValidatorCfgDefn.getInstance(), |
| | | validatorEntry); |
| | | |
| | | RepeatedCharactersPasswordValidator validator = |
| | | new RepeatedCharactersPasswordValidator(); |
| | | validator.initializePasswordValidator(configuration); |
| | | RepeatedCharactersPasswordValidator validator = initializePasswordValidator(validatorEntry); |
| | | |
| | | String value = "aaaaaaaa"; |
| | | assertAcceptable(validator, value, userEntry, true); |
| | |
| | | "ds-cfg-max-consecutive-length: 2", |
| | | "ds-cfg-case-sensitive-validation: true"); |
| | | |
| | | RepeatedCharactersPasswordValidatorCfg updatedConfiguration = |
| | | AdminTestCaseUtils.getConfiguration( |
| | | RepeatedCharactersPasswordValidatorCfg updatedConfiguration = InitializationUtils.getConfiguration( |
| | | RepeatedCharactersPasswordValidatorCfgDefn.getInstance(), |
| | | updatedValidatorEntry); |
| | | |
| | |
| | | "ds-cfg-max-consecutive-length: " + maxConsecutiveLength, |
| | | "ds-cfg-case-sensitive-validation: " + caseSensitiveValidation); |
| | | |
| | | RepeatedCharactersPasswordValidatorCfgDefn defn = RepeatedCharactersPasswordValidatorCfgDefn.getInstance(); |
| | | RepeatedCharactersPasswordValidatorCfg configuration = AdminTestCaseUtils.getConfiguration(defn, validatorEntry); |
| | | |
| | | RepeatedCharactersPasswordValidator validator = new RepeatedCharactersPasswordValidator(); |
| | | validator.initializePasswordValidator(configuration); |
| | | |
| | | RepeatedCharactersPasswordValidator validator = initializePasswordValidator(validatorEntry); |
| | | assertAcceptable(validator, value, userEntry, expectedResult); |
| | | |
| | | validator.finalizePasswordValidator(); |
| | | } |
| | | |
| | |
| | | */ |
| | | package org.opends.server.extensions; |
| | | |
| | | |
| | | |
| | | import org.forgerock.opendj.config.server.AdminTestCaseUtils; |
| | | import org.forgerock.opendj.server.config.meta.SHA1PasswordStorageSchemeCfgDefn; |
| | | import org.forgerock.opendj.server.config.server.SHA1PasswordStorageSchemeCfg; |
| | | import org.opends.server.api.PasswordStorageScheme; |
| | | |
| | | |
| | | |
| | | /** |
| | | * A set of test cases for the SHA-1 password storage scheme. |
| | | */ |
| | | /** A set of test cases for the SHA-1 password storage scheme. */ |
| | | public class SHA1PasswordStorageSchemeTestCase |
| | | extends PasswordStorageSchemeTestCase |
| | | { |
| | | /** |
| | | * Creates a new instance of this storage scheme test case. |
| | | */ |
| | | /** Creates a new instance of this storage scheme test case. */ |
| | | public SHA1PasswordStorageSchemeTestCase() |
| | | { |
| | | super("cn=SHA-1,cn=Password Storage Schemes,cn=config"); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Retrieves an initialized instance of this password storage scheme. |
| | | * |
| | | * @return An initialized instance of this password storage scheme. |
| | | * |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | protected PasswordStorageScheme getScheme() |
| | | throws Exception |
| | | protected PasswordStorageScheme<?> getScheme() throws Exception |
| | | { |
| | | SHA1PasswordStorageScheme scheme = new SHA1PasswordStorageScheme(); |
| | | |
| | | SHA1PasswordStorageSchemeCfg configuration = |
| | | AdminTestCaseUtils.getConfiguration( |
| | | SHA1PasswordStorageSchemeCfgDefn.getInstance(), |
| | | configEntry |
| | | ); |
| | | |
| | | scheme.initializePasswordStorageScheme(configuration); |
| | | return scheme; |
| | | return InitializationUtils.initializePasswordStorageScheme( |
| | | new SHA1PasswordStorageScheme(), configEntry, SHA1PasswordStorageSchemeCfgDefn.getInstance()); |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | import org.testng.annotations.Test; |
| | | |
| | | import org.forgerock.opendj.config.server.AdminTestCaseUtils; |
| | | import org.forgerock.opendj.server.config.meta.SaltedMD5PasswordStorageSchemeCfgDefn; |
| | | import org.forgerock.opendj.server.config.server.SaltedMD5PasswordStorageSchemeCfg; |
| | | import org.opends.server.api.PasswordStorageScheme; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | |
| | | import static org.testng.Assert.*; |
| | | |
| | | /** |
| | | * A set of test cases for the salted MD5 password storage scheme. |
| | | */ |
| | | /** A set of test cases for the salted MD5 password storage scheme. */ |
| | | public class SaltedMD5PasswordStorageSchemeTestCase |
| | | extends PasswordStorageSchemeTestCase |
| | | { |
| | | /** |
| | | * Creates a new instance of this storage scheme test case. |
| | | */ |
| | | /** Creates a new instance of this storage scheme test case. */ |
| | | public SaltedMD5PasswordStorageSchemeTestCase() |
| | | { |
| | | super("cn=Salted MD5,cn=Password Storage Schemes,cn=config"); |
| | | } |
| | | |
| | | /** |
| | | * Retrieves an initialized instance of this password storage scheme. |
| | | * |
| | | * @return An initialized instance of this password storage scheme. |
| | | */ |
| | | protected PasswordStorageScheme getScheme() throws Exception |
| | | protected PasswordStorageScheme<?> getScheme() throws Exception |
| | | { |
| | | SaltedMD5PasswordStorageScheme scheme = |
| | | new SaltedMD5PasswordStorageScheme(); |
| | | |
| | | SaltedMD5PasswordStorageSchemeCfg configuration = |
| | | AdminTestCaseUtils.getConfiguration( |
| | | SaltedMD5PasswordStorageSchemeCfgDefn.getInstance(), |
| | | configEntry |
| | | ); |
| | | |
| | | scheme.initializePasswordStorageScheme(configuration); |
| | | return scheme; |
| | | return InitializationUtils.initializePasswordStorageScheme( |
| | | new SaltedMD5PasswordStorageScheme(), configEntry, SaltedMD5PasswordStorageSchemeCfgDefn.getInstance()); |
| | | } |
| | | |
| | | |
| | |
| | | */ |
| | | @Test |
| | | public void testDifferentSaltSize() throws Exception { |
| | | SaltedMD5PasswordStorageScheme scheme = |
| | | new SaltedMD5PasswordStorageScheme(); |
| | | |
| | | SaltedMD5PasswordStorageSchemeCfg configuration = |
| | | AdminTestCaseUtils.getConfiguration( |
| | | SaltedMD5PasswordStorageSchemeCfgDefn.getInstance(), |
| | | configEntry |
| | | ); |
| | | |
| | | scheme.initializePasswordStorageScheme(configuration); |
| | | SaltedMD5PasswordStorageScheme scheme = InitializationUtils.initializePasswordStorageScheme( |
| | | new SaltedMD5PasswordStorageScheme(), configEntry, SaltedMD5PasswordStorageSchemeCfgDefn.getInstance()); |
| | | // The stored value has a 12 byte salt instead of the default 8 |
| | | assertTrue(scheme.passwordMatches(ByteString.valueOfUtf8("password"), |
| | | ByteString.valueOfUtf8("so5s1vK3oEi4uL/oVY3bqs5LRlKjgMN+u4A4bw=="))); |
| | |
| | | */ |
| | | package org.opends.server.extensions; |
| | | |
| | | import org.forgerock.opendj.config.server.AdminTestCaseUtils; |
| | | import org.forgerock.opendj.server.config.meta.SaltedSHA1PasswordStorageSchemeCfgDefn; |
| | | import org.forgerock.opendj.server.config.server.SaltedSHA1PasswordStorageSchemeCfg; |
| | | import org.opends.server.api.PasswordStorageScheme; |
| | | import org.opends.server.types.DirectoryException; |
| | | |
| | |
| | | @Override |
| | | protected PasswordStorageScheme<?> getScheme() throws Exception |
| | | { |
| | | SaltedSHA1PasswordStorageScheme scheme = |
| | | new SaltedSHA1PasswordStorageScheme(); |
| | | |
| | | SaltedSHA1PasswordStorageSchemeCfg configuration = |
| | | AdminTestCaseUtils.getConfiguration( |
| | | SaltedSHA1PasswordStorageSchemeCfgDefn.getInstance(), |
| | | configEntry |
| | | ); |
| | | |
| | | scheme.initializePasswordStorageScheme(configuration); |
| | | return scheme; |
| | | return InitializationUtils.initializePasswordStorageScheme( |
| | | new SaltedSHA1PasswordStorageScheme(), configEntry, SaltedSHA1PasswordStorageSchemeCfgDefn.getInstance()); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | protected String encodeOffline(final byte[] plaintextBytes) throws DirectoryException |
| | | { |
| | |
| | | */ |
| | | package org.opends.server.extensions; |
| | | |
| | | import org.forgerock.opendj.config.server.AdminTestCaseUtils; |
| | | import org.forgerock.opendj.server.config.meta.SaltedSHA256PasswordStorageSchemeCfgDefn; |
| | | import org.forgerock.opendj.server.config.server.SaltedSHA256PasswordStorageSchemeCfg; |
| | | import org.opends.server.api.PasswordStorageScheme; |
| | | import org.testng.annotations.DataProvider; |
| | | import org.testng.annotations.Test; |
| | | |
| | | /** |
| | | * A set of test cases for the salted SHA-256 password storage scheme. |
| | | */ |
| | | /** A set of test cases for the salted SHA-256 password storage scheme. */ |
| | | @SuppressWarnings("javadoc") |
| | | public class SaltedSHA256PasswordStorageSchemeTestCase |
| | | extends PasswordStorageSchemeTestCase |
| | | { |
| | | /** |
| | | * Creates a new instance of this storage scheme test case. |
| | | */ |
| | | /** Creates a new instance of this storage scheme test case. */ |
| | | public SaltedSHA256PasswordStorageSchemeTestCase() |
| | | { |
| | | super("cn=Salted SHA-256,cn=Password Storage Schemes,cn=config"); |
| | |
| | | @Override |
| | | protected PasswordStorageScheme<?> getScheme() throws Exception |
| | | { |
| | | SaltedSHA256PasswordStorageScheme scheme = |
| | | new SaltedSHA256PasswordStorageScheme(); |
| | | |
| | | SaltedSHA256PasswordStorageSchemeCfg configuration = |
| | | AdminTestCaseUtils.getConfiguration( |
| | | SaltedSHA256PasswordStorageSchemeCfgDefn.getInstance(), |
| | | configEntry |
| | | ); |
| | | |
| | | scheme.initializePasswordStorageScheme(configuration); |
| | | return scheme; |
| | | return InitializationUtils.initializePasswordStorageScheme( |
| | | new SaltedSHA256PasswordStorageScheme(), configEntry, SaltedSHA256PasswordStorageSchemeCfgDefn.getInstance()); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | package org.opends.server.extensions; |
| | | |
| | | import org.forgerock.opendj.config.server.AdminTestCaseUtils; |
| | | import org.forgerock.opendj.server.config.meta.SaltedSHA384PasswordStorageSchemeCfgDefn; |
| | | import org.forgerock.opendj.server.config.server.SaltedSHA384PasswordStorageSchemeCfg; |
| | | import org.opends.server.api.PasswordStorageScheme; |
| | | import org.testng.annotations.DataProvider; |
| | | import org.testng.annotations.Test; |
| | | |
| | | /** |
| | | * A set of test cases for the salted SHA-384 password storage scheme. |
| | | */ |
| | | /** A set of test cases for the salted SHA-384 password storage scheme. */ |
| | | @SuppressWarnings("javadoc") |
| | | public class SaltedSHA384PasswordStorageSchemeTestCase |
| | | extends PasswordStorageSchemeTestCase |
| | | { |
| | | /** |
| | | * Creates a new instance of this storage scheme test case. |
| | | */ |
| | | /** Creates a new instance of this storage scheme test case. */ |
| | | public SaltedSHA384PasswordStorageSchemeTestCase() |
| | | { |
| | | super("cn=Salted SHA-384,cn=Password Storage Schemes,cn=config"); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Retrieves an initialized instance of this password storage scheme. |
| | | * |
| | | * @return An initialized instance of this password storage scheme. |
| | | * |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | @Override |
| | | protected PasswordStorageScheme<?> getScheme() throws Exception |
| | | { |
| | | SaltedSHA384PasswordStorageScheme scheme = |
| | | new SaltedSHA384PasswordStorageScheme(); |
| | | |
| | | SaltedSHA384PasswordStorageSchemeCfg configuration = |
| | | AdminTestCaseUtils.getConfiguration( |
| | | SaltedSHA384PasswordStorageSchemeCfgDefn.getInstance(), |
| | | configEntry |
| | | ); |
| | | |
| | | scheme.initializePasswordStorageScheme(configuration); |
| | | return scheme; |
| | | return InitializationUtils.initializePasswordStorageScheme( |
| | | new SaltedSHA384PasswordStorageScheme(), configEntry, SaltedSHA384PasswordStorageSchemeCfgDefn.getInstance()); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | package org.opends.server.extensions; |
| | | |
| | | import org.forgerock.opendj.config.server.AdminTestCaseUtils; |
| | | import org.forgerock.opendj.server.config.meta.SaltedSHA512PasswordStorageSchemeCfgDefn; |
| | | import org.forgerock.opendj.server.config.server.SaltedSHA512PasswordStorageSchemeCfg; |
| | | import org.opends.server.api.PasswordStorageScheme; |
| | | import org.opends.server.types.DirectoryException; |
| | | import org.testng.annotations.DataProvider; |
| | | import org.testng.annotations.Test; |
| | | |
| | | /** |
| | | * A set of test cases for the salted SHA-512 password storage scheme. |
| | | */ |
| | | /** A set of test cases for the salted SHA-512 password storage scheme. */ |
| | | @SuppressWarnings("javadoc") |
| | | public class SaltedSHA512PasswordStorageSchemeTestCase |
| | | extends PasswordStorageSchemeTestCase |
| | | { |
| | | /** |
| | | * Creates a new instance of this storage scheme test case. |
| | | */ |
| | | /** Creates a new instance of this storage scheme test case. */ |
| | | public SaltedSHA512PasswordStorageSchemeTestCase() |
| | | { |
| | | super("cn=Salted SHA-512,cn=Password Storage Schemes,cn=config"); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Retrieves an initialized instance of this password storage scheme. |
| | | * |
| | | * @return An initialized instance of this password storage scheme. |
| | | * |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | @Override |
| | | protected PasswordStorageScheme<?> getScheme() throws Exception |
| | | { |
| | | SaltedSHA512PasswordStorageScheme scheme = |
| | | new SaltedSHA512PasswordStorageScheme(); |
| | | |
| | | SaltedSHA512PasswordStorageSchemeCfg configuration = |
| | | AdminTestCaseUtils.getConfiguration( |
| | | SaltedSHA512PasswordStorageSchemeCfgDefn.getInstance(), |
| | | configEntry |
| | | ); |
| | | |
| | | scheme.initializePasswordStorageScheme(configuration); |
| | | return scheme; |
| | | return InitializationUtils.initializePasswordStorageScheme( |
| | | new SaltedSHA512PasswordStorageScheme(), configEntry, SaltedSHA512PasswordStorageSchemeCfgDefn.getInstance()); |
| | | } |
| | | |
| | | /** |
| | |
| | | testAuthPasswords("TestSSHA512", plaintextPassword, encodedPassword); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | protected String encodeOffline(byte[] plaintextBytes) throws DirectoryException |
| | | { |
| | |
| | | import static org.opends.server.util.CollectionUtils.*; |
| | | import static org.testng.Assert.*; |
| | | import org.forgerock.opendj.server.config.meta.SimilarityBasedPasswordValidatorCfgDefn; |
| | | import org.forgerock.opendj.server.config.server.SimilarityBasedPasswordValidatorCfg; |
| | | import org.forgerock.opendj.config.server.AdminTestCaseUtils; |
| | | |
| | | /** |
| | | * A set of test cases for the Similarity-Based Password Reject. |
| | |
| | | public void testInitializeWithValidConfigs(Entry e) |
| | | throws Exception |
| | | { |
| | | SimilarityBasedPasswordValidatorCfg configuration = |
| | | AdminTestCaseUtils.getConfiguration( |
| | | SimilarityBasedPasswordValidatorCfgDefn.getInstance(), |
| | | e); |
| | | |
| | | SimilarityBasedPasswordValidator validator = new SimilarityBasedPasswordValidator(); |
| | | validator.initializePasswordValidator(configuration); |
| | | initializePasswordValidator(e); |
| | | } |
| | | |
| | | |
| | |
| | | public void testInitializeWithInvalidConfigs(Entry e) |
| | | throws Exception |
| | | { |
| | | SimilarityBasedPasswordValidatorCfg configuration = |
| | | AdminTestCaseUtils.getConfiguration( |
| | | SimilarityBasedPasswordValidatorCfgDefn.getInstance(), |
| | | e); |
| | | |
| | | SimilarityBasedPasswordValidator validator = new SimilarityBasedPasswordValidator(); |
| | | validator.initializePasswordValidator(configuration); |
| | | initializePasswordValidator(e); |
| | | } |
| | | |
| | | |
| | |
| | | "ds-cfg-min-password-difference: 0" |
| | | ); |
| | | |
| | | SimilarityBasedPasswordValidatorCfg configuration = |
| | | AdminTestCaseUtils.getConfiguration( |
| | | SimilarityBasedPasswordValidatorCfgDefn.getInstance(), |
| | | validatorEntry); |
| | | |
| | | SimilarityBasedPasswordValidator validator = |
| | | new SimilarityBasedPasswordValidator(); |
| | | validator.initializePasswordValidator(configuration); |
| | | SimilarityBasedPasswordValidator validator = initializePasswordValidator(validatorEntry); |
| | | |
| | | StringBuilder buffer = new StringBuilder(); |
| | | for (int i=0; i < 20; i++) |
| | |
| | | "ds-cfg-min-password-difference: 3" |
| | | ); |
| | | |
| | | SimilarityBasedPasswordValidatorCfg configuration = |
| | | AdminTestCaseUtils.getConfiguration( |
| | | SimilarityBasedPasswordValidatorCfgDefn.getInstance(), |
| | | validatorEntry); |
| | | |
| | | SimilarityBasedPasswordValidator validator = |
| | | new SimilarityBasedPasswordValidator(); |
| | | validator.initializePasswordValidator(configuration); |
| | | SimilarityBasedPasswordValidator validator = initializePasswordValidator(validatorEntry); |
| | | |
| | | StringBuilder buffer = new StringBuilder(); |
| | | HashSet<ByteString> currentPassword = new HashSet<>(3); |
| | |
| | | |
| | | validator.finalizePasswordValidator(); |
| | | } |
| | | } |
| | | |
| | | private SimilarityBasedPasswordValidator initializePasswordValidator(Entry cfgEntry) throws Exception { |
| | | return InitializationUtils.initializePasswordValidator( |
| | | new SimilarityBasedPasswordValidator(), cfgEntry, SimilarityBasedPasswordValidatorCfgDefn.getInstance()); |
| | | } |
| | | } |
| | |
| | | */ |
| | | package org.opends.server.extensions; |
| | | |
| | | |
| | | |
| | | import java.util.ArrayList; |
| | | import org.opends.server.TestCaseUtils; |
| | | import org.forgerock.opendj.config.server.AdminTestCaseUtils; |
| | | import org.testng.annotations.BeforeClass; |
| | | import org.forgerock.opendj.server.config.meta.*; |
| | | import org.forgerock.opendj.server.config.server.SoftReferenceEntryCacheCfg; |
| | |
| | | import org.testng.annotations.Test; |
| | | import static org.testng.Assert.*; |
| | | |
| | | |
| | | |
| | | /** |
| | | * A set of test cases for SoftReference entry cache implementation. |
| | | */ |
| | |
| | | "ds-cfg-java-class: " + |
| | | "org.opends.server.extensions.SoftReferenceEntryCache", |
| | | "ds-cfg-enabled: true"); |
| | | super.configuration = AdminTestCaseUtils.getConfiguration( |
| | | super.configuration = InitializationUtils.getConfiguration( |
| | | SoftReferenceEntryCacheCfgDefn.getInstance(), cacheConfigEntry); |
| | | |
| | | // Force GC to make sure we have enough memory for |
| | |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.forgerock.opendj.ldap.requests.ModifyRequest; |
| | | import org.opends.server.TestCaseUtils; |
| | | import org.forgerock.opendj.config.server.AdminTestCaseUtils; |
| | | import org.forgerock.opendj.server.config.meta.SubjectAttributeToUserAttributeCertificateMapperCfgDefn; |
| | | import org.forgerock.opendj.server.config.server.SubjectAttributeToUserAttributeCertificateMapperCfg; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.core.ModifyOperation; |
| | | import org.opends.server.tools.LDAPSearch; |
| | |
| | | public void testInvalidConfigs(Entry e) |
| | | throws Exception |
| | | { |
| | | SubjectAttributeToUserAttributeCertificateMapperCfg config = |
| | | AdminTestCaseUtils.getConfiguration( |
| | | SubjectAttributeToUserAttributeCertificateMapperCfgDefn. |
| | | getInstance(), e); |
| | | |
| | | SubjectAttributeToUserAttributeCertificateMapper mapper = |
| | | new SubjectAttributeToUserAttributeCertificateMapper(); |
| | | mapper.initializeCertificateMapper(config); |
| | | InitializationUtils.initializeCertificateMapper( |
| | | new SubjectAttributeToUserAttributeCertificateMapper(), |
| | | e, |
| | | SubjectAttributeToUserAttributeCertificateMapperCfgDefn.getInstance()); |
| | | } |
| | | |
| | | |
| | |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.forgerock.opendj.ldap.requests.ModifyRequest; |
| | | import org.opends.server.TestCaseUtils; |
| | | import org.forgerock.opendj.config.server.AdminTestCaseUtils; |
| | | import org.forgerock.opendj.server.config.meta.SubjectDNToUserAttributeCertificateMapperCfgDefn; |
| | | import org.forgerock.opendj.server.config.server.SubjectDNToUserAttributeCertificateMapperCfg; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.core.ModifyOperation; |
| | | import org.opends.server.tools.LDAPSearch; |
| | |
| | | public void testInvalidConfigs(Entry e) |
| | | throws Exception |
| | | { |
| | | SubjectDNToUserAttributeCertificateMapperCfg configuration = |
| | | AdminTestCaseUtils.getConfiguration( |
| | | SubjectDNToUserAttributeCertificateMapperCfgDefn. |
| | | getInstance(), e); |
| | | |
| | | SubjectDNToUserAttributeCertificateMapper mapper = |
| | | new SubjectDNToUserAttributeCertificateMapper(); |
| | | mapper.initializeCertificateMapper(configuration); |
| | | InitializationUtils.initializeCertificateMapper( |
| | | new SubjectDNToUserAttributeCertificateMapper(), |
| | | e, |
| | | SubjectDNToUserAttributeCertificateMapperCfgDefn.getInstance()); |
| | | } |
| | | |
| | | |
| | |
| | | */ |
| | | package org.opends.server.extensions; |
| | | |
| | | |
| | | |
| | | import org.forgerock.opendj.config.server.AdminTestCaseUtils; |
| | | import org.forgerock.opendj.server.config.meta.TripleDESPasswordStorageSchemeCfgDefn; |
| | | import org.forgerock.opendj.server.config.server.TripleDESPasswordStorageSchemeCfg; |
| | | import org.opends.server.api.PasswordStorageScheme; |
| | | |
| | | |
| | | |
| | | /** |
| | | * A set of test cases for the 3DES password storage scheme. |
| | | */ |
| | | /** A set of test cases for the 3DES password storage scheme. */ |
| | | public class TripleDESPasswordStorageSchemeTestCase |
| | | extends PasswordStorageSchemeTestCase |
| | | { |
| | | /** |
| | | * Creates a new instance of this storage scheme test case. |
| | | */ |
| | | /** Creates a new instance of this storage scheme test case. */ |
| | | public TripleDESPasswordStorageSchemeTestCase() |
| | | { |
| | | super("cn=3DES,cn=Password Storage Schemes,cn=config"); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Retrieves an initialized instance of this password storage scheme. |
| | | * |
| | | * @return An initialized instance of this password storage scheme. |
| | | * |
| | | * @throws Exception If an unexpected problem occurs. |
| | | */ |
| | | protected PasswordStorageScheme getScheme() |
| | | throws Exception |
| | | protected PasswordStorageScheme<?> getScheme() throws Exception |
| | | { |
| | | TripleDESPasswordStorageScheme scheme = |
| | | new TripleDESPasswordStorageScheme(); |
| | | |
| | | TripleDESPasswordStorageSchemeCfg configuration = |
| | | AdminTestCaseUtils.getConfiguration( |
| | | TripleDESPasswordStorageSchemeCfgDefn.getInstance(), |
| | | configEntry); |
| | | |
| | | scheme.initializePasswordStorageScheme(configuration); |
| | | return scheme; |
| | | return InitializationUtils.initializePasswordStorageScheme( |
| | | new TripleDESPasswordStorageScheme(), configEntry, TripleDESPasswordStorageSchemeCfgDefn.getInstance()); |
| | | } |
| | | } |
| | | |
| | |
| | | */ |
| | | package org.opends.server.extensions; |
| | | |
| | | import static org.opends.server.extensions.InitializationUtils.getConfiguration; |
| | | import static org.opends.server.extensions.InitializationUtils.initializePasswordValidator; |
| | | import static org.testng.Assert.*; |
| | | |
| | | import java.util.ArrayList; |
| | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.opendj.server.config.meta.UniqueCharactersPasswordValidatorCfgDefn; |
| | | import org.forgerock.opendj.server.config.server.UniqueCharactersPasswordValidatorCfg; |
| | | import org.forgerock.opendj.config.server.AdminTestCaseUtils; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.opends.server.core.ModifyOperationBasis; |
| | | import org.opends.server.protocols.internal.InternalClientConnection; |
| | |
| | | public void testInitializeWithValidConfigs(Entry e) |
| | | throws Exception |
| | | { |
| | | UniqueCharactersPasswordValidatorCfg configuration = |
| | | AdminTestCaseUtils.getConfiguration( |
| | | UniqueCharactersPasswordValidatorCfgDefn.getInstance(), e); |
| | | |
| | | UniqueCharactersPasswordValidator validator = |
| | | new UniqueCharactersPasswordValidator(); |
| | | validator.initializePasswordValidator(configuration); |
| | | UniqueCharactersPasswordValidator validator = initializePasswordValidator0(e); |
| | | validator.finalizePasswordValidator(); |
| | | } |
| | | |
| | | |
| | | private static UniqueCharactersPasswordValidator initializePasswordValidator0(Entry validatorEntry) throws ConfigException, InitializationException { |
| | | return initializePasswordValidator( |
| | | new UniqueCharactersPasswordValidator(), validatorEntry, UniqueCharactersPasswordValidatorCfgDefn.getInstance()); |
| | | } |
| | | |
| | | /** |
| | | * Retrieves a set of invalid configuration entries. |
| | |
| | | public void testInitializeWithInvalidConfigs(Entry e) |
| | | throws Exception |
| | | { |
| | | UniqueCharactersPasswordValidatorCfg configuration = |
| | | AdminTestCaseUtils.getConfiguration( |
| | | UniqueCharactersPasswordValidatorCfgDefn.getInstance(), e); |
| | | |
| | | UniqueCharactersPasswordValidator validator = |
| | | new UniqueCharactersPasswordValidator(); |
| | | validator.initializePasswordValidator(configuration); |
| | | initializePasswordValidator0(e); |
| | | } |
| | | |
| | | |
| | |
| | | "ds-cfg-min-unique-characters: 5", |
| | | "ds-cfg-case-sensitive-validation: false"); |
| | | |
| | | UniqueCharactersPasswordValidatorCfg configuration = |
| | | AdminTestCaseUtils.getConfiguration( |
| | | UniqueCharactersPasswordValidatorCfgDefn.getInstance(), |
| | | validatorEntry); |
| | | |
| | | UniqueCharactersPasswordValidator validator = |
| | | new UniqueCharactersPasswordValidator(); |
| | | validator.initializePasswordValidator(configuration); |
| | | UniqueCharactersPasswordValidator validator = initializePasswordValidator0(validatorEntry); |
| | | |
| | | ByteString password = ByteString.valueOfUtf8("password"); |
| | | ArrayList<Modification> mods = new ArrayList<>(); |
| | |
| | | validator.finalizePasswordValidator(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Tests the {@code passwordIsAcceptable} method with a password that falls |
| | | * outside the constraints of the password validator. Case-sensitivity will |
| | |
| | | "ds-cfg-min-unique-characters: 5", |
| | | "ds-cfg-case-sensitive-validation: false"); |
| | | |
| | | UniqueCharactersPasswordValidatorCfg configuration = |
| | | AdminTestCaseUtils.getConfiguration( |
| | | UniqueCharactersPasswordValidatorCfgDefn.getInstance(), |
| | | validatorEntry); |
| | | |
| | | UniqueCharactersPasswordValidator validator = |
| | | new UniqueCharactersPasswordValidator(); |
| | | validator.initializePasswordValidator(configuration); |
| | | UniqueCharactersPasswordValidator validator = initializePasswordValidator0(validatorEntry); |
| | | |
| | | ByteString password = ByteString.valueOfUtf8("passw"); |
| | | ArrayList<Modification> mods = new ArrayList<>(); |
| | |
| | | "ds-cfg-min-unique-characters: 5", |
| | | "ds-cfg-case-sensitive-validation: true"); |
| | | |
| | | UniqueCharactersPasswordValidatorCfg configuration = |
| | | AdminTestCaseUtils.getConfiguration( |
| | | UniqueCharactersPasswordValidatorCfgDefn.getInstance(), |
| | | validatorEntry); |
| | | |
| | | UniqueCharactersPasswordValidator validator = |
| | | new UniqueCharactersPasswordValidator(); |
| | | validator.initializePasswordValidator(configuration); |
| | | UniqueCharactersPasswordValidator validator = initializePasswordValidator0(validatorEntry); |
| | | |
| | | ByteString password = ByteString.valueOfUtf8("pasSw"); |
| | | ArrayList<Modification> mods = new ArrayList<>(); |
| | |
| | | "ds-cfg-min-unique-characters: 5", |
| | | "ds-cfg-case-sensitive-validation: false"); |
| | | |
| | | UniqueCharactersPasswordValidatorCfg configuration = |
| | | AdminTestCaseUtils.getConfiguration( |
| | | UniqueCharactersPasswordValidatorCfgDefn.getInstance(), |
| | | validatorEntry); |
| | | |
| | | UniqueCharactersPasswordValidator validator = |
| | | new UniqueCharactersPasswordValidator(); |
| | | validator.initializePasswordValidator(configuration); |
| | | UniqueCharactersPasswordValidator validator = initializePasswordValidator0(validatorEntry); |
| | | |
| | | ByteString password = ByteString.valueOfUtf8("pasSw"); |
| | | ArrayList<Modification> mods = new ArrayList<>(); |
| | |
| | | "ds-cfg-min-unique-characters: 0", |
| | | "ds-cfg-case-sensitive-validation: true"); |
| | | |
| | | UniqueCharactersPasswordValidatorCfg configuration = |
| | | AdminTestCaseUtils.getConfiguration( |
| | | UniqueCharactersPasswordValidatorCfgDefn.getInstance(), |
| | | validatorEntry); |
| | | |
| | | UniqueCharactersPasswordValidator validator = |
| | | new UniqueCharactersPasswordValidator(); |
| | | validator.initializePasswordValidator(configuration); |
| | | UniqueCharactersPasswordValidator validator = initializePasswordValidator0(validatorEntry); |
| | | |
| | | ByteString password = ByteString.valueOfUtf8("aaaaaaaa"); |
| | | ArrayList<Modification> mods = new ArrayList<>(); |
| | |
| | | "ds-cfg-min-unique-characters: 0", |
| | | "ds-cfg-case-sensitive-validation: true"); |
| | | |
| | | UniqueCharactersPasswordValidatorCfg configuration = |
| | | AdminTestCaseUtils.getConfiguration( |
| | | UniqueCharactersPasswordValidatorCfgDefn.getInstance(), |
| | | validatorEntry); |
| | | |
| | | UniqueCharactersPasswordValidator validator = |
| | | new UniqueCharactersPasswordValidator(); |
| | | validator.initializePasswordValidator(configuration); |
| | | UniqueCharactersPasswordValidator validator = initializePasswordValidator0(validatorEntry); |
| | | |
| | | ByteString password = ByteString.valueOfUtf8("aaaaaaaa"); |
| | | ArrayList<Modification> mods = new ArrayList<>(); |
| | |
| | | "ds-cfg-case-sensitive-validation: true"); |
| | | |
| | | UniqueCharactersPasswordValidatorCfg updatedConfiguration = |
| | | AdminTestCaseUtils.getConfiguration( |
| | | UniqueCharactersPasswordValidatorCfgDefn.getInstance(), |
| | | updatedValidatorEntry); |
| | | getConfiguration(UniqueCharactersPasswordValidatorCfgDefn.getInstance(), updatedValidatorEntry); |
| | | |
| | | ArrayList<LocalizableMessage> unacceptableReasons = new ArrayList<>(); |
| | | assertTrue(validator.isConfigurationChangeAcceptable(updatedConfiguration, |
| | |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.Set; |
| | | |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.forgerock.opendj.ldap.ModificationType; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.opends.server.TestCaseUtils; |
| | | import org.forgerock.opendj.config.server.AdminTestCaseUtils; |
| | | import org.forgerock.opendj.server.config.meta.AttributeCleanupPluginCfgDefn; |
| | | import org.forgerock.opendj.server.config.server.AttributeCleanupPluginCfg; |
| | | import org.opends.server.api.plugin.PluginResult; |
| | | import org.opends.server.api.plugin.PluginType; |
| | | import org.opends.server.core.AddOperationBasis; |
| | | import org.opends.server.core.ModifyOperationBasis; |
| | | import org.opends.server.extensions.InitializationUtils; |
| | | import org.opends.server.types.Entry; |
| | | import org.opends.server.types.InitializationException; |
| | | import org.opends.server.types.RawAttribute; |
| | |
| | | import org.testng.annotations.Test; |
| | | |
| | | import static org.forgerock.opendj.ldap.ModificationType.*; |
| | | import static org.opends.server.TestCaseUtils.*; |
| | | import static org.opends.server.protocols.internal.InternalClientConnection.*; |
| | | import static org.opends.server.util.CollectionUtils.*; |
| | | import static org.testng.Assert.*; |
| | |
| | | public void testInitializeWithValidConfigs(Entry e) |
| | | throws Exception |
| | | { |
| | | Set<PluginType> pluginTypes = getPluginTypes(e); |
| | | assertFalse(pluginTypes.isEmpty()); |
| | | |
| | | AttributeCleanupPluginCfg config = |
| | | AdminTestCaseUtils.getConfiguration( |
| | | AttributeCleanupPluginCfgDefn.getInstance(),e); |
| | | |
| | | assertNotNull(config); |
| | | |
| | | AttributeCleanupPlugin plugin = new AttributeCleanupPlugin(); |
| | | |
| | | plugin.initializePlugin(pluginTypes, config); |
| | | AttributeCleanupPlugin plugin = initializePlugin(e); |
| | | plugin.finalizePlugin(); |
| | | } |
| | | |
| | |
| | | public void testInitializeWithInvalidConfigs(Entry e) |
| | | throws ConfigException, InitializationException |
| | | { |
| | | Set<PluginType> pluginTypes = getPluginTypes(e); |
| | | assertFalse(pluginTypes.isEmpty()); |
| | | |
| | | AttributeCleanupPluginCfg config = |
| | | AdminTestCaseUtils.getConfiguration( |
| | | AttributeCleanupPluginCfgDefn.getInstance(),e); |
| | | |
| | | assertNotNull(config); |
| | | |
| | | AttributeCleanupPlugin plugin = new AttributeCleanupPlugin(); |
| | | |
| | | plugin.initializePlugin(pluginTypes, config); |
| | | AttributeCleanupPlugin plugin = initializePlugin(e); |
| | | plugin.finalizePlugin(); |
| | | } |
| | | |
| | |
| | | "ds-cfg-rename-inbound-attributes: cn:description", |
| | | "ds-cfg-java-class: org.opends.server.plugins.AttributeCleanupPlugin"); |
| | | |
| | | Set<PluginType> pluginTypes = getPluginTypes(confEntry); |
| | | |
| | | AttributeCleanupPluginCfg config = |
| | | AdminTestCaseUtils.getConfiguration( |
| | | AttributeCleanupPluginCfgDefn.getInstance(),confEntry); |
| | | |
| | | AttributeCleanupPlugin plugin = new AttributeCleanupPlugin(); |
| | | |
| | | plugin.initializePlugin(pluginTypes, config); |
| | | AttributeCleanupPlugin plugin = initializePlugin(confEntry); |
| | | |
| | | /* Construct the ADD operation as follows: |
| | | * |
| | |
| | | "ds-cfg-remove-inbound-attributes: createTimeStamp", |
| | | "ds-cfg-java-class: org.opends.server.plugins.AttributeCleanupPlugin"); |
| | | |
| | | Set<PluginType> pluginTypes = getPluginTypes(confEntry); |
| | | |
| | | AttributeCleanupPluginCfg config = |
| | | AdminTestCaseUtils.getConfiguration( |
| | | AttributeCleanupPluginCfgDefn.getInstance(),confEntry); |
| | | |
| | | AttributeCleanupPlugin plugin = new AttributeCleanupPlugin(); |
| | | |
| | | plugin.initializePlugin(pluginTypes, config); |
| | | AttributeCleanupPlugin plugin = initializePlugin(confEntry); |
| | | |
| | | /* Create the ADD operation as follows: |
| | | * |
| | |
| | | "ds-cfg-remove-inbound-attributes: createTimeStamp", |
| | | "ds-cfg-java-class: org.opends.server.plugins.AttributeCleanupPlugin"); |
| | | |
| | | Set<PluginType> pluginTypes = getPluginTypes(confEntry); |
| | | |
| | | AttributeCleanupPluginCfg config = |
| | | AdminTestCaseUtils.getConfiguration( |
| | | AttributeCleanupPluginCfgDefn.getInstance(),confEntry); |
| | | |
| | | AttributeCleanupPlugin plugin = new AttributeCleanupPlugin(); |
| | | |
| | | plugin.initializePlugin(pluginTypes, config); |
| | | AttributeCleanupPlugin plugin = initializePlugin(confEntry); |
| | | |
| | | /* Create the MODIFY request as follows: |
| | | * |
| | |
| | | assertSame(res.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | plugin.finalizePlugin(); |
| | | } |
| | | |
| | | private AttributeCleanupPlugin initializePlugin(Entry confEntry) throws ConfigException, InitializationException { |
| | | return InitializationUtils.initializePlugin( |
| | | new AttributeCleanupPlugin(), confEntry, AttributeCleanupPluginCfgDefn.getInstance()); |
| | | } |
| | | |
| | | private ModifyOperationBasis modify(String entryDN, RawModification... rawMods) |
| | |
| | | "ds-cfg-remove-inbound-attributes: createTimeStamp", |
| | | "ds-cfg-java-class: org.opends.server.plugins.AttributeCleanupPlugin"); |
| | | |
| | | Set<PluginType> pluginTypes = getPluginTypes(confEntry); |
| | | |
| | | AttributeCleanupPluginCfg config = |
| | | AdminTestCaseUtils.getConfiguration( |
| | | AttributeCleanupPluginCfgDefn.getInstance(),confEntry); |
| | | |
| | | AttributeCleanupPlugin plugin = new AttributeCleanupPlugin(); |
| | | |
| | | plugin.initializePlugin(pluginTypes, config); |
| | | AttributeCleanupPlugin plugin = initializePlugin(confEntry); |
| | | |
| | | /* Create the MODIFY operation as follows: |
| | | * |
| | |
| | | "ds-cfg-rename-inbound-attributes: modifyTimeStamp:description", |
| | | "ds-cfg-java-class: org.opends.server.plugins.AttributeCleanupPlugin"); |
| | | |
| | | Set<PluginType> pluginTypes = getPluginTypes(confEntry); |
| | | |
| | | AttributeCleanupPluginCfg config = |
| | | AdminTestCaseUtils.getConfiguration( |
| | | AttributeCleanupPluginCfgDefn.getInstance(),confEntry); |
| | | |
| | | AttributeCleanupPlugin plugin = new AttributeCleanupPlugin(); |
| | | |
| | | plugin.initializePlugin(pluginTypes, config); |
| | | AttributeCleanupPlugin plugin = initializePlugin(confEntry); |
| | | |
| | | /* Create the MODIFY operation as follows: |
| | | * |
| | |
| | | |
| | | import java.io.ByteArrayInputStream; |
| | | import java.util.ArrayList; |
| | | import java.util.HashSet; |
| | | import java.util.List; |
| | | import java.util.UUID; |
| | | |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.opends.server.TestCaseUtils; |
| | | import org.forgerock.opendj.config.server.AdminTestCaseUtils; |
| | | import org.forgerock.opendj.server.config.meta.EntryUUIDPluginCfgDefn; |
| | | import org.forgerock.opendj.server.config.server.EntryUUIDPluginCfg; |
| | | import org.opends.server.api.plugin.PluginType; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.extensions.InitializationUtils; |
| | | import org.forgerock.opendj.ldap.schema.AttributeType; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.opends.server.types.Entry; |
| | | import org.opends.server.types.InitializationException; |
| | | import org.opends.server.types.LDIFImportConfig; |
| | | import org.testng.annotations.BeforeClass; |
| | | import org.testng.annotations.DataProvider; |
| | |
| | | public void testInitializeWithValidConfigs(Entry e) |
| | | throws Exception |
| | | { |
| | | HashSet<PluginType> pluginTypes = TestCaseUtils.getPluginTypes(e); |
| | | |
| | | EntryUUIDPluginCfg configuration = |
| | | AdminTestCaseUtils.getConfiguration( |
| | | EntryUUIDPluginCfgDefn.getInstance(), e); |
| | | |
| | | EntryUUIDPlugin plugin = new EntryUUIDPlugin(); |
| | | plugin.initializePlugin(pluginTypes, configuration); |
| | | EntryUUIDPlugin plugin = initializePlugin(e); |
| | | plugin.finalizePlugin(); |
| | | } |
| | | |
| | |
| | | AttributeType entryUUIDType = DirectoryServer.getAttributeType("entryuuid"); |
| | | DirectoryServer.deregisterAttributeType(entryUUIDType); |
| | | |
| | | HashSet<PluginType> pluginTypes = TestCaseUtils.getPluginTypes(e); |
| | | |
| | | EntryUUIDPluginCfg configuration = |
| | | AdminTestCaseUtils.getConfiguration( |
| | | EntryUUIDPluginCfgDefn.getInstance(), e); |
| | | |
| | | EntryUUIDPlugin plugin = new EntryUUIDPlugin(); |
| | | plugin.initializePlugin(pluginTypes, configuration); |
| | | EntryUUIDPlugin plugin = initializePlugin(e); |
| | | plugin.finalizePlugin(); |
| | | |
| | | |
| | |
| | | public void testInitializeWithInvalidConfigs(Entry e) |
| | | throws Exception |
| | | { |
| | | HashSet<PluginType> pluginTypes = TestCaseUtils.getPluginTypes(e); |
| | | |
| | | EntryUUIDPluginCfg configuration = |
| | | AdminTestCaseUtils.getConfiguration( |
| | | EntryUUIDPluginCfgDefn.getInstance(), e); |
| | | |
| | | EntryUUIDPlugin plugin = new EntryUUIDPlugin(); |
| | | plugin.initializePlugin(pluginTypes, configuration); |
| | | initializePlugin(e); |
| | | } |
| | | |
| | | |
| | | private EntryUUIDPlugin initializePlugin(Entry e) throws ConfigException, InitializationException { |
| | | return InitializationUtils.initializePlugin(new EntryUUIDPlugin(), e, EntryUUIDPluginCfgDefn.getInstance()); |
| | | } |
| | | |
| | | /** |
| | | * Tests the <CODE>doLDIFImport</CODE> method. |
| | |
| | | import static org.testng.Assert.*; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.HashSet; |
| | | import java.util.List; |
| | | |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.forgerock.opendj.ldap.SearchScope; |
| | | import org.opends.server.TestCaseUtils; |
| | | import org.forgerock.opendj.config.server.AdminTestCaseUtils; |
| | | import org.forgerock.opendj.server.config.meta.LDAPAttributeDescriptionListPluginCfgDefn; |
| | | import org.forgerock.opendj.server.config.server.LDAPAttributeDescriptionListPluginCfg; |
| | | import org.opends.server.api.plugin.PluginType; |
| | | import org.opends.server.extensions.InitializationUtils; |
| | | import org.opends.server.protocols.internal.InternalSearchOperation; |
| | | import org.opends.server.protocols.internal.SearchRequest; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.opends.server.types.Entry; |
| | | import org.opends.server.types.InitializationException; |
| | | import org.testng.annotations.BeforeClass; |
| | | import org.testng.annotations.DataProvider; |
| | | import org.testng.annotations.Test; |
| | |
| | | public void testInitializeWithValidConfigs(Entry e) |
| | | throws Exception |
| | | { |
| | | HashSet<PluginType> pluginTypes = TestCaseUtils.getPluginTypes(e); |
| | | |
| | | LDAPAttributeDescriptionListPluginCfg configuration = |
| | | AdminTestCaseUtils.getConfiguration( |
| | | LDAPAttributeDescriptionListPluginCfgDefn.getInstance(), e); |
| | | |
| | | LDAPADListPlugin plugin = new LDAPADListPlugin(); |
| | | plugin.initializePlugin(pluginTypes, configuration); |
| | | LDAPADListPlugin plugin = initializePlugin0(e); |
| | | plugin.finalizePlugin(); |
| | | } |
| | | |
| | |
| | | public void testInitializeWithInvalidConfigs(Entry e) |
| | | throws Exception |
| | | { |
| | | HashSet<PluginType> pluginTypes = TestCaseUtils.getPluginTypes(e); |
| | | |
| | | LDAPAttributeDescriptionListPluginCfg configuration = |
| | | AdminTestCaseUtils.getConfiguration( |
| | | LDAPAttributeDescriptionListPluginCfgDefn.getInstance(), e); |
| | | |
| | | LDAPADListPlugin plugin = new LDAPADListPlugin(); |
| | | plugin.initializePlugin(pluginTypes, configuration); |
| | | LDAPADListPlugin plugin = initializePlugin0(e); |
| | | plugin.finalizePlugin(); |
| | | } |
| | | |
| | | |
| | | |
| | | private LDAPADListPlugin initializePlugin0(Entry e) throws ConfigException, InitializationException { |
| | | return InitializationUtils.initializePlugin( |
| | | new LDAPADListPlugin(), e, LDAPAttributeDescriptionListPluginCfgDefn.getInstance()); |
| | | } |
| | | |
| | | /** |
| | | * Tests the <CODE>doPreParseSearch</CODE> method with an empty attribute |
| | |
| | | import static org.testng.Assert.*; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.HashSet; |
| | | import java.util.List; |
| | | |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.forgerock.opendj.ldap.ModificationType; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.opends.server.TestCaseUtils; |
| | | import org.forgerock.opendj.config.server.AdminTestCaseUtils; |
| | | import org.forgerock.opendj.server.config.meta.LastModPluginCfgDefn; |
| | | import org.forgerock.opendj.server.config.server.LastModPluginCfg; |
| | | import org.opends.server.api.plugin.PluginType; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.core.ModifyDNOperation; |
| | | import org.opends.server.core.ModifyOperation; |
| | | import org.opends.server.extensions.InitializationUtils; |
| | | import org.opends.server.protocols.internal.InternalClientConnection; |
| | | import org.forgerock.opendj.ldap.schema.AttributeType; |
| | | import org.opends.server.types.Attributes; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.opends.server.types.DirectoryConfig; |
| | | import org.opends.server.types.Entry; |
| | | import org.opends.server.types.InitializationException; |
| | | import org.opends.server.types.Modification; |
| | | import org.forgerock.opendj.ldap.RDN; |
| | | import org.testng.annotations.BeforeClass; |
| | |
| | | public void testInitializeWithValidConfigs(Entry e) |
| | | throws Exception |
| | | { |
| | | HashSet<PluginType> pluginTypes = TestCaseUtils.getPluginTypes(e); |
| | | |
| | | LastModPluginCfg configuration = |
| | | AdminTestCaseUtils.getConfiguration( |
| | | LastModPluginCfgDefn.getInstance(), e); |
| | | |
| | | LastModPlugin plugin = new LastModPlugin(); |
| | | plugin.initializePlugin(pluginTypes, configuration); |
| | | LastModPlugin plugin = pp(e); |
| | | plugin.finalizePlugin(); |
| | | } |
| | | |
| | | |
| | | private LastModPlugin pp(Entry e) throws ConfigException, InitializationException { |
| | | return InitializationUtils.initializePlugin(new LastModPlugin(), e, LastModPluginCfgDefn.getInstance()); |
| | | } |
| | | |
| | | /** |
| | | * Tests the process of initializing the server with valid configurations but |
| | |
| | | DirectoryServer.deregisterAttributeType(mnType); |
| | | |
| | | |
| | | HashSet<PluginType> pluginTypes = TestCaseUtils.getPluginTypes(e); |
| | | |
| | | LastModPluginCfg configuration = |
| | | AdminTestCaseUtils.getConfiguration( |
| | | LastModPluginCfgDefn.getInstance(), e); |
| | | |
| | | LastModPlugin plugin = new LastModPlugin(); |
| | | plugin.initializePlugin(pluginTypes, configuration); |
| | | LastModPlugin plugin = pp(e); |
| | | plugin.finalizePlugin(); |
| | | |
| | | |
| | |
| | | public void testInitializeWithInvalidConfigs(Entry e) |
| | | throws Exception |
| | | { |
| | | HashSet<PluginType> pluginTypes = TestCaseUtils.getPluginTypes(e); |
| | | |
| | | LastModPluginCfg configuration = |
| | | AdminTestCaseUtils.getConfiguration( |
| | | LastModPluginCfgDefn.getInstance(), e); |
| | | |
| | | LastModPlugin plugin = new LastModPlugin(); |
| | | plugin.initializePlugin(pluginTypes, configuration); |
| | | LastModPlugin plugin = pp(e); |
| | | plugin.finalizePlugin(); |
| | | } |
| | | |
| | |
| | | |
| | | import java.io.ByteArrayInputStream; |
| | | import java.util.ArrayList; |
| | | import java.util.HashSet; |
| | | import java.util.List; |
| | | |
| | | import org.opends.server.TestCaseUtils; |
| | | import org.forgerock.opendj.config.server.AdminTestCaseUtils; |
| | | import org.forgerock.opendj.server.config.meta.PasswordPolicyImportPluginCfgDefn; |
| | | import org.forgerock.opendj.server.config.server.PasswordPolicyImportPluginCfg; |
| | | import org.opends.server.api.plugin.PluginType; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.extensions.InitializationUtils; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.opends.server.types.Entry; |
| | | import org.opends.server.types.InitializationException; |
| | | import org.opends.server.types.LDIFImportConfig; |
| | | import org.testng.annotations.BeforeClass; |
| | | import org.testng.annotations.DataProvider; |
| | |
| | | public void testInitializeWithValidConfigs(Entry e) |
| | | throws Exception |
| | | { |
| | | HashSet<PluginType> pluginTypes = TestCaseUtils.getPluginTypes(e); |
| | | |
| | | PasswordPolicyImportPluginCfg configuration = |
| | | AdminTestCaseUtils.getConfiguration( |
| | | PasswordPolicyImportPluginCfgDefn.getInstance(), e); |
| | | |
| | | PasswordPolicyImportPlugin plugin = new PasswordPolicyImportPlugin(); |
| | | plugin.initializePlugin(pluginTypes, configuration); |
| | | PasswordPolicyImportPlugin plugin = initializePlugin(e); |
| | | plugin.finalizePlugin(); |
| | | } |
| | | |
| | | |
| | | private PasswordPolicyImportPlugin initializePlugin(Entry e) throws ConfigException, InitializationException { |
| | | return InitializationUtils.initializePlugin( |
| | | new PasswordPolicyImportPlugin(), e, PasswordPolicyImportPluginCfgDefn.getInstance()); |
| | | } |
| | | |
| | | /** |
| | | * Retrieves a set of invalid configuration entries. |
| | |
| | | public void testInitializeWithInvalidConfigs(Entry e) |
| | | throws Exception |
| | | { |
| | | HashSet<PluginType> pluginTypes = TestCaseUtils.getPluginTypes(e); |
| | | |
| | | PasswordPolicyImportPluginCfg configuration = |
| | | AdminTestCaseUtils.getConfiguration( |
| | | PasswordPolicyImportPluginCfgDefn.getInstance(), e); |
| | | |
| | | PasswordPolicyImportPlugin plugin = new PasswordPolicyImportPlugin(); |
| | | plugin.initializePlugin(pluginTypes, configuration); |
| | | PasswordPolicyImportPlugin plugin = initializePlugin(e); |
| | | plugin.finalizePlugin(); |
| | | } |
| | | |
| | |
| | | */ |
| | | package org.opends.server.plugins; |
| | | |
| | | import java.util.HashSet; |
| | | import java.util.List; |
| | | |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | |
| | | import org.forgerock.opendj.ldap.requests.Requests; |
| | | import org.forgerock.opendj.ldap.schema.AttributeType; |
| | | import org.opends.server.TestCaseUtils; |
| | | import org.forgerock.opendj.config.server.AdminTestCaseUtils; |
| | | import org.forgerock.opendj.server.config.meta.ReferentialIntegrityPluginCfgDefn; |
| | | import org.forgerock.opendj.server.config.server.ReferentialIntegrityPluginCfg; |
| | | import org.opends.server.api.Group; |
| | | import org.opends.server.api.plugin.PluginType; |
| | | import org.opends.server.controls.SubtreeDeleteControl; |
| | | import org.opends.server.core.AddOperation; |
| | | import org.opends.server.core.DeleteOperation; |
| | |
| | | import org.opends.server.core.GroupManager; |
| | | import org.opends.server.core.ModifyDNOperation; |
| | | import org.opends.server.core.ModifyOperation; |
| | | import org.opends.server.extensions.InitializationUtils; |
| | | import org.opends.server.protocols.internal.InternalClientConnection; |
| | | import org.opends.server.protocols.internal.InternalSearchOperation; |
| | | import org.opends.server.protocols.internal.SearchRequest; |
| | | import org.opends.server.types.Control; |
| | | import org.opends.server.types.Entry; |
| | | import org.opends.server.types.InitializationException; |
| | | import org.opends.server.types.SearchResultEntry; |
| | | import org.testng.annotations.AfterClass; |
| | | import org.testng.annotations.BeforeClass; |
| | |
| | | public void testInitializeWithValidConfigs(Entry e) |
| | | throws Exception |
| | | { |
| | | HashSet<PluginType> pluginTypes = TestCaseUtils.getPluginTypes(e); |
| | | ReferentialIntegrityPluginCfg configuration = |
| | | AdminTestCaseUtils.getConfiguration( |
| | | ReferentialIntegrityPluginCfgDefn.getInstance(), e); |
| | | ReferentialIntegrityPlugin plugin = new ReferentialIntegrityPlugin(); |
| | | plugin.initializePlugin(pluginTypes, configuration); |
| | | ReferentialIntegrityPlugin plugin = initializePlugin(e); |
| | | plugin.finalizePlugin(); |
| | | } |
| | | |
| | |
| | | public void testInitializeWithInValidConfigs(Entry e) |
| | | throws Exception |
| | | { |
| | | HashSet<PluginType> pluginTypes = TestCaseUtils.getPluginTypes(e); |
| | | ReferentialIntegrityPluginCfg configuration = |
| | | AdminTestCaseUtils.getConfiguration( |
| | | ReferentialIntegrityPluginCfgDefn.getInstance(), e); |
| | | ReferentialIntegrityPlugin plugin = new ReferentialIntegrityPlugin(); |
| | | plugin.initializePlugin(pluginTypes, configuration); |
| | | ReferentialIntegrityPlugin plugin = initializePlugin(e); |
| | | plugin.finalizePlugin(); |
| | | } |
| | | |
| | | private ReferentialIntegrityPlugin initializePlugin(Entry e) throws ConfigException, InitializationException { |
| | | return InitializationUtils.initializePlugin( |
| | | new ReferentialIntegrityPlugin(), e, ReferentialIntegrityPluginCfgDefn.getInstance()); |
| | | } |
| | | |
| | | /** |
| | | * Ensures that the Directory Server is running. |
| | | * |
| | |
| | | */ |
| | | package org.opends.server.plugins; |
| | | |
| | | import java.util.HashSet; |
| | | import java.util.List; |
| | | |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | |
| | | import org.forgerock.opendj.ldap.requests.ModifyDNRequest; |
| | | import org.forgerock.opendj.ldap.requests.ModifyRequest; |
| | | import org.opends.server.TestCaseUtils; |
| | | import org.forgerock.opendj.config.server.AdminTestCaseUtils; |
| | | import org.forgerock.opendj.server.config.meta.UniqueAttributePluginCfgDefn; |
| | | import org.forgerock.opendj.server.config.server.UniqueAttributePluginCfg; |
| | | import org.opends.server.api.plugin.PluginType; |
| | | import org.opends.server.core.AddOperation; |
| | | import org.opends.server.core.ModifyDNOperation; |
| | | import org.opends.server.core.ModifyOperation; |
| | | import org.opends.server.extensions.InitializationUtils; |
| | | import org.opends.server.types.Attributes; |
| | | import org.opends.server.types.DirectoryException; |
| | | import org.opends.server.types.Entry; |
| | | import org.opends.server.types.InitializationException; |
| | | import org.testng.annotations.AfterClass; |
| | | import org.testng.annotations.BeforeClass; |
| | | import org.testng.annotations.BeforeMethod; |
| | |
| | | public void testInitializeWithValidConfigs(Entry e) |
| | | throws Exception |
| | | { |
| | | HashSet<PluginType> pluginTypes = TestCaseUtils.getPluginTypes(e); |
| | | UniqueAttributePluginCfg configuration = |
| | | AdminTestCaseUtils.getConfiguration( |
| | | UniqueAttributePluginCfgDefn.getInstance(), e); |
| | | |
| | | UniqueAttributePlugin plugin = new UniqueAttributePlugin(); |
| | | plugin.initializePlugin(pluginTypes, configuration); |
| | | UniqueAttributePlugin plugin = initializePlugin(e); |
| | | plugin.finalizePlugin(); |
| | | } |
| | | |
| | |
| | | public void testInitializeWithInvalidConfigs(Entry e) |
| | | throws Exception |
| | | { |
| | | HashSet<PluginType> pluginTypes = TestCaseUtils.getPluginTypes(e); |
| | | UniqueAttributePluginCfg configuration = |
| | | AdminTestCaseUtils.getConfiguration( |
| | | UniqueAttributePluginCfgDefn.getInstance(), e); |
| | | UniqueAttributePlugin plugin = new UniqueAttributePlugin(); |
| | | plugin.initializePlugin(pluginTypes, configuration); |
| | | UniqueAttributePlugin plugin = initializePlugin(e); |
| | | plugin.finalizePlugin(); |
| | | } |
| | | |
| | | private UniqueAttributePlugin initializePlugin(Entry e) throws ConfigException, InitializationException { |
| | | return InitializationUtils.initializePlugin( |
| | | new UniqueAttributePlugin(), e, UniqueAttributePluginCfgDefn.getInstance()); |
| | | } |
| | | |
| | | /** |
| | | * Test modify DN operation with various scenarios. See method comments. |
| | | * |
| | |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.opends.server.TestCaseUtils; |
| | | import org.forgerock.opendj.config.server.AdminTestCaseUtils; |
| | | import org.forgerock.opendj.server.config.meta.JMXConnectionHandlerCfgDefn; |
| | | import org.forgerock.opendj.server.config.server.JMXConnectionHandlerCfg; |
| | | import org.opends.server.config.JMXMBean; |
| | |
| | | import org.opends.server.core.DeleteOperation; |
| | | import org.opends.server.core.DeleteOperationBasis; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.extensions.InitializationUtils; |
| | | import org.opends.server.protocols.internal.InternalClientConnection; |
| | | import org.forgerock.opendj.config.server.ConfigChangeResult; |
| | | import org.forgerock.opendj.ldap.DN; |
| | |
| | | JmxConnectionHandler jmxConnectionHandler = getJmxConnectionHandler(); |
| | | assertNotNull(jmxConnectionHandler); |
| | | |
| | | JMXConnectionHandlerCfg config = AdminTestCaseUtils |
| | | .getConfiguration(JMXConnectionHandlerCfgDefn |
| | | .getInstance(), entry); |
| | | JMXConnectionHandlerCfg config = InitializationUtils.getConfiguration( |
| | | JMXConnectionHandlerCfgDefn.getInstance(), entry); |
| | | |
| | | if (!jmxConnectionHandler.isConfigurationChangeAcceptable(config, |
| | | reasons)) { |
| | |
| | | |
| | | import org.opends.server.DirectoryServerTestCase; |
| | | import org.opends.server.TestCaseUtils; |
| | | import org.forgerock.opendj.config.server.AdminTestCaseUtils; |
| | | import org.forgerock.opendj.server.config.meta.LDAPConnectionHandlerCfgDefn; |
| | | import org.forgerock.opendj.server.config.server.LDAPConnectionHandlerCfg; |
| | | import org.opends.server.core.ServerContext; |
| | | import org.opends.server.extensions.InitializationUtils; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.opends.server.types.Attribute; |
| | | import org.opends.server.types.Attributes; |
| | |
| | | * @throws ConfigException |
| | | * If the configuration entry could not be decoded. |
| | | */ |
| | | static LDAPConnectionHandlerCfg getConfiguration( |
| | | Entry handlerEntry) throws ConfigException { |
| | | return AdminTestCaseUtils.getConfiguration( |
| | | LDAPConnectionHandlerCfgDefn.getInstance(), handlerEntry); |
| | | static LDAPConnectionHandlerCfg getConfiguration(Entry handlerEntry) throws ConfigException { |
| | | return InitializationUtils.getConfiguration(LDAPConnectionHandlerCfgDefn.getInstance(), handlerEntry); |
| | | } |
| | | |
| | | } |
| | |
| | | */ |
| | | package org.opends.server.schema; |
| | | |
| | | import org.forgerock.opendj.config.server.AdminTestCaseUtils; |
| | | import org.forgerock.opendj.server.config.meta.SaltedMD5PasswordStorageSchemeCfgDefn; |
| | | import org.forgerock.opendj.server.config.server.SaltedMD5PasswordStorageSchemeCfg; |
| | | import org.opends.server.types.Entry; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.extensions.InitializationUtils; |
| | | import org.opends.server.extensions.SaltedMD5PasswordStorageScheme; |
| | | import org.forgerock.opendj.ldap.Assertion; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | |
| | | private Object[] generateValues(String password) throws Exception |
| | | { |
| | | ByteString bytePassword = ByteString.valueOfUtf8(password); |
| | | SaltedMD5PasswordStorageScheme scheme = new SaltedMD5PasswordStorageScheme(); |
| | | |
| | | Entry configEntry = |
| | | DirectoryServer.getConfigEntry( |
| | | DN.valueOf("cn=Salted MD5,cn=Password Storage Schemes,cn=config")); |
| | | |
| | | SaltedMD5PasswordStorageSchemeCfg configuration = |
| | | AdminTestCaseUtils.getConfiguration( |
| | | SaltedMD5PasswordStorageSchemeCfgDefn.getInstance(), |
| | | configEntry |
| | | ); |
| | | |
| | | scheme.initializePasswordStorageScheme(configuration); |
| | | SaltedMD5PasswordStorageScheme scheme = InitializationUtils.initializePasswordStorageScheme( |
| | | new SaltedMD5PasswordStorageScheme(), configEntry, SaltedMD5PasswordStorageSchemeCfgDefn.getInstance()); |
| | | |
| | | ByteString encodedAuthPassword = scheme.encodeAuthPassword(bytePassword); |
| | | String[] authPWComponents = AuthPasswordSyntax.decodeAuthPassword(encodedAuthPassword.toString()); |
| | |
| | | */ |
| | | package org.opends.server.schema; |
| | | |
| | | import org.forgerock.opendj.config.server.AdminTestCaseUtils; |
| | | import org.forgerock.opendj.server.config.meta.SaltedMD5PasswordStorageSchemeCfgDefn; |
| | | import org.forgerock.opendj.server.config.server.SaltedMD5PasswordStorageSchemeCfg; |
| | | import org.opends.server.types.Entry; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.extensions.InitializationUtils; |
| | | import org.opends.server.extensions.SaltedMD5PasswordStorageScheme; |
| | | import org.forgerock.opendj.ldap.Assertion; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | |
| | | |
| | | import static org.testng.Assert.*; |
| | | |
| | | |
| | | @SuppressWarnings("javadoc") |
| | | public class UserPasswordEqualityMatchingRuleTest extends SchemaTestCase |
| | | { |
| | |
| | | private Object[] generateValues(String password) throws Exception |
| | | { |
| | | ByteString bytePassword = ByteString.valueOfUtf8(password); |
| | | SaltedMD5PasswordStorageScheme scheme = new SaltedMD5PasswordStorageScheme(); |
| | | |
| | | Entry configEntry = DirectoryServer.getConfigEntry( |
| | | DN.valueOf("cn=Salted MD5,cn=Password Storage Schemes,cn=config")); |
| | | |
| | | SaltedMD5PasswordStorageSchemeCfg configuration = |
| | | AdminTestCaseUtils.getConfiguration( |
| | | SaltedMD5PasswordStorageSchemeCfgDefn.getInstance(), |
| | | configEntry); |
| | | |
| | | scheme.initializePasswordStorageScheme(configuration); |
| | | SaltedMD5PasswordStorageScheme scheme = InitializationUtils.initializePasswordStorageScheme( |
| | | new SaltedMD5PasswordStorageScheme(), configEntry, SaltedMD5PasswordStorageSchemeCfgDefn.getInstance()); |
| | | |
| | | ByteString encodedAuthPassword = |
| | | scheme.encodePasswordWithScheme(bytePassword); |