Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe, BasicAuth, Wrong Encoding, webservice-client #593

Open
Tomas-Kraus opened this issue Jun 2, 2022 · 0 comments

Comments

@Tomas-Kraus
Copy link
Member

FULL PRODUCT VERSION :

A DESCRIPTION OF THE PROBLEM :
if the Plattform Encoding is not "ISO-8859-1", the class

com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe

do the wrong encoding to the Basic Auth header.

Normally the webservice client uses this code to send the credentials.

Map<String, Object> ctx = ((BindingProvider) port).getRequestContext();
ctx.put(BindingProvider.USERNAME_PROPERTY, "user");
ctx.put(BindingProvider.PASSWORD_PROPERTY, "üöä");

The Basic-Auth header must be encoded with "ISO-8859-1" but the impletation in class "com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe" does not doing this.

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
step into class

com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe

take a look where "BindingProvider.PASSWORD_PROPERTY" is used.

the getBytes()-Method is called without StandardCharset.ISO_8859_1

This issue was previously reported at: https://bugs.openjdk.java.net/browse/JDK-8154861
REPRODUCIBILITY :
This bug can be reproduced always.

CUSTOMER SUBMITTED WORKAROUND :
// creating the header externally

Map<String, Object> ctx = ((BindingProvider) port).getRequestContext();

Map<String, List> headers=new HashMap<String, List>();

headers.put("Authorization", Arrays.asList("Basic "+DatatypeConverter.printBase64Binary("user:üäö".getBytes(StandardCharsets.ISO_8859_1))));

ctx.put(MessageContext.HTTP_REQUEST_HEADERS, headers);

Source: javaee/metro-jax-ws#1218
Author: LanceAndersen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant