use of org.apache.maven.settings.crypto.SettingsDecrypter in project spring-boot by spring-projects.
the class MavenSettingsReader method createSettingsDecrypter.
private SettingsDecrypter createSettingsDecrypter() {
SettingsDecrypter settingsDecrypter = new DefaultSettingsDecrypter();
setField(DefaultSettingsDecrypter.class, "securityDispatcher", settingsDecrypter, new SpringBootSecDispatcher());
return settingsDecrypter;
}
use of org.apache.maven.settings.crypto.SettingsDecrypter in project maven-plugins by apache.
the class GitHubDownloaderTestCase method testConfigureAuthenticationWithNoServer.
public void testConfigureAuthenticationWithNoServer() throws Exception {
IssueManagement issueManagement = newGitHubIssueManagement();
GitHubDownloader gitHubDownloader = newGitHubDownloader(issueManagement);
Settings settings = new Settings();
Server server = newServer("not-the-right-one");
settings.addServer(server);
SettingsDecrypter decrypter = mock(SettingsDecrypter.class);
SettingsDecryptionResult result = mock(SettingsDecryptionResult.class);
Log log = mock(Log.class);
when(result.getProblems()).thenReturn(Collections.<SettingsProblem>emptyList());
when(result.getServer()).thenReturn(server);
when(decrypter.decrypt(new DefaultSettingsDecryptionRequest(server))).thenReturn(result);
gitHubDownloader.configureAuthentication(decrypter, "github-server", settings, log);
verify(log).warn("Can't find server id [github-server] configured in githubAPIServerId.");
}
use of org.apache.maven.settings.crypto.SettingsDecrypter in project maven-plugins by apache.
the class AbstractDeployMojo method deploy.
private void deploy(final File directory, final Repository repository) throws MojoExecutionException {
// TODO: work on moving this into the deployer like the other deploy methods
final Wagon wagon = getWagon(repository, wagonManager);
try {
configureWagon(wagon, repository.getId(), settings, container, getLog());
} catch (TransferFailedException e) {
throw new MojoExecutionException("Unable to configure Wagon: '" + repository.getProtocol() + "'", e);
}
try {
final ProxyInfo proxyInfo;
if (!isMaven3OrMore()) {
proxyInfo = getProxyInfo(repository, wagonManager);
} else {
try {
SettingsDecrypter settingsDecrypter = container.lookup(SettingsDecrypter.class);
proxyInfo = getProxy(repository, settingsDecrypter);
} catch (ComponentLookupException cle) {
throw new MojoExecutionException("Unable to lookup SettingsDecrypter: " + cle.getMessage(), cle);
}
}
push(directory, repository, wagon, proxyInfo, getLocales(), getDeployModuleDirectory());
if (chmod) {
chmod(wagon, repository, chmodOptions, chmodMode);
}
} finally {
try {
wagon.disconnect();
} catch (ConnectionException e) {
getLog().error("Error disconnecting wagon - ignored", e);
}
}
}
use of org.apache.maven.settings.crypto.SettingsDecrypter in project spring-cloud-function by spring-cloud.
the class MavenSettingsReader method createSettingsDecrypter.
private SettingsDecrypter createSettingsDecrypter() {
SettingsDecrypter settingsDecrypter = new DefaultSettingsDecrypter();
setField(DefaultSettingsDecrypter.class, "securityDispatcher", settingsDecrypter, new SpringBootSecDispatcher());
return settingsDecrypter;
}
use of org.apache.maven.settings.crypto.SettingsDecrypter in project maven-plugins by apache.
the class GitHubDownloaderTestCase method testConfigureAuthenticationWithProblems.
public void testConfigureAuthenticationWithProblems() throws Exception {
IssueManagement issueManagement = newGitHubIssueManagement();
GitHubDownloader gitHubDownloader = newGitHubDownloader(issueManagement);
Settings settings = new Settings();
Server server = newServer("github-server");
settings.addServer(server);
SettingsDecrypter decrypter = mock(SettingsDecrypter.class);
SettingsDecryptionResult result = mock(SettingsDecryptionResult.class);
Log log = mock(Log.class);
when(result.getProblems()).thenReturn(Arrays.<SettingsProblem>asList(new DefaultSettingsProblem("Ups " + server.getId(), Severity.ERROR, null, -1, -1, null)));
when(result.getServer()).thenReturn(server);
when(decrypter.decrypt(any(SettingsDecryptionRequest.class))).thenReturn(result);
gitHubDownloader.configureAuthentication(decrypter, "github-server", settings, log);
verify(log).error("Ups github-server", null);
ArgumentCaptor<SettingsDecryptionRequest> argument = ArgumentCaptor.forClass(SettingsDecryptionRequest.class);
verify(decrypter).decrypt(argument.capture());
List<Server> servers = ((DefaultSettingsDecryptionRequest) argument.getValue()).getServers();
assertEquals(1, servers.size());
assertSame(server, servers.get(0));
}
Aggregations