Package org.nasutekds.server.api

Examples of org.nasutekds.server.api.AccountStatusNotificationHandler


        ResultCode.SUCCESS, false, new ArrayList<Message>()
        );

    // Get the configuration entry DN and the associated handler class.
    DN configEntryDN = configuration.dn();
    AccountStatusNotificationHandler handler = notificationHandlers.get(
        configEntryDN
        );

    // If the new configuration has the notification handler disabled,
    // then remove it from the mapping list and clean it.
    if (! configuration.isEnabled())
    {
      if (handler != null)
      {
        uninstallNotificationHandler (configEntryDN);
      }

      return changeResult;
    }

    // At this point, new configuration is enabled...
    // If the current notification handler is already enabled then we
    // don't do anything unless the class has changed in which case we
    // should indicate that administrative action is required.
    String newClassName = configuration.getJavaClass();
    if (handler != null)
    {
      String curClassName = handler.getClass().getName();
      boolean classIsNew = (! newClassName.equals (curClassName));
      if (classIsNew)
      {
        changeResult.setAdminActionRequired (true);
      }
View Full Code Here


   */
  private void uninstallNotificationHandler(
      DN configEntryDN
      )
  {
    AccountStatusNotificationHandler handler =
        notificationHandlers.remove (configEntryDN);
    if (handler != null)
    {
      DirectoryServer.deregisterAccountStatusNotificationHandler (
          configEntryDN
          );
      handler.finalizeStatusNotificationHandler();
    }
  }
View Full Code Here

         throws Exception
  {
    String dnStr = "cn=Error Log Handler,cn=Account Status Notification " +
                        "Handlers,cn=config";
    DN handlerDN = DN.decode(dnStr);
    AccountStatusNotificationHandler handler =
         DirectoryServer.getAccountStatusNotificationHandler(handlerDN);
    assertNotNull(handler);
    assertTrue(handler instanceof ErrorLogAccountStatusNotificationHandler);
  }
View Full Code Here

      "userPassword: password");

    String dnStr = "cn=Error Log Handler,cn=Account Status Notification " +
                        "Handlers,cn=config";
    DN handlerDN = DN.decode(dnStr);
    AccountStatusNotificationHandler handler =
         DirectoryServer.getAccountStatusNotificationHandler(handlerDN);
    assertNotNull(handler);

    Entry userEntry =
               DirectoryServer.getEntry(DN.decode("uid=test.user,o=test"));

    PasswordPolicyState pwPolicyState =
         new PasswordPolicyState(userEntry, false);
    PasswordPolicy policy = pwPolicyState.getPolicy();

    HashMap<AccountStatusNotificationProperty,List<String>>
         notificationProperties =
              new HashMap<AccountStatusNotificationProperty,List<String>>();

    ArrayList<String> propList = new ArrayList<String>(1);
    propList.add(policy.getConfigEntryDN().toString());
    notificationProperties.put(PASSWORD_POLICY_DN, propList);


    if (notificationType == ACCOUNT_TEMPORARILY_LOCKED)
    {
      propList = new ArrayList<String>(1);
      propList.add("300");
      notificationProperties.put(SECONDS_UNTIL_UNLOCK, propList);

      propList = new ArrayList<String>(1);
      propList.add("5 minutes");
      notificationProperties.put(TIME_UNTIL_UNLOCK, propList);

      propList = new ArrayList<String>(1);
      propList.add(new Date(System.currentTimeMillis() + 300000L).toString());
      notificationProperties.put(ACCOUNT_UNLOCK_TIME, propList);
    }
    else if (notificationType == PASSWORD_EXPIRING)
    {
      propList = new ArrayList<String>(1);
      propList.add("86400");
      notificationProperties.put(SECONDS_UNTIL_EXPIRATION, propList);

      propList = new ArrayList<String>(1);
      propList.add("1 day");
      notificationProperties.put(TIME_UNTIL_EXPIRATION, propList);

      propList = new ArrayList<String>(1);
      propList.add(new Date(System.currentTimeMillis() + 86400000L).toString());
      notificationProperties.put(PASSWORD_EXPIRATION_TIME, propList);
    }
    else if ((notificationType == PASSWORD_CHANGED) ||
             (notificationType == PASSWORD_RESET))
    {
      propList = new ArrayList<String>(1);
      propList.add("oldpassword");
      notificationProperties.put(OLD_PASSWORD, propList);

      propList = new ArrayList<String>(1);
      propList.add("newpassword");
      notificationProperties.put(NEW_PASSWORD, propList);
    }


    AccountStatusNotification notification =
         new AccountStatusNotification(notificationType, userEntry,
                                       Message.raw("Test Modification"),
                                       notificationProperties);
    handler.handleStatusNotification(notification);
  }
View Full Code Here

TOP

Related Classes of org.nasutekds.server.api.AccountStatusNotificationHandler

Copyright © 2018 www.massapicom. 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.