Skip to content

Commit

Permalink
Proper proper fix
Browse files Browse the repository at this point in the history
  • Loading branch information
cstamas committed Apr 14, 2023
1 parent 1d528a2 commit 11ef38b
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,12 @@
import javax.inject.Named;
import javax.inject.Singleton;

import java.util.Map;
import java.util.Properties;

import org.sonatype.plexus.components.cipher.DefaultPlexusCipher;
import org.sonatype.plexus.components.cipher.PlexusCipher;
import org.sonatype.plexus.components.cipher.PlexusCipherException;
import org.sonatype.plexus.components.sec.dispatcher.DefaultSecDispatcher;
import org.sonatype.plexus.components.sec.dispatcher.PasswordDecryptor;
import org.sonatype.plexus.components.sec.dispatcher.SecDispatcherException;
import org.sonatype.plexus.components.sec.dispatcher.SecUtil;
import org.sonatype.plexus.components.sec.dispatcher.model.SettingsSecurity;
Expand Down Expand Up @@ -57,14 +55,16 @@ private MavenCryptoException(String message, Throwable cause) {
}
}

private final PlexusCipher plexusCipher;

private final DefaultSecDispatcher secDispatcher;
private final PlexusCipher plexusCipher;

@Inject
public MavenCrypto(PlexusCipher plexusCipher, Map<String, PasswordDecryptor> pds) {
public MavenCrypto(DefaultSecDispatcher secDispatcher, PlexusCipher plexusCipher) {
this.secDispatcher = secDispatcher;
this.plexusCipher = plexusCipher;
this.secDispatcher = new DefaultSecDispatcher(this.plexusCipher, pds, "~/.m2/settings-security.xml");

// Adjust the default path (def path != maven path)
this.secDispatcher.setConfigurationFile("~/.m2/settings-security.xml");
}

public String decrypt(String value) throws MavenCryptoException {
Expand Down

0 comments on commit 11ef38b

Please sign in to comment.