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/extensions/PasswordPolicyStateExtendedOperation.java |   31 +++++++++++++++++++++++++++++++
 1 files changed, 31 insertions(+), 0 deletions(-)

diff --git a/opends/src/server/org/opends/server/extensions/PasswordPolicyStateExtendedOperation.java b/opends/src/server/org/opends/server/extensions/PasswordPolicyStateExtendedOperation.java
index a8c6deb..297b64a 100644
--- a/opends/src/server/org/opends/server/extensions/PasswordPolicyStateExtendedOperation.java
+++ b/opends/src/server/org/opends/server/extensions/PasswordPolicyStateExtendedOperation.java
@@ -121,6 +121,8 @@
  *           setPasswordChangedByRequiredTime             (36),
  *           clearPasswordChangedByRequiredTime           (37),
  *           getSecondsUntilRequiredChangeTime            (38),
+ *           getPasswordHistory                           (39),
+ *           clearPasswordHistory                         (40),
  *           ... },
  *      opValues     SEQUENCE OF OCTET STRING OPTIONAL }
  * </PRE>
@@ -420,6 +422,20 @@
 
 
 
+  /**
+   * The enumerated value for the getPasswordHistory operation.
+   */
+  public static final int OP_GET_PASSWORD_HISTORY = 39;
+
+
+
+  /**
+   * The enumerated value for the clearPasswordHistory operation.
+   */
+  public static final int OP_CLEAR_PASSWORD_HISTORY = 40;
+
+
+
   // The set of attributes to request when retrieving a user's entry.
   private LinkedHashSet<String> requestAttributes;
 
@@ -1225,6 +1241,15 @@
             returnTypes.add(OP_GET_SECONDS_UNTIL_REQUIRED_CHANGE_TIME);
             break;
 
+          case OP_GET_PASSWORD_HISTORY:
+            returnTypes.add(OP_GET_PASSWORD_HISTORY);
+            break;
+
+          case OP_CLEAR_PASSWORD_HISTORY:
+            pwpState.clearPasswordHistory();
+            returnTypes.add(OP_GET_PASSWORD_HISTORY);
+            break;
+
           default:
             int msgID = MSGID_PWPSTATE_EXTOP_UNKNOWN_OP_TYPE;
             operation.appendErrorMessage(getMessage(msgID, opType));
@@ -1604,6 +1629,12 @@
                             secondsStr));
     }
 
+    if (returnAll || returnTypes.contains(OP_GET_PASSWORD_HISTORY))
+    {
+      opElements.add(encode(OP_GET_PASSWORD_HISTORY,
+                            pwpState.getPasswordHistoryValues()));
+    }
+
     ArrayList<ASN1Element> responseValueElements =
          new ArrayList<ASN1Element>(2);
     responseValueElements.add(dnString);

--
Gitblit v1.10.0