Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support authentication for public / non-internal repositories #2876

Merged
merged 10 commits into from
Nov 14, 2023
Prev Previous commit
Next Next commit
added default value for password in repository update part
Signed-off-by: mehab <[email protected]>
  • Loading branch information
mehab committed Jul 7, 2023
commit 0a479815b1f15b038a645c10520d733d8a2bf877
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;

import static org.dependencytrack.resources.v1.AbstractConfigPropertyResource.ENCRYPTED_PLACEHOLDER;

/**
* JAX-RS resources for processing repositories.
*
Expand Down Expand Up @@ -202,8 +204,8 @@ public Response updateRepository(Repository jsonRepository) {
if (repository != null) {
final String url = StringUtils.trimToNull(jsonRepository.getUrl());
try {
// The password is not passed to the front-end, so it should only be overwritten if it is not null.
final String updatedPassword = jsonRepository.getPassword() != null
// The password is not passed to the front-end, so it should only be overwritten if it is not null or not set to default value coming from ui
final String updatedPassword = jsonRepository.getPassword()!=null && !jsonRepository.getPassword().equals(ENCRYPTED_PLACEHOLDER)
? DataEncryption.encryptAsString(jsonRepository.getPassword())
: repository.getPassword();

Expand Down