final String proxyTicket = getProxyTicket(ticketGrantingTicket, "demo_subsystem");
final String proxyTicket = getProxyTicket(ticketGrantingTicket, config.getProperty(RequestUtil.PROP_DEMO_SLAVE_USERNAME));
    public final void doGet(final HttpServletRequest request, final HttpServletResponse response)    throws IOException, ServletException {        // Be sure to dump all exceptions.        try {            // Get configuration.            final Properties config = getConfig();            // Do we have a ticket?            final String ticket = request.getParameter(PARAM_TICKET);            if (ticket == null) {                // No ticket; redirect for authentication.                String redirectURL = initiateAuthentication(convert(config.getProperty(RequestUtil.PROP_DEMO_MASTER_ATTRIBUTE_REQUEST)), request.getRequestURL().toString() + "?" + PARAM_TICKET + "=", "", true);                response.sendRedirect(redirectURL);            } else {                // We have a ticket.                PrintWriter out = response.getWriter();                out.println("<html><head><title>Moria Demo Service</title></head><body>");                out.println("<h1 align=\"center\">Authentication successful</h1>");                out.println("<i>System '" + config.getProperty(RequestUtil.PROP_DEMO_MASTER_USERNAME) + "':</i>");                String ticketGrantingTicket = null; // For later use.                // Get and display attributes.                Attribute[] attributes = getUserAttributes(ticket);                out.println("<table align=\"center\"><tr><td><b>Attribute Name</b></td><td><b>Attribute Value(s)</b></td></tr>");                for (int i = 0; i < attributes.length; i++) {                    // Is this the ticket granting ticket?                    String name = attributes[i].getName();                    if (name.equals("tgt")) {                        // Just remember the ticket for later use.                        ticketGrantingTicket = attributes[i].getValues()[0];                    }                    else {                        // Show the actual attribute and its values.                        out.println("<tr><td>" + name + "</td>");                        String[] values = attributes[i].getValues();                        for (int j = 0; j < values.length; j++) {                            if (j > 0)                                out.println("<tr><td></td>");                            out.println("<td>" + values[j] + "</td></tr>");                        }                    }                }                out.println("</table>");                out.println("<p><b>Ticket granting ticket:</b> <tt>" + ticketGrantingTicket + "</tt></p>");                // Should we try to fake a subsystem using SSO?                out.println("<hr><i>Subsystem '" + config.getProperty(RequestUtil.PROP_DEMO_SLAVE_USERNAME) + "':</i>");                if (ticketGrantingTicket == null) {                    out.println("<p align=\"center\">No ticket granting ticket was retrieved.<br>SSO denied.</p>");                } else {                    // Now get a proxy ticket for your subsystem (we're actually                    // our own subsystem, to keep the code simple).                    final String proxyTicket = getProxyTicket(ticketGrantingTicket, "demo_subsystem");                    // We now have a proxy ticket; now let's fake our own                    // subsystem. Retrieve and display some attributes.                    attributes = proxyAuthentication(convert(config.getProperty(RequestUtil.PROP_DEMO_SLAVE_ATTRIBUTE_REQUEST)), proxyTicket);                    out.println("<table align=\"center\"><tr><td><b>Attribute Name</b></td><td><b>Attribute Value(s)</b></td></tr>");                    for (int i = 0; i < attributes.length; i++) {                        // Show the actual attribute and its values.                        String name = attributes[i].getName();                        out.println("<tr><td>" + name + "</td>");                        String[] values = attributes[i].getValues();                        for (int j = 0; j < values.length; j++) {                            if (j > 0)                                out.println("<tr><td></td>");                            out.println("<td>" + values[j] + "</td></tr>");                        }                    }                    out.println("</table>");                    out.println("<p><b>Proxy ticket:</b> <tt>" + proxyTicket + "</tt></p>");                }                // We're done!                out.println("</html></body>");            }        } catch (RemoteException e) {            log.logCritical("RemoteException caught", e);            throw new ServletException(e);        }    }