From 3883d2297c3422d8aec2b40530c2d2b0a00ee57d Mon Sep 17 00:00:00 2001
From: Matthew Swift <matthew.swift@forgerock.com>
Date: Thu, 25 Aug 2011 16:27:28 +0000
Subject: [PATCH] Final refactoring work for OPENDJ-262: Implement pass through authentication (PTA)
---
opends/src/server/org/opends/server/extensions/PasswordPolicyStateExtendedOperation.java | 21 ++++++++++++++++-----
1 files changed, 16 insertions(+), 5 deletions(-)
diff --git a/opends/src/server/org/opends/server/extensions/PasswordPolicyStateExtendedOperation.java b/opends/src/server/org/opends/server/extensions/PasswordPolicyStateExtendedOperation.java
index ff12942..3ea552b 100644
--- a/opends/src/server/org/opends/server/extensions/PasswordPolicyStateExtendedOperation.java
+++ b/opends/src/server/org/opends/server/extensions/PasswordPolicyStateExtendedOperation.java
@@ -37,6 +37,7 @@
import org.opends.messages.Message;
import org.opends.server.admin.std.server.
PasswordPolicyStateExtendedOperationHandlerCfg;
+import org.opends.server.api.AuthenticationPolicy;
import org.opends.server.api.ClientConnection;
import org.opends.server.api.ExtendedOperationHandler;
import org.opends.server.config.ConfigException;
@@ -600,11 +601,19 @@
}
// Get the password policy state for the user entry.
PasswordPolicyState pwpState;
- PasswordPolicy policy;
try
{
- pwpState = new PasswordPolicyState(userEntry, false);
- policy = pwpState.getPolicy();
+ AuthenticationPolicy policy = AuthenticationPolicy.forUser(userEntry,
+ false);
+ if (!policy.isPasswordPolicy())
+ {
+ operation.setResultCode(ResultCode.UNWILLING_TO_PERFORM);
+ operation.appendErrorMessage(ERR_EXTOP_PWPSTATE_ACCOUNT_NOT_LOCAL
+ .get(String.valueOf(userEntry)));
+ return;
+ }
+ pwpState = (PasswordPolicyState) policy
+ .createAuthenticationPolicyState(userEntry);
}
catch (DirectoryException de)
{
@@ -617,6 +626,7 @@
return;
}
+ PasswordPolicy policy = pwpState.getAuthenticationPolicy();
isAccountSetDisabled = false;
isAccountSetEnabled = false;
// Create a hash set that will be used to hold the types of the return
@@ -708,8 +718,9 @@
// And it's updated password policy state
try
{
- pwpState = new PasswordPolicyState(userEntry, false);
- policy = pwpState.getPolicy();
+ // We should not need to re-fetch the password policy.
+ pwpState = (PasswordPolicyState) policy
+ .createAuthenticationPolicyState(userEntry);
}
catch (DirectoryException de)
{
--
Gitblit v1.10.0