package org.intermine.web.struts;

/*
 * Copyright (C) 2002-2011 FlyMine
 *
 * This code may be freely distributed and modified under the
 * terms of the GNU Lesser General Public Licence.  This should
 * be distributed with the code.  See the LICENSE file for more
 * information or http://www.gnu.org/copyleft/lesser.html.
 *
 */

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.tiles.ComponentContext;
import org.apache.struts.tiles.actions.TilesAction;

/**
 * Controller for the login page.
 *
 * @author Kim Rutherford
 */

public class LoginController extends TilesAction
{
    /**
     * Set up the form for login.
     * {@inheritDoc}
     */
    @Override
    public ActionForward execute(@SuppressWarnings("unused") ComponentContext context,
                                 @SuppressWarnings("unused") ActionMapping mapping,
                                 ActionForm form,
                                 HttpServletRequest request,
                                 @SuppressWarnings("unused") HttpServletResponse response)
        throws Exception {
        LoginForm loginForm = (LoginForm) form;
        String returnToString = request.getParameter("returnto");
        loginForm.setReturnToString(returnToString);
        return null;
    }
}

@@ -326,16 +326,78 @@
  *%0A */%0A%0A
+import java.util.Properties;%0Aimport java.util.regex.Pattern;%0A%0A
 import j
@@ -434,16 +434,16 @@
 equest;%0A
-
 import j
@@ -484,47 +484,8 @@
 nse;
-%0Aimport javax.servlet.http.HttpSession;
 %0A%0Aim
@@ -720,16 +720,71 @@
 sAction;
+%0Aimport org.intermine.web.logic.session.SessionMethods;
 %0A%0A/**%0A *
@@ -1385,16 +1385,17 @@
 ption %7B%0A
+%0A
         
@@ -1500,16 +1500,16 @@
 rnto%22);%0A
-
         
@@ -1553,16 +1553,310 @@
 tring);%0A
+%0A        Properties webprops = SessionMethods.getWebProperties(request);%0A        String ourPath = webprops.getProperty(%22webapp.path%22);%0A        boolean isLocal = Pattern.compile(%22%5C%5Cw+%5C%5C.%5C%5Cw+:%5C%5Cd%7B4%7D%22).matcher(ourPath).matches();%0A        request.setAttribute(%22isExternallyAccessible%22, !isLocal);%0A%0A
         

Disable open id on local webapps (for our purposes we shall say that is ones with explicit port addresses)