Please Note This forum exists for community support for the Mango product family and the Radix IoT Platform. Although Radix IoT employees participate in this forum from time to time, there is no guarantee of a response to anything posted here, nor can Radix IoT, LLC guarantee the accuracy of any information expressed or conveyed. Specific project questions from customers with active support contracts are asked to send requests to support@radixiot.com.

Radix IoT Website Mango 3 Documentation Website Mango 4 Documentation Website

How to set basic authentication parameter (user, pass) in HTTP retriever module?


  • Hi,

    how is it possible to set user, password combination in HTTP retriever module for basic HTTP authentication ?
    I have an embedded device with ethernet connection. I am using xml files on it with different tags (device description, MAC, address, analog/digital data...) I want to retrieve with HTTP Retriever module.
    However the XML files may just be accessed with authentication.

    Thanks in advance
    Janus


  • I think this would need to be an added feature and would probably depend on the authentication requirements of the device.


  • Hi Joel,

    I am currently playing a bit with Mango Automation. It is a nice tool.

    How long would it take to update Mango with that feature?
    I have already used basic authentication in Java for retrieving XML files from my embedded web server.

    here a code snippet:

    
    private String encodeHttpAuthorization(String user, String pass)
      throws Exception
      {
          String urlEncStr = "";
          if(user.length() != 0 || pass.length() != 0)
          {
              
              String userpass = user + ":" + pass;
    //          urlEncStr = "Basic " + javax.xml.bind.DatatypeConverter.printBase64Binary(userpass.getBytes());
              urlEncStr = "Basic " + new sun.misc.BASE64Encoder().encode (userpass.getBytes());
            //String basicAuth = "Basic " + new String(new Base64().encode(userpass.getBytes()));
    
          }
          return urlEncStr;
      }
    ...
    ...
    try
        {
          // create the HttpURLConnection
          url = new URL(desiredUrl);
          connection = (HttpURLConnection) url.openConnection();
          
          connection.setRequestMethod("POST");
          connection.setRequestProperty("Authorization", encodeHttpAuthorization("admin", "00000"));
          
          connection.setDoInput(true);
    ...
    ...
    
    

    Regards
    Janus


  • I'll look into it and get back to you. Thanks, Joel.


  • That great!
    Just a quickie. Is there any way how I can customize Mango Automation myself? Or it is not intended to do?
    Cheers,
    Janus


  • Absolutely, when you filled out the download form you should have received a link to the source code. The HTTP source code is not included in that link, if you would like access to that you can contact me privately and we can discuss becoming a Development partner.

    Joel.


  • In DGLux I need to set some large portions of the screen to yellow, or red, if things get out of range, while normally the
    gauges would show exact values. Perhaps the gauge as a whole should turn orange, to attract visually when a warning needs to be fired.
    Should this be performed by a separate data point referring to the measurement data point? Perhaps by a point link?

    And another issue: I can't seem to find external processes as data source, like ping <hostname> ? Or some test programs of my own.
    How to go about that. vmstat is a great example of what could be there.


  • Suman,

    To the first part of your question, I would probably just link the value related to that gauge's output indicator to the color effect->tint field under the layout tab in the attribute explorer. Then, create some sort of value mapping.

    I am uncertain what you mean about not getting enough data access to other processes, but that sounds like a proposed module of itself and not like the existing Mango functionality. We would likely be willing to discuss creating in some fair exchange to our mutual benefit.

    • Phillip

  • I also need basic authentication, has something been implemented? I tried using http://username:password@someserver.com but this returns an error.