2 Replies Latest reply on Dec 9, 2017 10:44 PM by pradeepbangarusamy

    Unexpired Trusted Ticket - including ClientIP

    Karthik Venkatraman

      Hi,

       

      I have an ASP.NET web application in which i'm rendering different tableau dashboards from a site based on the the menu clicked by the user. I have multiple menus and each menu was tied to a tableau URL.

       

      Tableau Trusted Authentication has been implemented to get the trusted ticket from the tableau server. Once the ticket has been retrieved, i am appending the ticket to the URL for each menu.

       

      The trusted ticketing module is working fine and the visualizations are getting rendered in my web application. However, frequently i am getting a message of "Could not locate unexpired ticket" error.

       

      On checking with this error, this is due to the ticket calls getting duplicated.

       

      I reached out to the support regarding this and got response that I can add client_ip during my trusted ticketing.

       

      http://kb.tableau.com/articles/Issue/error-could-not-locate-unexpired-trusted-ticket

       

      I am not able to find any code article related to adding client_ip filtering in trusted ticketing.

       

      Below is my trusted ticket code

       

      public class TableauTicket

          {

              public string getTableauTicket(string tabserver, string sUsername)

              {

                  try

                  {

                      ASCIIEncoding enc = new ASCIIEncoding();

                      string postData = string.Empty;

                      string resString = string.Empty;

       

       

                      postData = "username=" + sUsername + "";

       

       

                      // FEATURE 816 END - Custom Visualization - KV

                      if (postData != string.Empty)

                      {

                          byte[] data = enc.GetBytes(postData);

                          HttpWebRequest req = (HttpWebRequest)WebRequest.Create(tabserver + "/trusted");

                          req.Method = "POST";

                          req.ContentType = "application/x-www-form-urlencoded;charset=UTF-8";

                          req.ContentLength = data.Length;

       

                          Stream outStream = req.GetRequestStream();

                          outStream.Write(data, 0, data.Length);

                          outStream.Close();

       

                          HttpWebResponse res = (HttpWebResponse)req.GetResponse();

                          StreamReader inStream = new StreamReader(stream: res.GetResponseStream(), encoding: enc);

                          resString = inStream.ReadToEnd();

                          inStream.Close();

       

                          return resString;

                      }

                      else

                      {

                          resString = "User not authorised";

                          return resString;

                      }

                  }

                  catch (Exception ex)

                  {

                      string resString = "User not authorised";

                      return resString;

                      string strTrailDesc = "Exception in tableau ticket - " + ex.Message;

                  }

              }

              public int Double(int i)

              {

                  return i * 2;

              }

          }

       

      Can anyone please let me know how the client_ip can be passed in trusted ticketing code. Also the client ip will get changed for each user and how this will be handled in the trusted ticketing?