Skip to content

Commit

Permalink
fix: trim application certificate before compare
Browse files Browse the repository at this point in the history
  • Loading branch information
a-cordier committed Nov 22, 2024
1 parent bc806d8 commit a5d44f9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -729,8 +729,9 @@ public ApplicationEntity update(
String existingCertificate = applicationToUpdate.getMetadata().get(METADATA_CLIENT_CERTIFICATE);
metadata.put(METADATA_CLIENT_CERTIFICATE, existingCertificate);
String newCertificate = updateApplicationEntity.getSettings().getTls().getClientCertificate();
existingCertificate = existingCertificate != null ? new String(Base64.getDecoder().decode(existingCertificate)) : null;
if (newCertificate != null && !newCertificate.equals(existingCertificate)) {
existingCertificate =
existingCertificate != null ? new String(Base64.getDecoder().decode(existingCertificate)).trim() : null;
if (newCertificate != null && !newCertificate.trim().equals(existingCertificate)) {
throw new ClientCertificateChangeNotAllowedException();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -993,5 +993,6 @@ public void should_not_update_client_id_of_subscriptions_with_null_client_id() t
vVJj7N1kwlzS2KIysLrefl7PUMikuuEopTH6Xmi9obDZfywPoK2LxUdnN3m8KmUe
FPeI4PKEw5AUf97H
-----END CERTIFICATE-----
""";
}

0 comments on commit a5d44f9

Please sign in to comment.