0 Replies Latest reply on Mar 17, 2014 12:16 PM by shanna

    Having trouble displaying a home page from an already authenticated server...

    shanna

      Hi everyone,

       

      I am trying to connect to an authenticated server and display its content into an iFrame in Jive 6. I am able to hook up the strut/actions and trigger the code to authenticate the server and dump out the response body in the log file (the home page from the authenticated server). I am unable to actually display the home page onto the iFrame itself. I imagine I am making a silly mistake but am not sure what. Here's the workflow:

       

      1. In a Jive 6 space, I specify a URL that looks something like href="/community/DWCustomers!loaddwcustomers.jspa"

      2. In the strut, the DWCustomers action is mapped to DWCustomersSSOAction class

       

      action: DWCustomers

      Result:

       

      tab ... tabframe.ftl

      loginredirect ... dwCustomers URL (secure server)

       

      3. loaddwcustomers.jspa returns "tab" which executes a ftl file to create a custom view. Basically, it puts a iframe inside our custom theme. The iframe uses the href="/community/DWCustomers!sso.jspa"

      4. In DWCustomersSSOAction.sso() is where all the authentication takes place. The goal is that once we authenticate the first DWCustomers URL, navigation to subsequent pages on the same secure server would just use the same session. This is the part that is not working:

       

      // portalURL is the actual DWCustomers URL to the home page of secure server

       

      byte[] bytes = null;

      GetMethod m = new GetMethod(portalURL);

      HttpClient client = new HttpClient();

      try {

        // Setup a client to authenticate the request

        client.getState().setCredentials(new AuthScope(hostname, portNo), new UsernamePasswordCredentials(username, password));

       

        m.setDoAuthentication(true);

        m.setFollowRedirects(true);

       

        int statusCode = client.executeMethod(m);

       

        if (statusCode == HttpStatus.SC_OK) { //HTTP 200 is a success code

       

       

        bytes = m.getResponseBody();

        dwcResponse = Response.seeOther(portalURI).build();

       

       

        log.info("ResponseBody: " + new String(bytes)); // this works fine.

       

       

        }

       

        catch (Exception e) {

        log.error("Connection failure: ", e);

        } finally {

        m.releaseConnection();

        }

       

      return "loginredirect"; // this redirects to the dwCustomers URL

       

      The byte[] bytes output perfectly in the log file. But when I return "loginredirect", the page is redirected to dwCustomers URL and the secure server prompts me for the credentials (via a login dialog box) again. It does not seem to know I've successfully authenticated the connection once before. How do I get the iFrame to simply render what was returned in the Response body?

       

      If I manage to get the iFrame to render the Response body, I guess I would be re-authenticating every page navigation inside the secure server. Should I somehow preserve the session? If so, how?

       

      I am not an expert at network connection. Your help will be greatly appreciated. Thanks!