Class ArtifactorySearch
- java.lang.Object
-
- org.owasp.dependencycheck.data.artifactory.ArtifactorySearch
-
@ThreadSafe public class ArtifactorySearch extends java.lang.ObjectClass of methods to search Artifactory for hashes and determine Maven GAV from there. Data classes copied from JFrog's artifactory-client-java project.- Author:
- nhenneaux
-
-
Constructor Summary
Constructors Constructor Description ArtifactorySearch(Settings settings)Creates a NexusSearch for the given repository URL.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected booleaninit(com.fasterxml.jackson.core.JsonParser parser)booleanpreflightRequest()Performs a pre-flight request to ensure the Artifactory service is reachable.protected java.util.List<MavenArtifact>processResponse(Dependency dependency, java.net.HttpURLConnection conn)Process the Artifactory response.java.util.List<MavenArtifact>search(Dependency dependency)Searches the configured Central URL for the given hash (MD5, SHA1 and SHA256).
-
-
-
Constructor Detail
-
ArtifactorySearch
public ArtifactorySearch(Settings settings)
Creates a NexusSearch for the given repository URL.- Parameters:
settings- the configured settings
-
-
Method Detail
-
search
public java.util.List<MavenArtifact> search(Dependency dependency) throws java.io.IOException
Searches the configured Central URL for the given hash (MD5, SHA1 and SHA256). If the artifact is found, aMavenArtifactis populated with the GAV.- Parameters:
dependency- the dependency for which to search (search is based on hashes)- Returns:
- the populated Maven GAV.
- Throws:
java.io.FileNotFoundException- if the specified artifact is not foundjava.io.IOException- if it's unable to connect to the specified repository
-
processResponse
protected java.util.List<MavenArtifact> processResponse(Dependency dependency, java.net.HttpURLConnection conn) throws java.io.IOException
Process the Artifactory response.- Parameters:
dependency- the dependencyconn- the HTTP URL Connection- Returns:
- a list of the Maven Artifact information
- Throws:
java.io.IOException- thrown if there is an I/O error
-
init
protected boolean init(com.fasterxml.jackson.core.JsonParser parser) throws java.io.IOException- Throws:
java.io.IOException
-
preflightRequest
public boolean preflightRequest()
Performs a pre-flight request to ensure the Artifactory service is reachable.- Returns:
trueif Artifactory could be reached; otherwisefalse.
-
-