Pages

20 November, 2013

Eclipse Luna 4.4 Support for UX Studio

Please follow the below steps to configure UX Studio Plugin with Eclipse Luna 4.4:

Step1:
http://shekarsana.blogspot.in/2013/10/demandware-ux-studio.html

Step 2: :
 In location field Instead of the old update URL:
 http://updates.demandware.com/uxstudio_pr/4.2
 We should use 
 http://updates.demandware.com/uxstudio_pr/4.4

 then click on OK.

because 4.2 UX Studio most probably does not work.


       

11 October, 2013

SoapUI Eclipse-Plugin

The SoapUI eclipse plugin provides full SoapUI functionality from within eclipse. Apart from "standard" SoapUI 2.5 functionality, the eclipse plugin contains a SoapUI project nature and also adds a new SoapUI perspective which mimics the layout of the standalone SoapUI version.The plugin makes use of the SWT_AWT bridge which greatly eases our development effort but may result in graphical glitches with dialogs and some window updates

Soap UI eclipse Update site:
An eclipse update site is now available at  http://www.soapui.org/eclipse/update,  install the soapui-eclipse-plugin with the following steps:

1. Select  Help > Install New Software...

2. In the Work with field, type  http://www.soapui.org/eclipse/update and click Add...

3. Enter the following in the dialog that appears:

  entering the SoapUI update site in eclipse
 
4.Check the SoapUI checkbox and click Next. Then follow the dialogs ti install the SoapUI feature.

Usage of soapUI as plugin into UX studio to work with the open commerce APIs:

Open the soapUI perspective in UX studio, click into the soapUI Navigator and select Import Packed Project, select the project zip file attached here and import it.

open the project, expand the hierarchy and click on Shop API to configure the service endpoints as shown below (note: you need to double-click all time to open the detail view in the right content area!)

 









04 October, 2013

Demandware UX Studio :

Demandware UX Studio plugin installation :

Step 1:  In Eclipse, from the main menu,  select  Help > Install New Software.
The Available Software dialog appears.

Step 2:  In the Work with field, enter the URL for your version of Eclipse:

    Indigo - http://updates.demandware.com/uxstudio_pr/3.7
    Juno - http://updates.demandware.com/uxstudio_pr/4.2

Step 3:  Select Demandware from the list and select Next. At this point Eclipse will compare the UX Studio requirements with what is available to ensure compatibility. After this process is complete,
 the Install Details dialog appears.

Step 4:  Select the I accept the terms of the license agreements button and then select Finish. The Installing Software dialog appears showing the progress of the installation.

Step 5:  Select Yes when prompted to restart Eclipse.

12 September, 2013

How Trusted Authentication Works in Tableau Server

The diagram below describes how trusted authentication works between the client's web browser, your web server(s) and Tableau Server.


User visits the webpage: When a user visits the webpage with the embedded Tableau Server view, it sends a GET request to your web server for the HTML for that page.

Web server passes the URL to the browser: The web server constructs the URL for the view using either the view’s URL or its object tag (if the view’s embedded), and inserts it into the HTML for the page. The ticket is included (e.g., http://tabserver/trusted/<ticket>/views/requestedviewname). The web server passes all the HTML for the page back to the client’s web browser.

Web server POSTS to Tableau Server: The web server sends a POST request to Tableau Server. That POST request must have a username parameter. Theusername value must be the username for a licensed Tableau Server user. If the server is running multiple sites and the view is on a site other than the Default site, the POST request must also include a target_siteparameter.

Browser requests view from Tableau Server: The client web browser sends a request to Tableau Server using a GET request that includes the URL with the ticket.

Tableau Server creates a ticket: Tableau Server checks the IP address of the web server (192.168.1.XXX in the above diagram) that sent the POST request. If it is set up as a trusted host then Tableau Server creates a ticket in the form of a unique nine-digit string. Tableau Server responds to the POST request with that ticket. If there is an error and the ticket cannot be created Tableau Server responds with a value of -1.

Tableau Server redeems the ticket: Tableau Server sees that the web browser requested a URL with a ticket in it and redeems the ticket. Tickets must be redeemed within three minutes after they are issued. Once the ticket is redeemed, Tableau Server logs the user in, removes the ticket from the URL, and sends back the final URL for the embedded view.

Trusted Authentication for Tableau server

 Trusted Authentication TABLEAU:

Step 1: Create a TableauAuthServlet Class
 
package com.tableau;
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.net.URL;
import java.net.URLConnection;
import java.net.URLEncoder;
import java.util.Properties;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class TableauAuthServlet extends HttpServlet
{
       private static final long serialVersionUID = 1L;

    public void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
    {
    try
    {
        // Read Property file and config data
        Properties config = getConfigProps();
        final String wgserver = config.getProperty("TableauServerURL");
        final String params = config.getProperty("displayParam");
        System.out.println("Tableau Server URL " + wgserver);
        System.out.println("Tableau display Param " + params);
        System.out.println("LDAP groups" + request.getHeader("groupList"));

        // Read Parameters from url
        String site = request.getParameter("s");
        String workbook = request.getParameter("w");
        String view = request.getParameter("v");
        String groupName = request.getParameter("g");
        System.out.println("site " + site);
        System.out.println("workbook " + workbook);
        System.out.println("view " + view);

        String tabGroupUserID = getTabGroup(groupName, request.getHeader("groupList"));

              String user = request.getHeader("uid");
        System.out.println("user " + user);

        // Get Trusted ticket from Tableau
        final String dst1 = "t/" + site + "/views/" + workbook + "/" + view;
        System.out.println("dst1 IS : " + dst1);
        // String ticket = getTrustedTicket(wgserver, user,
        // request.getRemoteAddr(),site);
        String ticket = getTrustedTicket(wgserver, tabGroupUserID, request.getRemoteAddr(), site);
        System.out.println("remoteAdd " + request.getRemoteAddr());
        System.out.println("ticket " + ticket);
        System.out.println("tabGroupUserID is: " + tabGroupUserID);

        if (!ticket.equals("-1")) //&& (tabGroupUserID.equals("FinanceReport") || tabGroupUserID.equals("SepgReport")) )
        {
        response.setStatus(HttpServletResponse.SC_MOVED_TEMPORARILY);
        // response.setHeader("Location", "http://" + wgserver +
        // "/trusted/" + ticket + "/" + dst + "?" + params);

        request.setAttribute("tabserverip", wgserver);
        request.setAttribute("url", "trusted/" + ticket + "/" + dst1);
        request.setAttribute("userid", request.getHeader("uid"));
        request.setAttribute("groupid", getTabGroup(groupName, request.getHeader("groupList")));

        // response.sendRedirect("http://" + wgserver + "/trusted/" +
        // ticket + "/" + dst1 + "?" + params);
    
        RequestDispatcher dispatcher = getServletContext().getRequestDispatcher("/report.jsp");
        dispatcher.forward(request, response);

        }
        else
        {
        // handle error
        // throw new ServletException("Invalid ticket " + ticket);
        RequestDispatcher dispatcher = getServletContext().getRequestDispatcher("/norights.jsp");
        dispatcher.forward(request, response);
        }

    }
    catch (Exception e)
    {
        e.printStackTrace();
    }

    }

    // the client_ip parameter isn't necessary to send in the POST unless you
    // have
    // wgserver.extended_trusted_ip_checking enabled (it's disabled by default)

    private String getTrustedTicket(String wgserver, String user, String remoteAddr, String sitename) throws ServletException
    {
    OutputStreamWriter out = null;
    BufferedReader in = null;
    try
    {
        // Encode the parameters
        StringBuffer data = new StringBuffer();
        data.append(URLEncoder.encode("username", "UTF-8"));
        data.append("=");
        data.append(URLEncoder.encode(user, "UTF-8"));
        data.append("&");
        data.append(URLEncoder.encode("client_ip", "UTF-8"));
        data.append("=");
        data.append(URLEncoder.encode(remoteAddr, "UTF-8"));
        data.append("&");
        data.append(URLEncoder.encode("target_site", "UTF-8"));
        data.append("=");
        data.append(URLEncoder.encode(sitename, "UTF-8"));

        // Send the request
        URL url = new URL("http://" + wgserver + "/trusted");
        URLConnection conn = url.openConnection();
        conn.setDoOutput(true);
        out = new OutputStreamWriter(conn.getOutputStream());
        out.write(data.toString());
        out.flush();

        // Read the response
        StringBuffer rsp = new StringBuffer();
        in = new BufferedReader(new InputStreamReader(conn.getInputStream()));
        String line;
        while ((line = in.readLine()) != null)
        {
        rsp.append(line);
        }

        return rsp.toString();

    }
    catch (Exception e)
    {
        throw new ServletException(e);
    }
    finally
    {
        try
        {
        if (in != null)
            in.close();
        if (out != null)
            out.close();
        }
        catch (IOException e)
        {
        }
    }
    }

    public Properties getConfigProps()
    {

    // Reading properties file to set Default values
    Properties config = new Properties();
    try
    {
        config.load(new FileInputStream(getServletContext().getRealPath("/WEB-INF/conf/Tview.properties")));

    }
    catch (IOException e)
    {
        System.out.println("Exception in getBankConfigProps: " + e);
    }
    return config;
    }

    public String getTabGroup(String groupName, String ldapGroups)
    {
    String grps[] = ldapGroups.split("cn=");
    String  tmpGroup = null;
    for (int i = 0; i < grps.length; i++)
    {
        if (grps[i] == null || grps[i].equals(""))
        continue;
        tmpGroup = grps[i].substring(0, grps[i].indexOf(","));
        System.out.println(tmpGroup);
        if (tmpGroup.equalsIgnoreCase(groupName))
        {
        System.out.println("Tableau Group of the user tmpGroup IS:" + tmpGroup);
        return tmpGroup;
        }
    }
    return "-";
    }

}

Create Properties file :
WEB-INF/conf/Tview.properties location:

Properties file contains:

TableauServerURL=domain name or IPAdress
displayParam=:embed=yes&:toolbar=yes

Create Jsp File named as report.jsp:

<html>
<%
String svr=(String)request.getAttribute("tabserverip");
String repUrl=(String)request.getAttribute("url");
String userid=(String)request.getAttribute("userid");
String groupid=(String)request.getAttribute("groupid");
System.out.println("tabserverip is: "+svr);
System.out.println("url is: "+repUrl);
System.out.println("userid is: "+userid);
System.out.println("groupid is: "+groupid);

String jscriptUrl="https://" + svr + "/javascripts/api/viz_v1.js";
System.out.println("jscriptUrl is: "+jscriptUrl);

%>

<script type="text/javascript" src="<%=jscriptUrl%>"></script>
<object class="tableauViz" width="100%" height="100%" style="display:none;">
<param name="path" value="<%=repUrl%>" />
<param name="filter" value="InsightID=<%=userid%>"/>
   </object>
</html>



 Create JSP file named as norights.jsp:

<html>
<p>
    <b><center><font name="ariel" size="3">You are not authorized.</font></center></b>
</p>
</html>

web.xml

    <servlet>
    <servlet-name>tview</servlet-name>
    <servlet-class>
            com.tview.TableauAuthServlet
    </servlet-class>
  </servlet>

<servlet-mapping>
    <servlet-name>tview</servlet-name>
    <url-pattern>/tview</url-pattern>
  </servlet-mapping>