eirslett / frontend-maven-plugin

"Maven-node-grunt-gulp-npm-node-plugin to end all maven-node-grunt-gulp-npm-plugins." A Maven plugin that downloads/installs Node and NPM locally, runs NPM install, Grunt, Gulp and/or Karma.
Apache License 2.0
4.24k stars 871 forks source link

Allow sef-singed certificates when downloading npm and node #875

Open johnny-the-coder opened 4 years ago

johnny-the-coder commented 4 years ago

Do you want to request a feature or report a bug? feature

What is the current behavior? Goal: install-node-and-npm Could not download artifacts (node and npm) from custom location due to missing certificates. Error message:

sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

What is the expected behavior? Please add a configuration parameter to goal install-node-and-npm to be able to skip ssl validation. I guess changes have to made in class FileDownloader: https://github.com/eirslett/frontend-maven-plugin/blob/master/frontend-plugin-core/src/main/java/com/github/eirslett/maven/plugins/frontend/lib/FileDownloader.java

Following code creates HttpClient that can handle self-singed certificates:

SSLContextBuilder sslContextBuilder = new SSLContextBuilder();
sslContextBuilder.loadTrustMaterial(null, new TrustSelfSignedStrategy());
SSLConnectionSocketFactory sslConSocketFactory = new SSLConnectionSocketFactory(sslContextBuilder.build());
HttpClients.custom().setSSLSocketFactory(sslConSocketFactory).build();

Please mention your frontend-maven-plugin and operating system version. 1.8.0 Windows 7

tomashm commented 3 years ago

https://issues.apache.org/jira/browse/HTTPCLIENT-1128