Skip to content

Commit

Permalink
Add option to use Signature Validation
Browse files Browse the repository at this point in the history
  • Loading branch information
spyrkob committed Sep 3, 2024
1 parent 8bd66a6 commit 7aeb3a1
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<version.org.jboss.galleon>6.0.1.Final</version.org.jboss.galleon>
<version.org.mockito>5.12.0</version.org.mockito>
<version.junit>4.13.2</version.junit>
<version.org.wildfly.channel>1.1.0.Final</version.org.wildfly.channel>
<version.org.wildfly.channel>1.1.1.Final-SNAPSHOT</version.org.wildfly.channel>
<version.assertj>3.26.0</version.assertj>

<version.org.apache.maven.plugins.pmd>3.22.0</version.org.apache.maven.plugins.pmd>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import org.wildfly.channel.Repository;
import org.wildfly.channel.maven.VersionResolverFactory;
import org.wildfly.channel.spi.MavenVersionsResolver;
import org.wildfly.channel.spi.SignatureValidator;
import org.wildfly.channel.version.VersionMatcher;

import java.io.ByteArrayOutputStream;
Expand Down Expand Up @@ -62,11 +63,15 @@ public class ManifestVersionResolver {
* @param system
*/
public ManifestVersionResolver(Path localMavenCache, RepositorySystem system) {
this(localMavenCache, system, null);
}

public ManifestVersionResolver(Path localMavenCache, RepositorySystem system, SignatureValidator signatureValidator) {
Objects.requireNonNull(localMavenCache);
Objects.requireNonNull(system);

final DefaultRepositorySystemSession session = newRepositorySystemSession(system, localMavenCache);
this.resolverFactory = new VersionResolverFactory(system, session);
this.resolverFactory = new VersionResolverFactory(system, session, signatureValidator);
}

// used in tests only
Expand Down Expand Up @@ -96,14 +101,14 @@ public ManifestVersionRecord getCurrentVersions(List<Channel> channels) throws I
final ChannelManifest manifest = ChannelManifestMapper.from(manifestCoordinate.getUrl());
manifestVersionRecord.addManifest(new ManifestVersionRecord.UrlManifest(manifestCoordinate.getUrl().toExternalForm(), hashCode, manifest.getName()));
} else if (manifestCoordinate.getVersion() != null) {
final String description = getManifestDescription(manifestCoordinate, resolverFactory.create(channel.getRepositories()));
final String description = getManifestDescription(manifestCoordinate, resolverFactory.create(channel));
manifestVersionRecord.addManifest(new ManifestVersionRecord.MavenManifest(
manifestCoordinate.getGroupId(),
manifestCoordinate.getArtifactId(),
manifestCoordinate.getVersion(),
description));
} else {
final MavenVersionsResolver mavenVersionsResolver = resolverFactory.create(channel.getRepositories());
final MavenVersionsResolver mavenVersionsResolver = resolverFactory.create(channel);
final Optional<String> latestVersion = VersionMatcher.getLatestVersion(mavenVersionsResolver.getAllVersions(manifestCoordinate.getGroupId(), manifestCoordinate.getArtifactId(),
manifestCoordinate.getExtension(), manifestCoordinate.getClassifier()));
if (latestVersion.isPresent()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ public static void writeChannelsConfiguration(Path channelPath, List<Channel> ch
name = c.getName();
}
return new Channel(c.getSchemaVersion(), name, c.getDescription(), c.getVendor(), c.getRepositories(), c.getManifestCoordinate(),
c.getBlocklistCoordinate(), c.getNoStreamStrategy());
c.getBlocklistCoordinate(), c.getNoStreamStrategy(), c.isGpgCheck(), c.getGpgUrls());
}).collect(Collectors.toList());


Expand Down

0 comments on commit 7aeb3a1

Please sign in to comment.