From 61b9eb1be03fc03a9f4bb0013a08ff44a1059503 Mon Sep 17 00:00:00 2001
From: Jean-Noël Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Wed, 20 Apr 2016 14:25:46 +0000
Subject: [PATCH] opendj-server-legacy: added @Override + Autorefactor'ed comments
---
opendj-server-legacy/src/main/java/org/opends/server/extensions/SaltedMD5PasswordStorageScheme.java | 62 +------------------------------
1 files changed, 2 insertions(+), 60 deletions(-)
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/extensions/SaltedMD5PasswordStorageScheme.java b/opendj-server-legacy/src/main/java/org/opends/server/extensions/SaltedMD5PasswordStorageScheme.java
index 7e7dd34..794e991 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/extensions/SaltedMD5PasswordStorageScheme.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/extensions/SaltedMD5PasswordStorageScheme.java
@@ -16,8 +16,6 @@
*/
package org.opends.server.extensions;
-
-
import java.security.MessageDigest;
import java.util.Arrays;
import java.util.Random;
@@ -38,8 +36,6 @@
import static org.opends.server.extensions.ExtensionsConstants.*;
import static org.opends.server.util.StaticUtils.*;
-
-
/**
* This class defines a Directory Server password storage scheme based on the
* MD5 algorithm defined in RFC 1321. This is a one-way digest algorithm so
@@ -56,24 +52,16 @@
{
private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass();
- /**
- * The fully-qualified name of this class.
- */
+ /** The fully-qualified name of this class. */
private static final String CLASS_NAME =
"org.opends.server.extensions.SaltedMD5PasswordStorageScheme";
-
-
- /**
- * The number of bytes of random data to use as the salt when generating the
- * hashes.
- */
+ /** The number of bytes of random data to use as the salt when generating the hashes. */
private static final int NUM_SALT_BYTES = 8;
/** The number of bytes MD5 algorithm produces. */
private static final int MD5_LENGTH = 16;
-
/** The message digest that will actually be used to generate the MD5 hashes. */
private MessageDigest messageDigest;
@@ -83,8 +71,6 @@
/** The secure random number generator to use to generate the salt values. */
private Random random;
-
-
/**
* Creates a new instance of this password storage scheme. Note that no
* initialization should be performed here, as all initialization should be
@@ -95,9 +81,6 @@
super();
}
-
-
- /** {@inheritDoc} */
@Override
public void initializePasswordStorageScheme(
SaltedMD5PasswordStorageSchemeCfg configuration)
@@ -115,23 +98,16 @@
throw new InitializationException(message, e);
}
-
digestLock = new Object();
random = new Random();
}
-
-
- /** {@inheritDoc} */
@Override
public String getStorageSchemeName()
{
return STORAGE_SCHEME_NAME_SALTED_MD5;
}
-
-
- /** {@inheritDoc} */
@Override
public ByteString encodePassword(ByteSequence plaintext)
throws DirectoryException
@@ -181,9 +157,6 @@
return ByteString.valueOfUtf8(Base64.encode(hashPlusSalt));
}
-
-
- /** {@inheritDoc} */
@Override
public ByteString encodePasswordWithScheme(ByteSequence plaintext)
throws DirectoryException
@@ -239,9 +212,6 @@
return ByteString.valueOfUtf8(buffer);
}
-
-
- /** {@inheritDoc} */
@Override
public boolean passwordMatches(ByteSequence plaintextPassword,
ByteSequence storedPassword)
@@ -272,7 +242,6 @@
return false;
}
-
// Use the salt to generate a digest based on the provided plain-text value.
int plainBytesLength = plaintextPassword.length();
byte[] plainPlusSalt = new byte[plainBytesLength + saltLength];
@@ -303,9 +272,6 @@
return Arrays.equals(digestBytes, userDigestBytes);
}
-
-
- /** {@inheritDoc} */
@Override
public boolean supportsAuthPasswordSyntax()
{
@@ -313,18 +279,12 @@
return true;
}
-
-
- /** {@inheritDoc} */
@Override
public String getAuthPasswordSchemeName()
{
return AUTH_PASSWORD_SCHEME_NAME_SALTED_MD5;
}
-
-
- /** {@inheritDoc} */
@Override
public ByteString encodeAuthPassword(ByteSequence plaintext)
throws DirectoryException
@@ -364,7 +324,6 @@
}
}
-
// Encode and return the value.
StringBuilder authPWValue = new StringBuilder();
authPWValue.append(AUTH_PASSWORD_SCHEME_NAME_SALTED_MD5);
@@ -376,9 +335,6 @@
return ByteString.valueOfUtf8(authPWValue);
}
-
-
- /** {@inheritDoc} */
@Override
public boolean authPasswordMatches(ByteSequence plaintextPassword,
String authInfo, String authValue)
@@ -397,7 +353,6 @@
return false;
}
-
int plainBytesLength = plaintextPassword.length();
byte[] plainPlusSaltBytes = new byte[plainBytesLength + saltBytes.length];
plaintextPassword.copyTo(plainPlusSaltBytes);
@@ -418,18 +373,12 @@
}
}
-
-
- /** {@inheritDoc} */
@Override
public boolean isReversible()
{
return false;
}
-
-
- /** {@inheritDoc} */
@Override
public ByteString getPlaintextValue(ByteSequence storedPassword)
throws DirectoryException
@@ -439,9 +388,6 @@
throw new DirectoryException(ResultCode.CONSTRAINT_VIOLATION, message);
}
-
-
- /** {@inheritDoc} */
@Override
public ByteString getAuthPasswordPlaintextValue(String authInfo,
String authValue)
@@ -452,9 +398,6 @@
throw new DirectoryException(ResultCode.CONSTRAINT_VIOLATION, message);
}
-
-
- /** {@inheritDoc} */
@Override
public boolean isStorageSchemeSecure()
{
@@ -462,4 +405,3 @@
return true;
}
}
-
--
Gitblit v1.10.0