Java.policy and agent, Java Gurus please

Hi!

I have a security problem with an Java agent that need to use proxy authentication with HttpURLConnection.

I receive this message on the java console when agent run on local client :

java.security.AccessControlException: access denied (java.net.NetPermission setDefaultAuthenticator)

the Exception is thrown on this line :

Authenticator.setDefault(new ProxyAuthenticator (proxyUser,proxyPwd));

One way to solve the problem is to edit manualy the file $LOTUS_INSTALL_DIR\lotus\notes\jvm\lib\security\java.policy

by adding the following code:

grant {

permission java.net.NetPermission

"setDefaultAuthenticator";

permission java.net.NetPermission

"requestPasswordAuthentication";

};

This works fine… but I don’t want to modify this file on all clients !

Is there any other solution ?

Because if I test my Java code on my Eclipse framework it works without editing the java.policy.

  • My agent is set to “Allow restricted operations”

  • Manager Access, ECL all operation …

Any Ideas ???

Thanks in advance

Fabian

Click the link below to test the agent, it’s an openntf project called Peanuts Translator, release 1.0.3 :

http://www.peanuts-project.net/iaxes/fabian/web/peanuts.nsf/8e3c39d27bf4c27dc12570a00047a84a/a77fc47a8e4acd65c1257253006b13e6?OpenDocument

Subject: java.policy and agent, Java Gurus please…

Just a thought, but have you tried using Apache’s HTTP Client:HttpClient - HttpClient Features

I haven’t done any authentication with it, so I’m not sure if you will run into the same issue.

WW

Subject: RE: java.policy and agent, Java Gurus please…

thanks !

I will try with HttpClient and give a feedback…

Fabian

Subject: RE: java.policy and agent, Java Gurus please…

I was able to get this to work with HttpClient in a scheduled Notes agent. Very simple.

Subject: RE: java.policy and agent, Java Gurus please…

It works fine with HttpClient, thanks again for the suggestion.

Fabian

a new release of the translator with HttpClient is available on openntf:

http://www.openntf.org/Projects/pmt.nsf/HomeLookup/A384D5B3D83A1EA4862572D400297A2C?OpenDocument

Subject: RE: java.policy and agent, Java Gurus please…

Hi,

I am facing the same issue while running a scheduled agent.

can anyone help me how to use HTTPClient? in client or server? etc,.

Thanks in advance