From 2c7b8d6d8c0c177e8089272140dae66b87852ff7 Mon Sep 17 00:00:00 2001
From: neil_a_wilson <neil_a_wilson@localhost>
Date: Tue, 17 Jul 2007 21:59:32 +0000
Subject: [PATCH] Implement support for password history functionality.  The password history can be maintained either based on the number of previous passwords to remember (e.g., a user cannot re-use any of his/her last five passwords), or the length of time the previous passwords have been retained (e.g., a user cannot re-use any password he/she has had within the last 365 days), or both.

---
 opends/src/server/org/opends/server/core/PasswordPolicy.java |   47 +++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 47 insertions(+), 0 deletions(-)

diff --git a/opends/src/server/org/opends/server/core/PasswordPolicy.java b/opends/src/server/org/opends/server/core/PasswordPolicy.java
index 6e5eb90..37e40a4 100644
--- a/opends/src/server/org/opends/server/core/PasswordPolicy.java
+++ b/opends/src/server/org/opends/server/core/PasswordPolicy.java
@@ -175,6 +175,12 @@
   // The number of grace logins that a user may have.
   private int graceLoginCount = DEFAULT_PWPOLICY_GRACE_LOGIN_COUNT;
 
+  // The number of passwords to keep in the history.
+  private int historyCount = DEFAULT_PWPOLICY_HISTORY_COUNT;
+
+  // The maximum length of time in seconds to keep passwords in the history.
+  private int historyDuration = DEFAULT_PWPOLICY_HISTORY_DURATION;
+
   // The maximum length of time in seconds that an account may remain idle
   // before it is locked out.
   private int idleLockoutInterval = DEFAULT_PWPOLICY_IDLE_LOCKOUT_INTERVAL;
@@ -812,6 +818,11 @@
     this.stateUpdateFailurePolicy = configuration.getStateUpdateFailurePolicy();
 
 
+    // Get the password history count and duration.
+    this.historyCount    = configuration.getPasswordHistoryCount();
+    this.historyDuration = (int) configuration.getPasswordHistoryDuration();
+
+
     /*
      *  Holistic validation.
      */
@@ -1115,6 +1126,34 @@
 
 
   /**
+   * Retrieves the maximum number of previous passwords to maintain in the
+   * password history.
+   *
+   * @return  The maximum number of previous passwords to maintain in the
+   *          password history.
+   */
+  public int getPasswordHistoryCount()
+  {
+    return historyCount;
+  }
+
+
+
+  /**
+   * Retrieves the maximum length of time in seconds that previous passwords
+   * should remain in the password history.
+   *
+   * @return  The maximum length of time in seconds that previous passwords
+   *          should remain in the password history.
+   */
+  public int getPasswordHistoryDuration()
+  {
+    return historyDuration;
+  }
+
+
+
+  /**
    * Indicates whether users with this password policy will be required to
    * authenticate in a secure manner that does not expose their password.
    *
@@ -1739,6 +1778,14 @@
     buffer.append(idleLockoutInterval);
     buffer.append(" seconds");
     buffer.append(EOL);
+
+    buffer.append("History Count:                         ");
+    buffer.append(historyCount);
+    buffer.append(EOL);
+
+    buffer.append("Update Failure Policy:                 ");
+    buffer.append(stateUpdateFailurePolicy.toString());
+    buffer.append(EOL);
   }
 }
 

--
Gitblit v1.10.0