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>


Simple DateFormat: JSP


Simple DateFormat:

<%@ page  language="java" import="java.text.DateFormat, java.text.SimpleDateFormat, java.util.Calendar" errorPage="" %>
 <%
DateFormat df = new SimpleDateFormat("MM/dd/yyyy");
Calendar calendar = Calendar.getInstance();
String currDate = df.format(calendar.getTime());
calendar.add(Calendar.DATE, -7);
String prevDate = df.format(calendar.getTime());
%>

 Previous Date IS: <%=prevDate%>"/> <br>
Current Date Is:  <%=currDate%>"/>

06 September, 2013

An error occurred communicating with the server (403) in Tableau.

Follow the below steps to prevent the network error in Tableau server:


“An error occurred communicating with the server (403). This may be a temporary network condition. Please retry the operation if this condition persists, contact your system administrator.”

This issue can occur if trusted authentication has been set up for Tableau Server. Beginning with version 8, security enhancements have been made to help protect your data from unauthorized access and other vulnerabilities. One of these enhancements includes added protection against tampering with VizQL sessions, which contain the sensitive data displayed in your view. Depending on your environment, you may not need this added level of protection. This may be true for environments where Tableau Server has been configured to use trusted authentication. In cases like this, as a Tableau Server administrator, you can disable this added security level to help resolve the above error.

Step 1

Click the Start button.

Step 2

In the search box, type Command Prompt. In the list of results, right-click Command Prompt, and click Run as administrator

Step 3

In the Command Prompt dialog box, change folders to the “bin” folder in the Tableau Server directory. For example, type one of the following commands depending on your machine:
  • For a 32-bit machine: cd “c:\Program Files\Tableau\Tableau Server\[version]\bin”
  • For a 64-bit machine: cd “c:\Program Files (x86)\Tableau\Tableau Server\[version]\bin”

Note: Replace [version] with the version of Tableau Server running on your machine.

Step 4

Type the following commands:  
  1. tabadmin stop
  2. tabadmin set vizqlserver.protect_sessions false
  3. tabadmin configure
  4. tabadmin start
Alternate Search Terms: trusted auth, 403, error

02 September, 2013

SSL Configuration For Tableau Server.

Follow the steps below to configure Tableau Server to use SSL.
  1. Acquire an Apache SSL certificate from a trusted authority (e.g., Verisign, Thawte, Comodo, GoDaddy, etc.). You can also use an internal certificate issued by your company. Wildcard certificates, which allow you to use SSL with many host names within the same domain, are also supported.
    Some browsers will require additional configuration to accept certificates from certain providers. Refer to the documentation provided by your certificate authority.
  2. Place the certificate files in a folder named SSL, parallel to the Tableau Server 7.0 folder. For example:
    C:\Program Files (x86)\Tableau\Tableau Server\SSL
    This location gives the account that's running Tableau Server the necessary permissions for the files.
  3. Open the Tableau Server Configuration Utility by selecting Start > All Programs > Tableau Server 8.0 > Configure Tableau Server on the Start menu.
  4. In the Configuration Tableau Server dialog box, select the SSL tab.
  5. Select Use SSL for Server Communication and provide the location for each of the following certificate files:
    • SSL Certificate File—Must be a valid PEM-encoded x509 certificate with the extension .crt
    • SSL Certificate Key File—Must be a valid RSA or DSA key that is not password protected with the file extension .key
    • SSL Certificate Chain File (Optional)—Some certificate providers issue two certificates for Apache. The second certificate is a chain file, which is a concatenation of all the certificates that form the certificate chain for the server certificate. All certificates in the file must be x509 PEM-encoded and the file must have a .crt extension (not .pem).

  6. Click OK. The changes will take effect the next time the server is restarted.
    When the server is configured for SSL, it accepts requests to the non-SSL port (default is port 80) and automatically redirects to the SSL port 443. SSL errors are logged in the install directory at the following location. Use this log to troubleshoot validation and encryption issues.
    C:\ProgramData\Tableau\Tableau Server\data\tabsvc\logs\httpd\error.log
    
    Note:
    Tableau Server only supports port 443 as the secure port. It cannot run on a machine where any other application is using port 443.

30 July, 2013

A Java proxy for MS SQL Server Reporting Services:

A Java Web application often uses a SQL Server database. SQL Server now comes bundled with a reporting tool, Reporting Services. RS has generated a lot of attention among developers since it first came on the market about a year ago. It is a full-featured reporting tool that includes a WYSIWYG report editor with scripting/programming capabilities, a delivery engine, and a powerful Web services interface. Using RS makes sense—not only from a cost perspective, but also because of the reduced development and deployment complexities compared with using a third-party vendor. This article explores such an integration scenario.

 For detailed explanation and  step by step understanding purpose please go through the below URL.  

http://www.javaworld.com/javaworld/jw-01-2005/jw-0110-sqlrs.html

 Sample Code :

1. First Create a servlet name as GetReportItem..

package com.shekarsana;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.Authenticator;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.Enumeration;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import util.ReportAuthenticator;

public class GetReportItem extends HttpServlet
{
    private static final long serialVersionUID = 1L;
    private final static boolean DEBUG = true;
    private final static String REPORT_SERVER_URL = "http://servername/ReportServer";
     private final static int BUFFER_SIZE = 2048;

    public void init(ServletConfig config) throws ServletException
    {
    super.init(config);
    }
    public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
    {
    doGet(request, response);
    }

    public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
    {
    try
    {
              String queryString = request.getQueryString();

        if (queryString.indexOf("cookie=") == -1)
        {
            System.out.println("\nGetReportItem - ERROR: No cookie parameter provided. Aborting.");
        return;
        }

        String cookie = queryString.substring(queryString.indexOf("cookie"), queryString.indexOf("&") + 1);

        queryString = queryString.replaceAll(cookie, "");
        cookie = cookie.substring(cookie.indexOf("=") + 1, cookie.length() - 1);

        String urlString = REPORT_SERVER_URL + "?" + queryString;

        if (DEBUG)
        {
        System.out.println("\nGetReportItem - Cookie: " + cookie);
        System.out.println("GetReportItem - Query String: " + queryString);
        System.out.println("GetReportItem - Send to URL: " + urlString);
        }

        if (queryString == null)
        {
                ServletOutputStream responseErrorStream = response.getOutputStream();
        responseErrorStream.println("GetReportItem - ERROR: No parameters have been provided.");
        responseErrorStream.close();
        return;
        }
        URL url = new URL(urlString);
        HttpURLConnection repCon = (HttpURLConnection) url.openConnection();
        Authenticator.setDefault(new ReportAuthenticator());
        repCon.setRequestMethod("GET");
        repCon.setRequestProperty("User-Agent", "Mozilla/5.0");
        repCon.setRequestProperty("Cookie", cookie);
        repCon.setUseCaches(false);
        repCon.setFollowRedirects(false);

        // Pipe Report Server's Output to the client using buffered streams.
        response.setContentType(repCon.getContentType());
        response.setHeader("Content-disposition", repCon.getHeaderField("Content-disposition"));
        InputStream repInStream = repCon.getInputStream();
        ServletOutputStream clientOutStream = response.getOutputStream();

        BufferedInputStream bis = new BufferedInputStream(repInStream);
        BufferedOutputStream bos = new BufferedOutputStream(clientOutStream);

        byte[] buff = new byte[BUFFER_SIZE];
        int bytesRead;

        while (-1 != (bytesRead = bis.read(buff, 0, BUFFER_SIZE)))
        {
        bos.write(buff, 0, bytesRead);
        }
        bis.close();
        bos.close();
        repInStream.close();
        clientOutStream.close();
    }
    catch (Exception e)
    {
        e.printStackTrace();
    }
    }

}

Step2 :


2.  Create a servlet name as ReportRequest.

package com.shekarsana;

import java.io.*;
import java.net.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;
import util.ReportAuthenticator;
import util.GetAvailableParameters;

public class ReportRequest extends HttpServlet
{
    private final static boolean DEBUG = true;
    private final static String REPORT_SERVER_URL = "http://ServerName/ReportServer";
    private final static String REPORT_PATH = "%2fMYReports%2f";
    private final static String REPORT_ITEM_SERVLET_URL = "http://localhost:8080/SANA/GetReportItem"
    private final static int BUFFER_SIZE = 2048;

    public void init(ServletConfig config) throws ServletException
    {
        super.init(config);
    }

    public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
    {
        try
        {
            if(DEBUG)
            {
                System.out.println("\nInitializing Report Request");
                System.out.println("---------------------------");
            }

            Authenticator.setDefault(new ReportAuthenticator());

            // Generate parameter string from request
            String parameterString = "rs:Command=Render&rc:Toolbar=false";

            // Get the list of parameters that can be defined by the user.
            ArrayList availableParams = GetAvailableParameters.getParameters();

            Enumeration paramEnum = request.getParameterNames();

            String currentParam;
            while(paramEnum.hasMoreElements())
            {
                currentParam = (String)paramEnum.nextElement();
                if(availableParams.contains(currentParam))
                {
                    // If parameter is available, add it to the string.
                    parameterString += "&" + currentParam + "=" + request.getParameter(currentParam);
                }
            }

            String reportName = request.getParameter("reportName");

            if(DEBUG)
            {
                System.out.println("ReportRequest - Parameter String: " + parameterString);
                System.out.println("ReportRequest - Report retrieved: " + reportName);
            }

            if (reportName == null)
            {
                // Bail out if no report name is found.
                ServletOutputStream responseErrorStream = response.getOutputStream();
                responseErrorStream.println("ERROR: No report name specified");
                responseErrorStream.close();
                return;
            }

            // Establish HTTP POST connection to report server
            String urlString = REPORT_SERVER_URL + "?" + REPORT_PATH + reportName;
            URL url = new URL(urlString);

            HttpURLConnection repCon = (HttpURLConnection)url.openConnection();

            repCon.setRequestMethod("POST");
            repCon.setDoOutput(true);
            repCon.setUseCaches(false);
            repCon.setFollowRedirects(false);
            repCon.setRequestProperty("User-Agent", "Mozilla/5.0");
            repCon.setRequestProperty("Content-type", "application/x-www-form-urlencoded" );
            repCon.setRequestProperty("Content-length", Integer.toString(parameterString.length()));

            // Send parameter string to report server
            PrintWriter repOutStream = new PrintWriter(repCon.getOutputStream());

            repOutStream.println(parameterString);
            repOutStream.close();

            // Pipe Report Server's Output to the client
            forwardResponse(repCon, response);
        }
        catch (Exception e)
        {
            e.printStackTrace();

            // Alert the client there has been an error.
            ServletOutputStream responseErrorStream = response.getOutputStream();
            responseErrorStream.println("There has been an error.  Please check the system log for details.");
            responseErrorStream.close();
        }
    }

    public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
    {
        // Redirect HTTP GET requests to doPost.
        doPost(request, response);
    }

    private void forwardResponse(HttpURLConnection reportCon, HttpServletResponse clientResponse) throws ServletException, IOException
    {
        // Take the report server's response and forward it to the client.

        String cookie = reportCon.getHeaderField("Set-Cookie");

        if(cookie == null)
        {
            System.out.println("ReportRequest - ERROR: No cookie provided by report server.  Aborting.");
            return;
        }

        if(cookie.indexOf(";") != -1)
        {
            cookie = cookie.substring(0,cookie.indexOf(";"));
        }
        if(DEBUG)
        {
            System.out.println("ReportRequest - Cookie: " + cookie);
        }

        String contentType = reportCon.getContentType();

        clientResponse.setContentType(contentType);
        clientResponse.setHeader("Content-disposition", reportCon.getHeaderField("Content-disposition"));

        InputStream repInStream = reportCon.getInputStream();
        ServletOutputStream clientOutStream = clientResponse.getOutputStream();

        if(!contentType.equals("text/html"))
        {
            // Use a buffered stream to send all binary formats.
            BufferedInputStream bis = new BufferedInputStream(repInStream);
            BufferedOutputStream bos = new BufferedOutputStream(clientOutStream);

            byte[] buff = new byte[BUFFER_SIZE];
            int bytesRead;

            while(-1 != (bytesRead = bis.read(buff, 0, BUFFER_SIZE)))
            {
                bos.write(buff, 0, bytesRead);
            }
            bis.close();
            bos.close();
        }
        else
        {
            /*
             * Use a character stream to send HTML to the client, replacing
             * references to the reporting server with the GetReportItem
             * servlet.
             */

            String currentWindow = "";
            int itemsFound = 0;

            for(int ch;(ch = repInStream.read()) != -1;)
            {
                if(currentWindow.length() < REPORT_SERVER_URL.length())
                {
                    currentWindow += (char)ch;
                }
                else if(currentWindow.equalsIgnoreCase(REPORT_SERVER_URL) && (char)ch == '?')
                {
                    itemsFound++;

                    clientOutStream.print(REPORT_ITEM_SERVLET_URL + "?cookie=" + cookie + "&");
                    currentWindow = "";
                }
                else
                {
                    clientOutStream.print(currentWindow.charAt(0));
                    currentWindow = currentWindow.substring(1) + (char)ch;
                }
            }
            clientOutStream.print(currentWindow);

            if(DEBUG)
            {
                System.out.println("ReportRequest - " + itemsFound + " references to the report server found.");
            }
        }

        repInStream.close();
        clientOutStream.close();
    }
}

Create Java Classes named as :

 GetAvailableParameters and ReportAuthenticator

Structure: 1. util/ GetAvailableParameters

and 2. util/ ReportAuthenticator

In ReportAuthenticator  Class we need to provide the Credentials:

   private String username = "shekar";
    private String password = "Sana";

Thanks 

SANA




25 July, 2013

Shibboleth SP Installation Guide:


Shibboleth setup in Windows:
1. Pre Requiste Softwares Installation.
2. SP Installation.
3. SP Configuration.
4. IDP Installation.
5. IDP Configuration.

1) Pre Requiste Softwares Installation:

            1) Install JDK 1.6 and configure the JAVA_HOME path.

            2) Install the IIS on Windows XP, Vista, Except on Windows 7 -- as IIS will be available in Windows 7 by default.

            In case of Windows 7, IIS Services needs to be enabled.
            For enabling the IIS services,
Server Manager is not available in Windows 7. So we have to go to, Start-->Control Panel-->Programs-->Turn windows features on or off(Programs and Features). Expand all, Enable the IIS services & filters.
                       
            To Check whether the IIS is started or not
                        Start--> All programs--> Accessories--> Commandprompt--> Rightclick, run as Adminstrator-->type "iisreset"  should restart the iis server. Otherwise we didnt installed the IIS.

2. SP Installation:

             Install the SP by setting the installation path as c:\opt\shibboleth-sp
           
Check whether the shibboleth services are up or not.
                        Start--> run command--> type "services.msc"
                        shibboleth service should be up, otherwise reinstall it.

            Type -- http://127.0.0.1/Shibboleth.sso/Status
                        You should see a bundle of xml's.
                
 Else,
              1.If any errors on blacklist or whitelist line,  remove the blacklist or whitelist line based on the error from shibboleth2.xml
             

3. SP Configuration:

 Do the configurations, as per the section 2.5.

 Note:   Do the below change in the 13th Page,
  In the 4th point, Change the current one to the below one. ( Don't include the discoveryProtocol,discoveryURL attributes in <SSO> and Don't use the value SAML1. )

               <SSO entityID="https://shib-idp.umsystem.edu/idp/shibboleth">SAML2 </SSO>

check whether the sp is configured correctly or not by hitthing the url,

If the XML is downloaded properly, Configuration is correct.


 4. IDP Installation:


Install the IDP by setting the installation path as c:\opt\shibboleth-idp


5.IDP Configuration:

i)  Enable the MetaDataprovider in relying-party.xml and make the changes as below.

<metadata:MetadataProvider id="SPDOTNET" xsi:type="metadata:FileBackedHTTPMetadataProvider"
                          metadataURL="https://172.16.8.173/Shibboleth.sso/Metadata"
                          backingFile="C:\opt\shibboleth-idp\metadata\173dotnet-metadata.xml"/>
 
ii) set IDP_HOME to home directory of IDP (C:\opt\shibboleth-idp) in Environment Variables.
    
iii) Remove all the entries for authentication except "UsernamePassword" and "PreviousSession" in Login Handlers section  of handler.xml

iv) Add following for detail debug trace in logging.xml
<logger name="edu.internet2.middleware.shibboleth.common.attribute">
         <level value="DEBUG" />
</logger>


Sample Shibolth2.xml file:

<SPConfig xmlns="urn:mace:shibboleth:2.0:native:sp:config"
    xmlns:conf="urn:mace:shibboleth:2.0:native:sp:config"
    xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion"
    xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol"   
    xmlns:md="urn:oasis:names:tc:SAML:2.0:metadata"
    clockSkew="180">

    <!--
    The InProcess section contains settings affecting web server modules.
    Required for IIS, but can be removed when using other web servers.
    -->
   

    <!--
    By default, in-memory StorageService, ReplayCache, ArtifactMap, and SessionCache
    are used. See example-shibboleth2.xml for samples of explicitly configuring them.
    -->

    <!--
    To customize behavior for specific resources on IIS, and to link vhosts or
    resources to ApplicationOverride settings below, use the XML syntax below.
    See https://wiki.shibboleth.net/confluence/display/SHIB2/NativeSPRequestMapHowTo for help.
   
    Apache users should rely on web server options/commands in most cases, and can remove the
    RequestMapper element. See https://wiki.shibboleth.net/confluence/display/SHIB2/NativeSPApacheConfig
    -->
    <RequestMapper type="Native">
        <RequestMap>
            <!--
            The example requires a session for documents in /secure on the containing host with http and
            https on the default ports. Note that the name and port in the <Host> elements MUST match
            Apache's ServerName and Port directives or the IIS Site name in the <ISAPI> element above.
            -->
            <Host name="sp.example.org">
                <Path name="secure" authType="shibboleth" requireSession="true"/>
            </Host>
            <!-- Example of a second vhost mapped to a different applicationId. -->
            <!--
            <Host name="admin.example.org" applicationId="admin" authType="shibboleth" requireSession="true"/>
            -->
        </RequestMap>
    </RequestMapper>

    <!--
    The ApplicationDefaults element is where most of Shibboleth's SAML bits are defined.
    Resource requests are mapped by the RequestMapper to an applicationId that
    points into to this section (or to the defaults here).
    -->
    <ApplicationDefaults entityID="https://xyz.com/shibboleth"
                         REMOTE_USER="eppn persistent-id targeted-id">

        <!--
        Controls session lifetimes, address checks, cookie handling, and the protocol handlers.
        You MUST supply an effectively unique handlerURL value for each of your applications.
        The value defaults to /Shibboleth.sso, and should be a relative path, with the SP computing
        a relative value based on the virtual host. Using handlerSSL="true", the default, will force
        the protocol to be https. You should also set cookieProps to "https" for SSL-only sites.
        Note that while we default checkAddress to "false", this has a negative impact on the
        security of your site. Stealing sessions via cookie theft is much easier with this disabled.
        -->
        <Sessions lifetime="28800" timeout="3600" relayState="ss:mem"
                  checkAddress="false" handlerSSL="false" cookieProps="http">

            <!--
            Configures SSO for a default IdP. To allow for >1 IdP, remove
            entityID property and adjust discoveryURL to point to discovery service.
            (Set discoveryProtocol to "WAYF" for legacy Shibboleth WAYF support.)
            You can also override entityID on /Login query string, or in RequestMap/htaccess.
            -->

           <!-- <SSO entityID="https://idp.example.org/idp/shibboleth"
                 discoveryProtocol="SAMLDS" discoveryURL="https://ds.example.org/DS/WAYF">
              SAML2 SAML1
            </SSO> -->

     <SSO entityID="https://facebook.com/sso/saml2/idp/metadata.php" ECP="true">
               SAML2
            </SSO>

            <!-- SAML and local-only logout. -->
            <Logout>SAML2 Local</Logout>

            <!-- Extension service that generates "approximate" metadata based on SP configuration. -->
            <Handler type="MetadataGenerator" Location="/Metadata" signing="false"/>

            <!-- Status reporting service. -->
            <Handler type="Status" Location="/Status" acl="127.0.0.1 ::1"/>

            <!-- Session diagnostic service. -->
            <Handler type="Session" Location="/Session" showAttributeValues="true"/>

            <!-- JSON feed of discovery information. -->
            <Handler type="DiscoveryFeed" Location="/DiscoFeed"/>
        </Sessions>

        <!--
        Allows overriding of error template information/filenames. You can
        also add attributes with values that can be plugged into the templates.
        -->
        <Errors supportContact="root@localhost"
            helpLocation="/about.html"
            styleSheet="/shibboleth-sp/main.css"/>
       
        <!-- Example of remotely supplied batch of signed metadata. -->
        <!--
        <MetadataProvider type="XML" uri="http://federation.org/federation-metadata.xml"
              backingFilePath="federation-metadata.xml" reloadInterval="7200">
            <MetadataFilter type="RequireValidUntil" maxValidityInterval="2419200"/>
            <MetadataFilter type="Signature" certificate="fedsigner.pem"/>
        </MetadataProvider>
        -->

        <!-- Example of locally maintained metadata. -->
        <!--
        <MetadataProvider type="XML" file="partner-metadata.xml"/>
        -->

    <MetadataProvider type="XML" uri="https:///facebook.com/sso/saml2/idp/metadata.php"
            backingFilePath="timetrack-metadata.xml" reloadInterval="7200">
       </MetadataProvider>


        <!-- Map to extract attributes from SAML assertions. -->
        <AttributeExtractor type="XML" validate="true" reloadChanges="false" path="attribute-map.xml"/>
       
        <!-- Use a SAML query if no attributes are supplied during SSO. -->
        <AttributeResolver type="Query" subjectMatch="true"/>

        <!-- Default filtering policy for recognized attributes, lets other data pass. -->
        <AttributeFilter type="XML" validate="true" path="attribute-policy.xml"/>

        <!-- Simple file-based resolver for using a single keypair. -->
       <!-- <CredentialResolver type="File" key="sp-key.pem" certificate="sp-cert.pem"/>-->

<CredentialResolver type="File" key="C:/opt/Apache2.2/conf/privatekey.key" certificate="C:/opt/Apache2.2/conf/pulse.photoninfotech.com.crt"/>

        <!--
        The default settings can be overridden by creating ApplicationOverride elements (see
        the https://wiki.shibboleth.net/confluence/display/SHIB2/NativeSPApplicationOverride topic).
        Resource requests are mapped by web server commands, or the RequestMapper, to an
        applicationId setting.
       
        Example of a second application (for a second vhost) that has a different entityID.
        Resources on the vhost would map to an applicationId of "admin":
        -->
        <!--
        <ApplicationOverride id="admin" entityID="https://admin.example.org/shibboleth"/>
        -->
    </ApplicationDefaults>
   
    <!-- Policies that determine how to process and authenticate runtime messages. -->
    <SecurityPolicyProvider type="XML" validate="true" path="security-policy.xml"/>

    <!-- Low-level configuration about protocols and bindings available for use. -->
    <ProtocolProvider type="XML" validate="true" reloadChanges="false" path="protocols.xml"/>

</SPConfig>