1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.maven.settings.crypto;
20
21 import java.util.Map;
22 import javax.inject.Inject;
23 import javax.inject.Named;
24 import javax.inject.Provider;
25 import javax.inject.Singleton;
26 import org.sonatype.plexus.components.cipher.PlexusCipher;
27 import org.sonatype.plexus.components.sec.dispatcher.DefaultSecDispatcher;
28 import org.sonatype.plexus.components.sec.dispatcher.PasswordDecryptor;
29 import org.sonatype.plexus.components.sec.dispatcher.SecDispatcher;
30
31 @Named("maven")
32 @Singleton
33 public final class MavenSecDispatcherProvider implements Provider<SecDispatcher> {
34 private final SecDispatcher secDispatcher;
35
36 @Inject
37 public MavenSecDispatcherProvider(
38 final PlexusCipher plexusCipher, final Map<String, PasswordDecryptor> decryptors) {
39 this.secDispatcher = new DefaultSecDispatcher(plexusCipher, decryptors, "~/.m2/settings-security.xml");
40 }
41
42 @Override
43 public SecDispatcher get() {
44 return secDispatcher;
45 }
46 }