Reputation: 1370
I am not really sure how to translate this to groovy syntax.
Have checked this differences with java page already.
Thanks!
TrustManager[] trustAllCerts = new TrustManager[] {
new X509TrustManager() {
public java.security.cert.X509Certificate[] getAcceptedIssuers() {
return null;
}
public void checkClientTrusted(X509Certificate[] certs, String authType) { }
public void checkServerTrusted(X509Certificate[] certs, String authType) { }
}
};
Upvotes: 0
Views: 379
Reputation: 171154
The following should work:
import java.security.cert.*
import javax.net.ssl.*
TrustManager[] trustAllCerts = [
[ getAcceptedIssuers: { -> null },
checkClientTrusted: { X509Certificate[] certs, String authType -> },
checkServerTrusted: { X509Certificate[] certs, String authType -> } ] as X509TrustManager
]
Upvotes: 3
Reputation: 37063
in groovy {}
is always a block/closure. You would have to use [ new X509TrustManager() { ... } ]
. If there are problems casting this dash an ... as TrustManager[]
at the end.
Upvotes: 0