Menu

Need AuthenticatedHandler

2001-06-06
2013-04-25
  • Gil Markham

    Gil Markham - 2001-06-06

    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

     
    • Greger Ohlson

      Greger Ohlson - 2001-06-06

      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

       
      • yonel

        yonel - 2008-12-19

        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.

         
    • Greger Ohlson

      Greger Ohlson - 2008-12-26

      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.

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.