You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by "Martin Stechert (JIRA)" <xe...@xml.apache.org> on 2004/11/30 20:14:31 UTC
[jira] Created: (XERCESJ-1030) using proxy with (basic-) authentification does not work
using proxy with (basic-) authentification does not work
--------------------------------------------------------
Key: XERCESJ-1030
URL: http://nagoya.apache.org/jira/browse/XERCESJ-1030
Project: Xerces2-J
Type: Bug
Versions: 2.6.2
Environment: proxy with (basic-) authentification, Sun JavaVM 1.4.2, SuSE Linux machine
Reporter: Martin Stechert
I'm validating XML documents against XSD schemas using xerces.
Some Schemas contain import-directives, that point to the internet, e.g. "http://www.w3.org/2001/xml.xsd" imported from a uddi_v2 schema.
I'm using a HTTP proxy that requires (basic-) authentification.
I'm passing appropriate properties to the JavaVM:
- http.proxySet=true
- http.proxyHost=...
- http.proxyPort=...
- http.nonProxyHosts=...
- http.proxyUser=...
- http.proxyPassword=...
Xerces uses the proxy but does not care about the authentification.
As a Workarround I've added some code to XMLEntityManager (method setupCurrentEntity, just after getting the URLConnection, before getting the InputStream):
// workarround: do proxy settings
Properties systemSettings = System.getProperties();
Object myProxyUserObject = systemSettings.get("http.proxyUser");
if (null != myProxyUserObject) {
String myProxyUser = myProxyUserObject.toString();
System.out.println("%%% XMLEntityManager: using proxy user " + myProxyUser + " ...");
String proxyPassword = (systemSettings.get("http.proxyPassword")).toString();
sun.misc.BASE64Encoder encoder = new sun.misc.BASE64Encoder();
String myAuthToken = myProxyUser + ":" + proxyPassword;
String encodedUserPwd = encoder.encode(myAuthToken.getBytes());
connect.setRequestProperty("Proxy-Authorization", "Basic " + encodedUserPwd);
}
Is there a better (standard) way to convince Xerces using proxy authentification?
Is there a chance to get such code in the Xerces distribution?
Regards,
Martin.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://nagoya.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-dev-help@xml.apache.org
[jira] Closed: (XERCESJ-1030) using proxy with (basic-) authentification does not work
Posted by "Ankit Pasricha (JIRA)" <xe...@xml.apache.org>.
[ http://issues.apache.org/jira/browse/XERCESJ-1030?page=history ]
Ankit Pasricha closed XERCESJ-1030:
-----------------------------------
Resolution: Invalid
> using proxy with (basic-) authentification does not work
> --------------------------------------------------------
>
> Key: XERCESJ-1030
> URL: http://issues.apache.org/jira/browse/XERCESJ-1030
> Project: Xerces2-J
> Type: Bug
> Versions: 2.6.2
> Environment: proxy with (basic-) authentification, Sun JavaVM 1.4.2, SuSE Linux machine
> Reporter: Martin Stechert
>
> I'm validating XML documents against XSD schemas using xerces.
> Some Schemas contain import-directives, that point to the internet, e.g. "http://www.w3.org/2001/xml.xsd" imported from a uddi_v2 schema.
> I'm using a HTTP proxy that requires (basic-) authentification.
> I'm passing appropriate properties to the JavaVM:
> - http.proxySet=true
> - http.proxyHost=...
> - http.proxyPort=...
> - http.nonProxyHosts=...
> - http.proxyUser=...
> - http.proxyPassword=...
> Xerces uses the proxy but does not care about the authentification.
> As a Workarround I've added some code to XMLEntityManager (method setupCurrentEntity, just after getting the URLConnection, before getting the InputStream):
> // workarround: do proxy settings
> Properties systemSettings = System.getProperties();
> Object myProxyUserObject = systemSettings.get("http.proxyUser");
> if (null != myProxyUserObject) {
> String myProxyUser = myProxyUserObject.toString();
> System.out.println("%%% XMLEntityManager: using proxy user " + myProxyUser + " ...");
> String proxyPassword = (systemSettings.get("http.proxyPassword")).toString();
> sun.misc.BASE64Encoder encoder = new sun.misc.BASE64Encoder();
> String myAuthToken = myProxyUser + ":" + proxyPassword;
> String encodedUserPwd = encoder.encode(myAuthToken.getBytes());
> connect.setRequestProperty("Proxy-Authorization", "Basic " + encodedUserPwd);
> }
> Is there a better (standard) way to convince Xerces using proxy authentification?
> Is there a chance to get such code in the Xerces distribution?
> Regards,
> Martin.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-dev-help@xml.apache.org
[jira] Commented: (XERCESJ-1030) using proxy with (basic-) authentification does not work
Posted by "Ankit Pasricha (JIRA)" <xe...@xml.apache.org>.
[ http://nagoya.apache.org/jira/browse/XERCESJ-1030?page=comments#action_56040 ]
Ankit Pasricha commented on XERCESJ-1030:
-----------------------------------------
Xerces should not know anything about the communication mechanism being used to access these external files. If you would like to load using a proxy with username/password, you can add an EntityResolver to the parser or use JAXP's schemaSource property instead.
> using proxy with (basic-) authentification does not work
> --------------------------------------------------------
>
> Key: XERCESJ-1030
> URL: http://nagoya.apache.org/jira/browse/XERCESJ-1030
> Project: Xerces2-J
> Type: Bug
> Versions: 2.6.2
> Environment: proxy with (basic-) authentification, Sun JavaVM 1.4.2, SuSE Linux machine
> Reporter: Martin Stechert
>
> I'm validating XML documents against XSD schemas using xerces.
> Some Schemas contain import-directives, that point to the internet, e.g. "http://www.w3.org/2001/xml.xsd" imported from a uddi_v2 schema.
> I'm using a HTTP proxy that requires (basic-) authentification.
> I'm passing appropriate properties to the JavaVM:
> - http.proxySet=true
> - http.proxyHost=...
> - http.proxyPort=...
> - http.nonProxyHosts=...
> - http.proxyUser=...
> - http.proxyPassword=...
> Xerces uses the proxy but does not care about the authentification.
> As a Workarround I've added some code to XMLEntityManager (method setupCurrentEntity, just after getting the URLConnection, before getting the InputStream):
> // workarround: do proxy settings
> Properties systemSettings = System.getProperties();
> Object myProxyUserObject = systemSettings.get("http.proxyUser");
> if (null != myProxyUserObject) {
> String myProxyUser = myProxyUserObject.toString();
> System.out.println("%%% XMLEntityManager: using proxy user " + myProxyUser + " ...");
> String proxyPassword = (systemSettings.get("http.proxyPassword")).toString();
> sun.misc.BASE64Encoder encoder = new sun.misc.BASE64Encoder();
> String myAuthToken = myProxyUser + ":" + proxyPassword;
> String encodedUserPwd = encoder.encode(myAuthToken.getBytes());
> connect.setRequestProperty("Proxy-Authorization", "Basic " + encodedUserPwd);
> }
> Is there a better (standard) way to convince Xerces using proxy authentification?
> Is there a chance to get such code in the Xerces distribution?
> Regards,
> Martin.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://nagoya.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-dev-help@xml.apache.org