Skip to content

Commit

Permalink
Commented wrong checks
Browse files Browse the repository at this point in the history
  • Loading branch information
MDeLuise authored and Coduz committed Sep 29, 2022
1 parent 6afb55b commit 1bc5b10
Showing 1 changed file with 17 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -217,22 +217,23 @@ public Credential update(Credential credential)
ArgumentValidator.notNull(credential.getCredentialType(), "credential.credentialType");
ArgumentValidator.notEmptyOrNull(credential.getCredentialKey(), "credential.credentialKey");

// FIXME These check are not correct, since they're applied to an already encrypted password
if (CredentialType.PASSWORD == credential.getCredentialType()) {
// Validate Password length
int minPasswordLength = getMinimumPasswordLength(credential.getScopeId());
if (credential.getCredentialKey().length() < minPasswordLength) {
throw new KapuaPasswordTooShortException(minPasswordLength);
}
if (credential.getCredentialKey().length() > SYSTEM_MAXIMUM_PASSWORD_LENGTH) {
throw new KapuaPasswordTooLongException(SYSTEM_MAXIMUM_PASSWORD_LENGTH);
}

//
// Validate Password regex
ArgumentValidator.match(credential.getCredentialKey(),
CommonsValidationRegex.PASSWORD_REGEXP, "credentialCreator.credentialKey");
}
// FIXME These check are not correct, since they're applied to an already encrypted password.
// Checks are moved temporary to GwtCredentialServiceImpl#update
// if (CredentialType.PASSWORD == credential.getCredentialType()) {
// // Validate Password length
// int minPasswordLength = getMinimumPasswordLength(credential.getScopeId());
// if (credential.getCredentialKey().length() < minPasswordLength) {
// throw new KapuaPasswordTooShortException(minPasswordLength);
// }
// if (credential.getCredentialKey().length() > SYSTEM_MAXIMUM_PASSWORD_LENGTH) {
// throw new KapuaPasswordTooLongException(SYSTEM_MAXIMUM_PASSWORD_LENGTH);
// }
//
// //
// // Validate Password regex
// ArgumentValidator.match(credential.getCredentialKey(),
// CommonsValidationRegex.PASSWORD_REGEXP, "credentialCreator.credentialKey");
// }

//
// Check access
Expand Down

0 comments on commit 1bc5b10

Please sign in to comment.