Skip to content

Commit

Permalink
Fix #526: Fix incorrect error codes for the header validators
Browse files Browse the repository at this point in the history
  • Loading branch information
petrdvorak committed Sep 7, 2023
1 parent 89192d7 commit 86289fb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,12 @@ public static void validate(PowerAuthSignatureHttpHeader header) throws InvalidP
// Check that version is present
final String version = header.getVersion();
if (version == null || version.isEmpty()) {
throw new InvalidPowerAuthHttpHeaderException("POWER_AUTH_ENCRYPTION_VERSION_EMPTY");
throw new InvalidPowerAuthHttpHeaderException("POWER_AUTH_SIGNATURE_VERSION_EMPTY");
}

// Check that version is correct
if (!ValueTypeValidator.isValidProtocolVersion(version)) {
throw new InvalidPowerAuthHttpHeaderException("POWER_AUTH_ENCRYPTION_VERSION_INVALID");
throw new InvalidPowerAuthHttpHeaderException("POWER_AUTH_SIGNATURE_VERSION_INVALID");
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,12 @@ public static void validate(PowerAuthTokenHttpHeader header) throws InvalidPower
// Check that version is present
final String version = header.getVersion();
if (version == null || version.isEmpty()) {
throw new InvalidPowerAuthHttpHeaderException("POWER_AUTH_ENCRYPTION_VERSION_EMPTY");
throw new InvalidPowerAuthHttpHeaderException("POWER_AUTH_TOKEN_VERSION_EMPTY");
}

// Check that version is correct
if (!ValueTypeValidator.isValidProtocolVersion(version)) {
throw new InvalidPowerAuthHttpHeaderException("POWER_AUTH_ENCRYPTION_VERSION_INVALID");
throw new InvalidPowerAuthHttpHeaderException("POWER_AUTH_TOKEN_VERSION_INVALID");
}

}
Expand Down

0 comments on commit 86289fb

Please sign in to comment.