I haven't looked extensively but it looks like there is no way to pass the HTTP basic auth information to the Processor or Handler. Is there any plan on adding an AuthenticatedHandler interface similar to the Helma XML-RPC server?
Thanks,
-Gil
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
You're right, there is no support of basic authentication. I'll look into it this evening and see if there's some appropriate way of adding this. I'm not sure yet that the information should go through the regular XmlRpcInvocationProcessor interface, though.
I'll be in touch,
Greger
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello,
Is there any news in the latest versions about XML RPC client to access a service that requires basic authentication ? I couldn't find any way to set this through the API... :/
Is there any way to get such thing by implementing one of the provided interface ?
thanks for your help,
Best Regards,
Lionel.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
There is an API that can be used for this, which is the setRequestProperty() in the XmlRpcClient and the XmlRpcProxy(). Although this method is not designed exclusively for Basic Authentication, it can be used to set any HTTP header including the Authorization header.
Example (psuedo, untested):
import redstone.xmlrpc.util.Base64;
...
String auth = new String(Base64.encode((usr + ":" + pwd).getBytes())); // usr and pwd are strings
XmlRpcClient client = new XmlRpcClient(...);
client.setRequestProperty("Authorization", "Basic " + auth);
... request properties are sticky, and are included in all future calls using this client instance...
client.invoke(...);
client.invoke(...);
Basically, we just set the HTTP header "Authorization" to be "Basic <auth>" where <auth> is the Base64 encoded version of "username:password" according to RFC2617. You can use the Base64 class included in the Redstone XML-RPC library.
It's not very pretty and the XmlRpcServer is not equipped to handle this header but it would be fairly easy to extend the XmlRpcServlet if you wish to handle it on the server side as well. I can give you examples of this on request.
Hope this helps. If not, give me a ping and I'll explain further or implement support for this directly in the client.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I haven't looked extensively but it looks like there is no way to pass the HTTP basic auth information to the Processor or Handler. Is there any plan on adding an AuthenticatedHandler interface similar to the Helma XML-RPC server?
Thanks,
-Gil
Hi Gil,
You're right, there is no support of basic authentication. I'll look into it this evening and see if there's some appropriate way of adding this. I'm not sure yet that the information should go through the regular XmlRpcInvocationProcessor interface, though.
I'll be in touch,
Greger
Hello,
Is there any news in the latest versions about XML RPC client to access a service that requires basic authentication ? I couldn't find any way to set this through the API... :/
Is there any way to get such thing by implementing one of the provided interface ?
thanks for your help,
Best Regards,
Lionel.
Hi,
Sorry for the late reply, I've been on vacation.
There is an API that can be used for this, which is the setRequestProperty() in the XmlRpcClient and the XmlRpcProxy(). Although this method is not designed exclusively for Basic Authentication, it can be used to set any HTTP header including the Authorization header.
Example (psuedo, untested):
import redstone.xmlrpc.util.Base64;
...
String auth = new String(Base64.encode((usr + ":" + pwd).getBytes())); // usr and pwd are strings
XmlRpcClient client = new XmlRpcClient(...);
client.setRequestProperty("Authorization", "Basic " + auth);
... request properties are sticky, and are included in all future calls using this client instance...
client.invoke(...);
client.invoke(...);
Basically, we just set the HTTP header "Authorization" to be "Basic <auth>" where <auth> is the Base64 encoded version of "username:password" according to RFC2617. You can use the Base64 class included in the Redstone XML-RPC library.
It's not very pretty and the XmlRpcServer is not equipped to handle this header but it would be fairly easy to extend the XmlRpcServlet if you wish to handle it on the server side as well. I can give you examples of this on request.
Hope this helps. If not, give me a ping and I'll explain further or implement support for this directly in the client.