I'm trying to get a Java security policy right. My code needs to resolve and connect to both login.salesforce.com
and xx99.salesforce.com
where xx99
can take any of about 100 different values.
It works if I hardcode specific hosts - e.g.
permission java.net.SocketPermission "login.salesforce.com:443", "connect, resolve";
permission java.net.SocketPermission "na30.salesforce.com:443", "connect, resolve";
But this would lead to me adding about 100 entries to my security policy file to cover all the possibilities, and Salesforce add new instances all the time, making maintenance a nightmare.
It works if I wildcard any host/port:
permission java.net.SocketPermission "*", "connect, resolve";
But the obvious answer fails - this
permission java.net.SocketPermission "*.salesforce.com:443", "connect, resolve";
gives me
2016-03-20 22:19:56,024 [user:*admin] [pipeline:Pipeline1] [thread:preview-pool-1-thread-1] WARN Pipeline - Stage 'com_streamsets_stage_destination_waveanalytics_WaveAnalyticsDTarget_1' initialization error: java.security.AccessControlException: access denied ("java.net.SocketPermission" "login.salesforce.com:443" "connect,resolve")
java.security.AccessControlException: access denied ("java.net.SocketPermission" "login.salesforce.com:443" "connect,resolve")
at java.security.AccessControlContext.checkPermission(AccessControlContext.java:472)
at java.security.AccessController.checkPermission(AccessController.java:884)
at java.lang.SecurityManager.checkPermission(SecurityManager.java:549)
at java.lang.SecurityManager.checkConnect(SecurityManager.java:1051)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:510)
...etc...
Been staring at this for some time now - I just don't get it!