| | |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Portions Copyright 2006 Sun Microsystems, Inc. |
| | | * Portions Copyright 2006-2007 Sun Microsystems, Inc. |
| | | */ |
| | | package org.opends.server.extensions; |
| | | |
| | |
| | | import org.opends.server.types.ResultCode; |
| | | |
| | | import static org.opends.server.extensions.ExtensionsConstants.*; |
| | | import static org.opends.server.loggers.Debug.*; |
| | | import static org.opends.server.messages.ExtensionsMessages.*; |
| | | import static org.opends.server.messages.MessageHandler.*; |
| | | |
| | |
| | | public class ClearPasswordStorageScheme |
| | | extends PasswordStorageScheme |
| | | { |
| | | /** |
| | | * The fully-qualified name of this class for debugging purposes. |
| | | */ |
| | | private static final String CLASS_NAME = |
| | | "org.opends.server.extensions.ClearPasswordStorageScheme"; |
| | | |
| | | |
| | | |
| | |
| | | { |
| | | super(); |
| | | |
| | | assert debugConstructor(CLASS_NAME); |
| | | } |
| | | |
| | | |
| | |
| | | public void initializePasswordStorageScheme(ConfigEntry configEntry) |
| | | throws ConfigException, InitializationException |
| | | { |
| | | assert debugEnter(CLASS_NAME, "initializePasswordStorageScheme", |
| | | String.valueOf(configEntry)); |
| | | |
| | | // No initialization is required. |
| | | } |
| | |
| | | @Override() |
| | | public String getStorageSchemeName() |
| | | { |
| | | assert debugEnter(CLASS_NAME, "getStorageSchemeName"); |
| | | |
| | | return STORAGE_SCHEME_NAME_CLEAR; |
| | | } |
| | |
| | | public ByteString encodePassword(ByteString plaintext) |
| | | throws DirectoryException |
| | | { |
| | | assert debugEnter(CLASS_NAME, "encodePassword", "ByteString"); |
| | | |
| | | return plaintext.duplicate(); |
| | | } |
| | |
| | | public ByteString encodePasswordWithScheme(ByteString plaintext) |
| | | throws DirectoryException |
| | | { |
| | | assert debugEnter(CLASS_NAME, "encodePasswordWithScheme", "ByteString"); |
| | | |
| | | StringBuilder buffer = new StringBuilder(); |
| | | buffer.append('{'); |
| | |
| | | public boolean passwordMatches(ByteString plaintextPassword, |
| | | ByteString storedPassword) |
| | | { |
| | | assert debugEnter(CLASS_NAME, "passwordMatches", |
| | | String.valueOf(plaintextPassword), |
| | | String.valueOf(storedPassword)); |
| | | |
| | | return Arrays.equals(plaintextPassword.value(), storedPassword.value()); |
| | | } |
| | |
| | | @Override() |
| | | public boolean isReversible() |
| | | { |
| | | assert debugEnter(CLASS_NAME, "isReversible"); |
| | | |
| | | return true; |
| | | } |
| | |
| | | public ByteString getPlaintextValue(ByteString storedPassword) |
| | | throws DirectoryException |
| | | { |
| | | assert debugEnter(CLASS_NAME, "getPlaintextValue", |
| | | String.valueOf(storedPassword)); |
| | | |
| | | return storedPassword.duplicate(); |
| | | } |
| | |
| | | @Override() |
| | | public boolean supportsAuthPasswordSyntax() |
| | | { |
| | | assert debugEnter(CLASS_NAME, "supportsAuthPasswordSyntax"); |
| | | |
| | | // This storage scheme does not support the authentication password syntax. |
| | | return false; |
| | |
| | | public ByteString encodeAuthPassword(ByteString plaintext) |
| | | throws DirectoryException |
| | | { |
| | | assert debugEnter(CLASS_NAME, "encodeAuthPassword", |
| | | String.valueOf(plaintext)); |
| | | |
| | | |
| | | int msgID = MSGID_PWSCHEME_DOES_NOT_SUPPORT_AUTH_PASSWORD; |
| | |
| | | public boolean authPasswordMatches(ByteString plaintextPassword, |
| | | String authInfo, String authValue) |
| | | { |
| | | assert debugEnter(CLASS_NAME, "authPasswordMatches", |
| | | String.valueOf(plaintextPassword), |
| | | String.valueOf(authInfo), String.valueOf(authValue)); |
| | | |
| | | |
| | | // This storage scheme does not support the authentication password syntax. |
| | |
| | | String authValue) |
| | | throws DirectoryException |
| | | { |
| | | assert debugEnter(CLASS_NAME, "getAuthPasswordPlaintextValue", |
| | | String.valueOf(authInfo), String.valueOf(authValue)); |
| | | |
| | | int msgID = MSGID_PWSCHEME_DOES_NOT_SUPPORT_AUTH_PASSWORD; |
| | | String message = getMessage(msgID, getStorageSchemeName()); |
| | |
| | | @Override() |
| | | public boolean isStorageSchemeSecure() |
| | | { |
| | | assert debugEnter(CLASS_NAME, "isStorageSchemeSecure"); |
| | | |
| | | // Clear-text passwords are not obscured in any way. |
| | | return false; |