Skip to content
This repository was archived by the owner on Nov 22, 2023. It is now read-only.

Commit 8b0ddce

Browse files
Jesse Peircembyczkowski
authored andcommitted
Fix Javadocs to pass Maven release standards
1 parent 6af62f6 commit 8b0ddce

32 files changed

+359
-312
lines changed

server/src/main/java/keywhiz/auth/UserAuthenticatorFactory.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@
2828
public interface UserAuthenticatorFactory extends Discoverable {
2929
/**
3030
* Builds an authenticator from username/password credentials to a {@link User}.
31+
* @param dslContext context for the credential storage
32+
* @return an authenticator from credentials to a user
3133
*/
3234
Authenticator<BasicCredentials, User> build(DSLContext dslContext);
3335
}

server/src/main/java/keywhiz/auth/bcrypt/BcryptAuthenticator.java

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,21 @@ public BcryptAuthenticator(UserDAO userDAO) {
5656
return Optional.ofNullable(user);
5757
}
5858

59-
/** Hash a password in a way compatible with this authenticator */
59+
/**
60+
* Hash a password in a way compatible with this authenticator
61+
* @param password a password to be checked
62+
* @return the hash of this password
63+
*/
6064
public static String hashPassword(String password) {
6165
return BCrypt.hashpw(password, BCrypt.gensalt());
6266
}
6367

64-
/** Constant-time password check */
68+
/**
69+
* Constant-time password check
70+
* @param password a password to be checked
71+
* @param hash a hash which may match the output of hashPassword for this password
72+
* @return whether the password matches the hash
73+
*/
6574
private static boolean checkPassword(String password, Optional<String> hash) {
6675
// We want to check the password in constant time, to avoid leaking information about whether
6776
// a user is present in the database. In order to do this we pass a fake bcrypt hash into the

server/src/main/java/keywhiz/auth/mutualssl/CertificatePrincipal.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public Instant getCertificateExpiration() {
4444
}
4545

4646
/**
47-
* @return string which should be a valid {@link sun.security.x509.X500Name}.
47+
* @return string which should be a valid sun.security.x509.X500Name.
4848
*/
4949
@Override
5050
public String getName() {

server/src/main/java/keywhiz/service/config/KeyStoreConfig.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ public abstract class KeyStoreConfig {
5353
* If the path does not exist on the filesystem, it is resolved as a resource.
5454
*
5555
* @return InputStream to the keystore at the resolved path
56+
* @throws IOException if the path cannot be opened
5657
*/
5758
public InputStream openPath() throws IOException {
5859
Path filePath = Paths.get(path());

server/src/main/java/keywhiz/service/crypto/RowHmacGenerator.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ public String computeRowHmac(String table, List<Object> fields) {
4040
* The random long generated with random.nextLong only uses 48 bits of randomness,
4141
* meaning it will not return all possible long values. Instead we generate a long from 8
4242
* random bytes.
43+
*
44+
* @return a randomly generated long
4345
*/
4446
public long getNextLongSecure() {
4547
byte[] generateIdBytes = new byte[8];

server/src/main/java/keywhiz/service/crypto/SecretTransformer.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ public class SecretTransformer {
3636

3737
/**
3838
* Transform DB content to a Secret model.
39+
* @param seriesAndContent a secret series and secret contents as stored in the database
40+
* @return the same information restructured as a Secret
3941
*/
4042
public Secret transform(SecretSeriesAndContent seriesAndContent) {
4143
checkNotNull(seriesAndContent);

server/src/main/java/keywhiz/service/daos/AclDAO.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -515,6 +515,7 @@ protected ImmutableSet<SecretSeries> getSecretSeriesFor(Configuration configurat
515515
}
516516

517517
/**
518+
* @param configuration database information
518519
* @param client client to access secrets
519520
* @param secretName name of SecretSeries
520521
* @return Optional.absent() when secret unauthorized or not found.

server/src/main/java/keywhiz/service/daos/DAOFactory.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,18 +27,19 @@
2727
*/
2828
public interface DAOFactory<T> {
2929
/**
30-
* Returns DAO using a read/write database connection.
30+
* @return DAO using a read/write database connection.
3131
*/
3232
T readwrite();
3333

3434
/**
35-
* Returns DAO using a read-only database connection.
35+
* @return DAO using a read-only database connection.
3636
*/
3737
T readonly();
3838

3939
/**
40-
* Returns DAO using a supplied jOOQ configuration. Useful for issuing queries on the same
41-
* underlying transaction from a different DAO.
40+
* Useful for issuing queries on the same underlying transaction from a different DAO.
41+
* @param configuration a jOOQ configuration
42+
* @return DAO using the supplied jOOQ configuration.
4243
*/
4344
T using(Configuration configuration);
4445
}

server/src/main/java/keywhiz/service/daos/SecretContentDAO.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,8 @@ public long createSecretContent(long secretId, String encryptedContent, String h
109109
* Prune old secret contents from the database, for the given secret id. Whenever a new secret
110110
* content entry is added for a secret series, we check the database for really old content
111111
* entries and clean them out to prevent the database from growing too large.
112+
*
113+
* @param secretId the ID whose old secret contents should be removed
112114
*/
113115
@VisibleForTesting void pruneOldContents(long secretId) {
114116
// Fetch current version number
@@ -191,7 +193,7 @@ public Optional<ImmutableList<SecretContent>> getSecretVersionsBySecretId(long i
191193
*
192194
* @param ids IDs in the `secrets` table; `secrets_contents` records linked to these by
193195
* `secrets_content.secretid` will be PERMANENTLY REMOVED
194-
* @returns the number of records which were removed
196+
* @return the number of records which were removed
195197
*/
196198
public long dangerPermanentlyRemoveRecordsForGivenSecretsIDs(List<Long> ids) {
197199
return dslContext.deleteFrom(SECRETS_CONTENT)

server/src/main/java/keywhiz/service/daos/SecretDAO.java

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,16 @@ public Optional<SecretSeriesAndContent> getSecretByName(String name) {
283283
return Optional.empty();
284284
}
285285

286-
/** @return list of secrets. can limit/sort by expiry, and for group if given */
286+
/**
287+
* @param expireMaxTime the maximum expiration date for secrets to return (exclusive)
288+
* @param group the group secrets returned must be assigned to
289+
* @param expireMinTime the minimum expiration date for secrets to return (inclusive)
290+
* @param minName the minimum name (alphabetically) that will be returned for secrets
291+
* expiring on expireMinTime (inclusive)
292+
* @param limit the maximum number of secrets to return
293+
* which to start the list of returned secrets
294+
* @return list of secrets. can limit/sort by expiry, and for group if given
295+
*/
287296
public ImmutableList<SecretSeriesAndContent> getSecrets(@Nullable Long expireMaxTime,
288297
@Nullable Group group, @Nullable Long expireMinTime, @Nullable String minName,
289298
@Nullable Integer limit) {
@@ -380,6 +389,7 @@ public Optional<ImmutableList<SanitizedSecret>> getSecretVersionsByName(String n
380389
/**
381390
* @param name of secret series for which to reset secret version
382391
* @param versionId The identifier for the desired current version
392+
* @param updater the user to be linked to this update
383393
* @throws NotFoundException if secret not found
384394
*/
385395
public void setCurrentSecretVersionByName(String name, long versionId, String updater) {
@@ -405,17 +415,16 @@ public void deleteSecretsByName(String name) {
405415
}
406416

407417
/**
408-
* Counts the total number of deleted secrets.
418+
* @return the total number of deleted secrets.
409419
*/
410420
public int countDeletedSecrets() {
411421
return secretSeriesDAOFactory.using(dslContext.configuration())
412422
.countDeletedSecretSeries();
413423
}
414424

415425
/**
416-
* Counts the number of secrets deleted before the specified cutoff.
417-
*
418426
* @param deleteBefore the cutoff date; secrets deleted before this date will be counted
427+
* @return the number of secrets deleted before the specified cutoff.
419428
*/
420429
public int countSecretsDeletedBeforeDate(DateTime deleteBefore) {
421430
checkArgument(deleteBefore != null);
@@ -436,6 +445,7 @@ public int countSecretsDeletedBeforeDate(DateTime deleteBefore) {
436445
* @param deletedBefore the cutoff date; secrets deleted before this date will be removed from the
437446
* database
438447
* @param sleepMillis how many milliseconds to sleep between each batch of removals
448+
* @throws InterruptedException if interrupted while sleeping between batches
439449
*/
440450
public void dangerPermanentlyRemoveSecretsDeletedBeforeDate(DateTime deletedBefore,
441451
int sleepMillis) throws InterruptedException {

0 commit comments

Comments
 (0)