Examples of RepeatedCharactersPasswordValidatorCfg


Examples of org.nasutekds.server.admin.std.server.RepeatedCharactersPasswordValidatorCfg

   */
  @Test(dataProvider = "validConfigs")
  public void testInitializeWithValidConfigs(Entry e)
         throws Exception
  {
    RepeatedCharactersPasswordValidatorCfg configuration =
         AdminTestCaseUtils.getConfiguration(
              RepeatedCharactersPasswordValidatorCfgDefn.getInstance(), e);

    RepeatedCharactersPasswordValidator validator =
         new RepeatedCharactersPasswordValidator();
View Full Code Here

Examples of org.nasutekds.server.admin.std.server.RepeatedCharactersPasswordValidatorCfg

        expectedExceptions = { ConfigException.class,
                               InitializationException.class })
  public void testInitializeWithInvalidConfigs(Entry e)
         throws Exception
  {
    RepeatedCharactersPasswordValidatorCfg configuration =
         AdminTestCaseUtils.getConfiguration(
              RepeatedCharactersPasswordValidatorCfgDefn.getInstance(), e);

    RepeatedCharactersPasswordValidator validator =
         new RepeatedCharactersPasswordValidator();
View Full Code Here

Examples of org.nasutekds.server.admin.std.server.RepeatedCharactersPasswordValidatorCfg

              "RepeatedCharactersPasswordValidator",
         "ds-cfg-enabled: true",
         "ds-cfg-max-consecutive-length: 2",
         "ds-cfg-case-sensitive-validation: false");

    RepeatedCharactersPasswordValidatorCfg configuration =
         AdminTestCaseUtils.getConfiguration(
              RepeatedCharactersPasswordValidatorCfgDefn.getInstance(),
              validatorEntry);

    RepeatedCharactersPasswordValidator validator =
View Full Code Here

Examples of org.nasutekds.server.admin.std.server.RepeatedCharactersPasswordValidatorCfg

              "RepeatedCharactersPasswordValidator",
         "ds-cfg-enabled: true",
         "ds-cfg-max-consecutive-length: 2",
         "ds-cfg-case-sensitive-validation: false");

    RepeatedCharactersPasswordValidatorCfg configuration =
         AdminTestCaseUtils.getConfiguration(
              RepeatedCharactersPasswordValidatorCfgDefn.getInstance(),
              validatorEntry);

    RepeatedCharactersPasswordValidator validator =
View Full Code Here

Examples of org.nasutekds.server.admin.std.server.RepeatedCharactersPasswordValidatorCfg

              "RepeatedCharactersPasswordValidator",
         "ds-cfg-enabled: true",
         "ds-cfg-max-consecutive-length: 2",
         "ds-cfg-case-sensitive-validation: true");

    RepeatedCharactersPasswordValidatorCfg configuration =
         AdminTestCaseUtils.getConfiguration(
              RepeatedCharactersPasswordValidatorCfgDefn.getInstance(),
              validatorEntry);

    RepeatedCharactersPasswordValidator validator =
View Full Code Here

Examples of org.nasutekds.server.admin.std.server.RepeatedCharactersPasswordValidatorCfg

              "RepeatedCharactersPasswordValidator",
         "ds-cfg-enabled: true",
         "ds-cfg-max-consecutive-length: 2",
         "ds-cfg-case-sensitive-validation: false");

    RepeatedCharactersPasswordValidatorCfg configuration =
         AdminTestCaseUtils.getConfiguration(
              RepeatedCharactersPasswordValidatorCfgDefn.getInstance(),
              validatorEntry);

    RepeatedCharactersPasswordValidator validator =
View Full Code Here

Examples of org.nasutekds.server.admin.std.server.RepeatedCharactersPasswordValidatorCfg

              "RepeatedCharactersPasswordValidator",
         "ds-cfg-enabled: true",
         "ds-cfg-max-consecutive-length: 0",
         "ds-cfg-case-sensitive-validation: true");

    RepeatedCharactersPasswordValidatorCfg configuration =
         AdminTestCaseUtils.getConfiguration(
              RepeatedCharactersPasswordValidatorCfgDefn.getInstance(),
              validatorEntry);

    RepeatedCharactersPasswordValidator validator =
View Full Code Here

Examples of org.nasutekds.server.admin.std.server.RepeatedCharactersPasswordValidatorCfg

              "RepeatedCharactersPasswordValidator",
         "ds-cfg-enabled: true",
         "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);

    ByteString password = ByteString.valueOf("aaaaaaaa");
    ArrayList<Modification> mods = new ArrayList<Modification>();
    mods.add(new Modification(ModificationType.REPLACE,
        Attributes.create("userpassword", "aaaaaaaa")));

    InternalClientConnection conn =
         InternalClientConnection.getRootConnection();
    ModifyOperationBasis modifyOperation =
         new ModifyOperationBasis(conn, conn.nextOperationID(),
                             conn.nextMessageID(),
                             new ArrayList<Control>(),
                             DN.decode("uid=test.user,o=test"), mods);

    MessageBuilder invalidReason = new MessageBuilder();
    assertTrue(validator.passwordIsAcceptable(password,
                              new HashSet<ByteString>(0), modifyOperation,
                              userEntry, invalidReason),
               invalidReason.toString());

    Entry updatedValidatorEntry = TestCaseUtils.makeEntry(
         "dn: cn=Repeated Characters,cn=Password Validators,cn=config",
         "objectClass: top",
         "objectClass: ds-cfg-password-validator",
         "objectClass: ds-cfg-repeated-characters-password-validator",
         "cn: Repeated Characters",
         "ds-cfg-java-class: org.nasutekds.server.extensions." +
              "RepeatedCharactersPasswordValidator",
         "ds-cfg-enabled: true",
         "ds-cfg-max-consecutive-length: 2",
         "ds-cfg-case-sensitive-validation: true");

    RepeatedCharactersPasswordValidatorCfg updatedConfiguration =
         AdminTestCaseUtils.getConfiguration(
              RepeatedCharactersPasswordValidatorCfgDefn.getInstance(),
              updatedValidatorEntry);

    ArrayList<Message> unacceptableReasons = new ArrayList<Message>();
View Full Code Here

Examples of org.nasutekds.server.admin.std.server.RepeatedCharactersPasswordValidatorCfg

                                      Operation operation, Entry userEntry,
                                      MessageBuilder invalidReason)
  {
    // Get a handle to the current configuration and see if we need to count
    // the number of repeated characters in the password.
    RepeatedCharactersPasswordValidatorCfg config = currentConfig;
    int maxRepeats = config.getMaxConsecutiveLength();
    if (maxRepeats <= 0)
    {
      // We don't need to check anything, so the password will be acceptable.
      return true;
    }


    // Get the password as a string.  If we should use case-insensitive
    // validation, then convert it to use all lowercase characters.
    String passwordString = newPassword.toString();
    if (! config.isCaseSensitiveValidation())
    {
      passwordString = passwordString.toLowerCase();
    }

View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.