Converted to use separate wayf config file and sites config file.
authorwassa <wassa@ab3bd59b-922f-494d-bb5f-6f0a3c29deca>
Mon, 17 Jun 2002 22:49:38 +0000 (22:49 +0000)
committerwassa <wassa@ab3bd59b-922f-494d-bb5f-6f0a3c29deca>
Mon, 17 Jun 2002 22:49:38 +0000 (22:49 +0000)
git-svn-id: https://subversion.switch.ch/svn/shibboleth/java-idp/trunk@140 ab3bd59b-922f-494d-bb5f-6f0a3c29deca

15 files changed:
src/edu/internet2/middleware/shibboleth/common/ServletDigester.java
src/edu/internet2/middleware/shibboleth/wayf/Origin.java
src/edu/internet2/middleware/shibboleth/wayf/OriginSet.java
src/edu/internet2/middleware/shibboleth/wayf/OriginSitesDigester.java [new file with mode: 0755]
src/edu/internet2/middleware/shibboleth/wayf/WayfCacheFactory.java
src/edu/internet2/middleware/shibboleth/wayf/WayfConfig.java
src/edu/internet2/middleware/shibboleth/wayf/WayfConfigDigester.java
src/edu/internet2/middleware/shibboleth/wayf/WayfOrigins.java
src/edu/internet2/middleware/shibboleth/wayf/WayfService.java
src/schemas/wayfconfig.xsd [new file with mode: 0755]
webApplication/WEB-INF/conf/shibboleth.xml [deleted file]
webApplication/WEB-INF/conf/sites.xml [new file with mode: 0755]
webApplication/WEB-INF/conf/wayfconfig.xml [new file with mode: 0755]
webApplication/wayf.jsp
webApplication/wayferror.jsp

index bdf3260..4688327 100755 (executable)
@@ -58,7 +58,7 @@ public class ServletDigester extends Digester {
                        }
                        if (xsdFile.endsWith(".xsd")) {
                                InputStream stream =
-                                       context.getResourceAsStream("/WEB-INF/schemas/" + xsdFile);
+                                       context.getResourceAsStream("/WEB-INF/classes/schemas/" + xsdFile);
                                if (stream != null) {
                                        return new InputSource(stream);
                                }
index 2f7bbb9..114a272 100755 (executable)
@@ -76,13 +76,13 @@ public class Origin {
      * Determines if a given string matches one of the registered names/aliases of this origin.
      * @param str The string to match on
      */
-    public boolean isMatch(String str) {
+    public boolean isMatch(String str, WayfConfig config) {
 
         Enumeration input = new StringTokenizer(str);
         while (input.hasMoreElements()) {
             String currentToken = (String) input.nextElement();
 
-            if (WayfConfig.isIgnoredForMatch(currentToken)) {
+            if (config.isIgnoredForMatch(currentToken)) {
                 continue;
             }
 
index 9044b52..a583498 100755 (executable)
@@ -2,6 +2,8 @@ package edu.internet2.middleware.shibboleth.wayf;
 
 import java.util.ArrayList;
 
+import org.apache.log4j.Logger;
+
 /**
  * This class is used to create logical groupings of shibboleth Origin Sites.
  * Each grouping is associated with a textual name that might be displayed 
@@ -13,39 +15,25 @@ import java.util.ArrayList;
 public class OriginSet {
 
        private ArrayList origins = new ArrayList();
-       ;
+       private static Logger log = Logger.getLogger(OriginSet.class.getName());
        private String name;
 
-       /**
-        * Gets the name.
-        * @return Returns a String
-        */
+
        public String getName() {
                return name;
        }
 
-       /**
-        * Sets the name.
-        * @param name The name to set
-        */
        public void setName(String name) {
                this.name = name;
        }
 
-       /**
-        * Gets the origins.
-        * @return Returns a Origin[]
-        */
        public Origin[] getOrigins() {
                return (Origin[]) origins.toArray(new Origin[0]);
        }
 
-       /**
-        * Sets the origins.
-        * @param origins The origins to set
-        */
        public void addOrigin(Origin origin) {
                origins.add(origin);
+               log.debug("Adding an origin site to configuration.");
        }
 
 }
diff --git a/src/edu/internet2/middleware/shibboleth/wayf/OriginSitesDigester.java b/src/edu/internet2/middleware/shibboleth/wayf/OriginSitesDigester.java
new file mode 100755 (executable)
index 0000000..b1ba1de
--- /dev/null
@@ -0,0 +1,87 @@
+package edu.internet2.middleware.shibboleth.wayf;
+
+import javax.servlet.ServletContext;
+import javax.xml.parsers.SAXParser;
+
+import org.xml.sax.XMLReader;
+
+import edu.internet2.middleware.shibboleth.common.ServletDigester;
+
+/**
+ * @author Administrator
+ *
+ * To change this generated comment edit the template variable "typecomment":
+ * Window>Preferences>Java>Templates.
+ * To enable and disable the creation of type comments go to
+ * Window>Preferences>Java>Code Generation.
+ */
+public class OriginSitesDigester extends ServletDigester {
+       
+           protected String originClass =
+                "edu.internet2.middleware.shibboleth.wayf.Origin";
+        protected String wayfDataClass =
+                "edu.internet2.middleware.shibboleth.wayf.WayfOrigins";
+        protected String originSetClass =
+                "edu.internet2.middleware.shibboleth.wayf.OriginSet";
+
+       private boolean configured = false;
+
+       /**
+        * Constructor for OriginSitesDigester.
+        */
+       public OriginSitesDigester() {
+               super();
+       }
+
+       /**
+        * Constructor for OriginSitesDigester.
+        * @param context
+        */
+       public OriginSitesDigester(ServletContext context) {
+               super(context);
+       }
+
+       /**
+        * Constructor for OriginSitesDigester.
+        * @param parser
+        */
+       public OriginSitesDigester(SAXParser parser) {
+               super(parser);
+       }
+
+       /**
+        * Constructor for OriginSitesDigester.
+        * @param reader
+        */
+       public OriginSitesDigester(XMLReader reader) {
+               super(reader);
+       }
+       
+               /**
+        * @see Digester#configure()
+        */
+       protected void configure() {
+
+               if (configured == true) {
+                       return;
+               }
+               addObjectCreate("Sites", wayfDataClass);
+               addObjectCreate("Sites/SiteGroup", originSetClass);
+               addSetNext("Sites/SiteGroup", "addOriginSet", originSetClass);
+               addCallMethod("Sites/SiteGroup", "setName", 1);
+               addCallParam("Sites/SiteGroup", 0, "Name");
+               addObjectCreate("Sites/SiteGroup/OriginSite", originClass);
+               addSetNext("Sites/SiteGroup/OriginSite", "addOrigin", originClass);
+               addCallMethod("Sites/SiteGroup/OriginSite", "setName", 1);
+               addCallParam("Sites/SiteGroup/OriginSite", 0, "Name");
+               addSetProperties("Sites/SiteGroup/OriginSite");
+               addCallMethod("Sites/SiteGroup/OriginSite/Alias", "addAlias", 0);
+               addCallMethod("Sites/SiteGroup/OriginSite", "setHandleService", 1);
+               addCallParam("Sites/SiteGroup/OriginSite/HandleService", 0, "Location");
+
+               configured = true;
+
+       }
+
+}
+
index 267d98a..217096c 100755 (executable)
@@ -13,13 +13,13 @@ public class WayfCacheFactory {
        private static Logger log =
                Logger.getLogger(WayfCacheFactory.class.getName());
 
-       public static WayfCache getInstance() {
+       public static WayfCache getInstance(String cacheType) {
 
-               if (WayfConfig.getCache().equals("NONE")) {
+               if (cacheType.equals("NONE")) {
                        return new NullWayfCache();
-               } else if (WayfConfig.getCache().equals("SESSION")) {
+               } else if (cacheType.equals("SESSION")) {
                        return new SessionWayfCache();
-               } else if (WayfConfig.getCache().equals("COOKIES")) {
+               } else if (cacheType.equals("COOKIES")) {
                        return new CookieWayfCache();
                } else {
                        log.warn(
index 18715c4..1ad991e 100755 (executable)
@@ -14,79 +14,60 @@ public class WayfConfig {
 
        private static Logger log = Logger.getLogger(WayfConfig.class.getName());
 
-       private static WayfOrigins wd;
-       private static String location;
-       private static String logoLocation = "images/internet2.gif";
-       private static String supportContact = "mailto:shib-support@internet2.org";
-       private static String helpText =
+       private String logoLocation = "images/internet2.gif";
+       private String supportContact = "mailto:shib-support@internet2.org";
+       private String helpText =
                "In order to fulfill the request for the  web resource you "
                        + "have just chosen, information must first be obtained from "
                        + "your home institution. Please select the institution with "
                        + "which you are affiliated.";
-       private static String searchResultEmptyText =
-               "No institution found that matches your search "
-                       + "criteria, please try again.";
-       private static HashSet ignoredForMatch = new HashSet();
+       private String searchResultEmptyText =
+               "No institution found that matches your search " + "criteria, please try again.";
+       private HashSet ignoredForMatch = new HashSet();
 
-       private static String cache = "SESSION";
+       private String cacheType = "COOKIES";
 
        public WayfConfig() {
                super();
        }
 
-       public static WayfOrigins getWAYFData() {
-               return wd;
-       }
-
-       public void setWAYFData(WayfOrigins wd) {
-               WayfConfig.wd = wd;
-       }
-
-       public static String getSearchResultEmptyText() {
+       public String getSearchResultEmptyText() {
                return searchResultEmptyText;
        }
 
        public void setSearchResultEmptyText(String searchResultEmptyText) {
-               WayfConfig.searchResultEmptyText = searchResultEmptyText;
+               this.searchResultEmptyText = searchResultEmptyText;
        }
 
-       public static String getHelpText() {
+       public String getHelpText() {
                return helpText;
        }
 
        public void setHelpText(String helpText) {
-               WayfConfig.helpText = helpText;
+               this.helpText = helpText;
        }
 
-       public static String getSupportContact() {
+       public String getSupportContact() {
                return supportContact;
        }
 
        public void setSupportContact(String supportContact) {
-               WayfConfig.supportContact = supportContact;
+               this.supportContact = supportContact;
        }
 
-       public static String getLogoLocation() {
+       public String getLogoLocation() {
                return logoLocation;
        }
 
        public void setLogoLocation(String logoLocation) {
-               WayfConfig.logoLocation = logoLocation;
-       }
-
-       public static String getLocation() {
-               return location;
-       }
-
-       public void setLocation(String location) {
-               WayfConfig.location = location;
+               this.logoLocation = logoLocation;
        }
 
        /**
         * Determines if a particular string token should be used for matching when a user searches for origins.
         * @param str The string to lookup
         */
-       public static boolean isIgnoredForMatch(String str) {
+       public boolean isIgnoredForMatch(String str) {
 
                if (ignoredForMatch.contains(str.toLowerCase())) {
                        return true;
@@ -104,18 +85,17 @@ public class WayfConfig {
                ignoredForMatch.add(s.toLowerCase());
        }
 
-       public static String getCache() {
-               return cache;
+       public String getCacheType() {
+               return cacheType;
        }
 
-       public void setCache(String cache) {
+       public void setCacheType(String cache) {
                if (cache.toUpperCase().equals("NONE")
                        || cache.toUpperCase().equals("SESSION")
                        || cache.toUpperCase().equals("COOKIES")) {
-                       WayfConfig.cache = cache.toUpperCase();
+                       this.cacheType = cache.toUpperCase();
                } else {
-                       log.warn(
-                               "Cache type :" + cache + ": not recognized, using default.");
+                       log.warn("Cache type :" + cache + ": not recognized, using default.");
                }
        }
 
index dd25624..a31ed5f 100755 (executable)
@@ -1,9 +1,12 @@
 package edu.internet2.middleware.shibboleth.wayf;
 
+import javax.servlet.ServletContext;
 import javax.xml.parsers.SAXParser;
-import org.apache.commons.digester.Digester;
+
 import org.xml.sax.XMLReader;
 
+import edu.internet2.middleware.shibboleth.common.ServletDigester;
+
 /**
  * This class is a jakarta Digester style parser for the WAYF configuration file.  
  * It should populate the WayfConfig object during WAYF initilization. NOTE: It is
@@ -13,14 +16,8 @@ import org.xml.sax.XMLReader;
  * @author Walter Hoehn wassa&#064;columbia.edu
  */
 
-public class WayfConfigDigester extends Digester {
+public class WayfConfigDigester extends ServletDigester {
 
-       protected String originClass =
-               "edu.internet2.middleware.shibboleth.wayf.Origin";
-       protected String wayfDataClass =
-               "edu.internet2.middleware.shibboleth.wayf.WayfOrigins";
-       protected String originSetClass =
-               "edu.internet2.middleware.shibboleth.wayf.OriginSet";
        protected String wayfConfigClass =
                "edu.internet2.middleware.shibboleth.wayf.WayfConfig";
        private boolean configured = false;
@@ -35,17 +32,14 @@ public class WayfConfigDigester extends Digester {
                configure();
        }
 
-       public WayfConfigDigester(XMLReader reader) {
-               super(reader);
-               configure();
+       public WayfConfigDigester(ServletContext context) {
+               super(context);
        }
 
-       public String getOriginClass() {
-               return originClass;
-       }
 
-       public void setOriginClass(String originClass) {
-               this.originClass = originClass;
+       public WayfConfigDigester(XMLReader reader) {
+               super(reader);
+               configure();
        }
 
        /**
@@ -56,69 +50,20 @@ public class WayfConfigDigester extends Digester {
                if (configured == true) {
                        return;
                }
-               addObjectCreate("ShibbolethConfig", wayfConfigClass);
-               addSetProperties("ShibbolethConfig/WayfConfig");
-               addCallMethod("ShibbolethConfig/WayfConfig/HelpText", "setHelpText", 0);
+               addObjectCreate("WayfConfig", wayfConfigClass);
+               addSetProperties("WayfConfig");
+               addCallMethod("WayfConfig/HelpText", "setHelpText", 0);
                addCallMethod(
-                       "ShibbolethConfig/WayfConfig/SearchResultEmptyText",
+                       "WayfConfig/SearchResultEmptyText",
                        "setSearchResultEmptyText",
                        0);
                addCallMethod(
-                       "ShibbolethConfig/WayfConfig/SearchIgnore/String",
+                       "WayfConfig/SearchIgnore/IgnoreText",
                        "addIgnoredForMatch",
                        0);
 
-               addObjectCreate("ShibbolethConfig/CommonConfig", wayfDataClass);
-               addSetNext(
-                       "ShibbolethConfig/CommonConfig",
-                       "setWAYFData",
-                       wayfDataClass);
-
-               addObjectCreate(
-                       "ShibbolethConfig/CommonConfig/OriginSet",
-                       originSetClass);
-               addSetNext(
-                       "ShibbolethConfig/CommonConfig/OriginSet",
-                       "addOriginSet",
-                       originSetClass);
-               addSetProperties("ShibbolethConfig/CommonConfig/OriginSet");
-
-               addObjectCreate(
-                       "ShibbolethConfig/CommonConfig/OriginSet/Origin",
-                       originClass);
-               addSetNext(
-                       "ShibbolethConfig/CommonConfig/OriginSet/Origin",
-                       "addOrigin",
-                       originClass);
-               addSetProperties("ShibbolethConfig/CommonConfig/OriginSet/Origin");
-
-               addCallMethod(
-                       "ShibbolethConfig/CommonConfig/OriginSet/Origin/Alias",
-                       "addAlias",
-                       1);
-               addCallParam(
-                       "ShibbolethConfig/CommonConfig/OriginSet/Origin/Alias",
-                       0,
-                       "name");
-
                configured = true;
 
        }
 
-       public String getOriginSetClass() {
-               return originSetClass;
-       }
-
-       public void setOriginSetClass(String originSetClass) {
-               this.originSetClass = originSetClass;
-       }
-
-       public String getWayfDataClass() {
-               return wayfDataClass;
-       }
-
-       public void setWayfDataClass(String wayfDataClass) {
-               this.wayfDataClass = wayfDataClass;
-       }
-
 }
\ No newline at end of file
index b0110b9..880ce7c 100755 (executable)
@@ -4,6 +4,8 @@ import java.util.ArrayList;
 import java.util.HashSet;
 import java.util.Iterator;
 
+import org.apache.log4j.Logger;
+
 /**
  * This class is a container for OriginSets, allowing lookup and searching of the same.
  * 
@@ -13,6 +15,7 @@ import java.util.Iterator;
 public class WayfOrigins {
 
        private ArrayList originSets = new ArrayList();
+       private static Logger log = Logger.getLogger(WayfOrigins.class.getName());
 
        public OriginSet[] getOriginSets() {
                return (OriginSet[]) originSets.toArray(new OriginSet[0]);
@@ -20,6 +23,7 @@ public class WayfOrigins {
 
        public void addOriginSet(OriginSet originSet) {
                originSets.add(originSet);
+               log.debug("Adding an origin set to configuration");
        }
 
        public String lookupHSbyName(String originName) {
@@ -41,7 +45,7 @@ public class WayfOrigins {
 
        }
 
-       public Origin[] seachForMatchingOrigins(String searchString) {
+       public Origin[] seachForMatchingOrigins(String searchString, WayfConfig config) {
 
                Iterator originSetIt = originSets.iterator();
                HashSet searchResults = new HashSet();
@@ -50,7 +54,7 @@ public class WayfOrigins {
                        OriginSet originSet = (OriginSet) originSetIt.next();
                        Origin[] origins = originSet.getOrigins();
                        for (int i = 0;(i < origins.length); i++) {
-                               if (origins[i].isMatch(searchString)) {
+                               if (origins[i].isMatch(searchString, config)) {
                                        searchResults.add(origins[i]);
                                }
                        }
index b9a0c58..7328793 100755 (executable)
@@ -6,6 +6,7 @@ import java.net.URLEncoder;
 
 import javax.servlet.RequestDispatcher;
 import javax.servlet.ServletException;
+import javax.servlet.UnavailableException;
 import javax.servlet.http.HttpServlet;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
@@ -24,6 +25,9 @@ import org.xml.sax.SAXException;
 public class WayfService extends HttpServlet {
 
        private String wayfConfigFileLocation;
+       private String siteConfigFileLocation;
+       private WayfConfig config;
+       private WayfOrigins originConfig;
        private static Logger log = Logger.getLogger(WayfService.class.getName());
 
        /**
@@ -32,38 +36,51 @@ public class WayfService extends HttpServlet {
        public void init() throws ServletException {
 
                super.init();
+               log.info("Initializing WAYF.");
                loadInitParams();
-               //initialize configuration from file
+               log.info("Loading configuration from file.");
                InputStream is = getServletContext().getResourceAsStream(wayfConfigFileLocation);
-               WayfConfigDigester digester = new WayfConfigDigester();
+               WayfConfigDigester digester = new WayfConfigDigester(getServletContext());
+               
+               InputStream siteIs = getServletContext().getResourceAsStream(siteConfigFileLocation);
+               OriginSitesDigester siteDigester = new OriginSitesDigester(getServletContext());
+               
                try {
-                       digester.parse(is);
+                       //digester.setValidating(true);
+                       config = (WayfConfig) digester.parse(is);
+                       
+                       //siteDigester.setValidating(true);
+                       originConfig = (WayfOrigins) siteDigester.parse(siteIs);
+                       
+                       
                } catch (SAXException se) {
                        log.fatal("Error parsing WAYF configuration file.", se);
-                       throw new ServletException("Error parsing WAYF configuration file.", se);
+                       throw new UnavailableException("Error parsing WAYF configuration file.");
                } catch (IOException ioe) {
                        log.fatal("Error reading WAYF configuration file.", ioe);
-                       throw new ServletException("Error reading WAYF configuration file.", ioe);
+                       throw new UnavailableException("Error reading WAYF configuration file.");
                }
 
                //Setup appliation-wide beans from config
-               getServletContext().setAttribute("originsets", WayfConfig.getWAYFData().getOriginSets());
-               String wayfLocation = WayfConfig.getLocation();
-               if (wayfLocation == null) {
-                       wayfLocation = "WAYF";
-               }
-               getServletContext().setAttribute("wayfLocation", wayfLocation);
-               getServletContext().setAttribute("supportContact", WayfConfig.getSupportContact());
-               getServletContext().setAttribute("helpText", WayfConfig.getHelpText());
-               getServletContext().setAttribute("searchResultEmptyText", WayfConfig.getSearchResultEmptyText());
-               getServletContext().setAttribute("logoLocation", WayfConfig.getLogoLocation());
+               getServletContext().setAttribute("originsets", originConfig.getOriginSets());
+               getServletContext().setAttribute("supportContact", config.getSupportContact());
+               getServletContext().setAttribute("helpText", config.getHelpText());
+               getServletContext().setAttribute("searchResultEmptyText", config.getSearchResultEmptyText());
+               getServletContext().setAttribute("logoLocation", config.getLogoLocation());
+               log.info("WAYF initialization completed.");
        }
 
        private void loadInitParams() {
 
                wayfConfigFileLocation = getServletConfig().getInitParameter("WAYFConfigFileLocation");
                if (wayfConfigFileLocation == null) {
-                       wayfConfigFileLocation = "/WEB-INF/conf/shibboleth.xml";
+                       log.warn("No WAYFConfigFileLocation parameter found... using default location.");
+                       wayfConfigFileLocation = "/WEB-INF/conf/wayfconfig.xml";
+               }
+               siteConfigFileLocation = getServletConfig().getInitParameter("SiteConfigFileLocation");
+               if (siteConfigFileLocation == null) {
+                       log.warn("No SiteonfigFileLocation parameter found... using default location.");
+                       siteConfigFileLocation = "/WEB-INF/conf/sites.xml";
                }
 
        }
@@ -73,11 +90,12 @@ public class WayfService extends HttpServlet {
         */
        public void doGet(HttpServletRequest req, HttpServletResponse res) {
 
+               log.info("Handling WAYF request.");
                //Tell the browser not to cache the WAYF page
                res.setHeader("Cache-Control", "no-cache");
                res.setHeader("Pragma", "no-cache");
                res.setDateHeader("Expires", 0);
-
+               
                //Decide how to route the request based on query string
                String requestType = req.getParameter("action");
                if (requestType == null) {
@@ -85,10 +103,11 @@ public class WayfService extends HttpServlet {
                }
                try {
                        if (requestType.equals("deleteFromCache")) {
-                               WayfCacheFactory.getInstance().deleteHsFromCache(req, res);
+                               log.debug("Deleting saved HS from cache");
+                               WayfCacheFactory.getInstance(config.getCacheType()).deleteHsFromCache(req, res);
                                handleLookup(req, res);
-                       } else if (WayfCacheFactory.getInstance().hasCachedHS(req)) {
-                               handleRedirect(req, res, WayfCacheFactory.getInstance().getCachedHS(req));
+                       } else if (WayfCacheFactory.getInstance(config.getCacheType()).hasCachedHS(req)) {
+                               handleRedirect(req, res, WayfCacheFactory.getInstance(config.getCacheType()).getCachedHS(req));
                        } else if (requestType.equals("search")) {
                                handleSearch(req, res);
                        } else if (requestType.equals("selection")) {
@@ -110,7 +129,8 @@ public class WayfService extends HttpServlet {
                req.setAttribute("target", getTarget(req));
                req.setAttribute("encodedShire", URLEncoder.encode(getSHIRE(req)));
                req.setAttribute("encodedTarget", URLEncoder.encode(getTarget(req)));
-
+               
+               log.debug("Displaying WAYF selection page.");
                RequestDispatcher rd = req.getRequestDispatcher("/wayf.jsp");
                try {
                        rd.forward(req, res);
@@ -124,7 +144,7 @@ public class WayfService extends HttpServlet {
        private void handleSearch(HttpServletRequest req, HttpServletResponse res) throws WayfException {
 
                if (req.getParameter("string") != null) {
-                       Origin[] origins = WayfConfig.getWAYFData().seachForMatchingOrigins(req.getParameter("string"));
+                       Origin[] origins = originConfig.seachForMatchingOrigins(req.getParameter("string"), config);
                        if (origins.length != 0) {
                                req.setAttribute("searchresults", origins);
                        } else {
@@ -137,11 +157,11 @@ public class WayfService extends HttpServlet {
 
        private void handleSelection(HttpServletRequest req, HttpServletResponse res) throws WayfException {
 
-               String handleService = WayfConfig.getWAYFData().lookupHSbyName(req.getParameter("origin"));
+               String handleService = originConfig.lookupHSbyName(req.getParameter("origin"));
                if (handleService == null) {
                        handleLookup(req, res);
                } else {
-                       WayfCacheFactory.getInstance().addHsToCache(handleService, req, res);
+                       WayfCacheFactory.getInstance(config.getCacheType()).addHsToCache(handleService, req, res);
                        handleRedirect(req, res, handleService);
                }
 
@@ -149,10 +169,10 @@ public class WayfService extends HttpServlet {
 
        private void handleRedirect(HttpServletRequest req, HttpServletResponse res, String handleService)
                throws WayfException {
-
+               
                String shire = getSHIRE(req);
                String target = getTarget(req);
-
+               log.info("Redirecting to selected Handle Service");
                try {
                        res.sendRedirect(
                                handleService
@@ -169,7 +189,9 @@ public class WayfService extends HttpServlet {
        private void handleError(HttpServletRequest req, HttpServletResponse res, WayfException we) {
 
                log.error("WAYF Failure: " + we.toString());
+               log.debug("Displaying WAYF error page.");
                req.setAttribute("errorText", we.toString());
+               req.setAttribute("requestURL", req.getRequestURI().toString());
                RequestDispatcher rd = req.getRequestDispatcher("/wayferror.jsp");
 
                try {
diff --git a/src/schemas/wayfconfig.xsd b/src/schemas/wayfconfig.xsd
new file mode 100755 (executable)
index 0000000..52df726
--- /dev/null
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Schema for the Shibboleth WAYF Service configuration file - Walter Hoehn - 06/14/2002 -->
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="unqualified">
+        <xs:element name="WayfConfig" >
+                <xs:complexType>             
+                       <xs:sequence>
+                                <xs:element name="HelpText" type="xs:string" minOccurs="0" maxOccurs="1"/>
+                                <xs:element name="SearchResultEmptyText" type="xs:string" minOccurs="0" maxOccurs="1"/>
+                                <xs:element name="SearchIgnore" minOccurs="0" maxOccurs="1">
+                                               <xs:complexType>
+                                                                                       <xs:sequence>
+                                                                                               <xs:element name="IgnoreText" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
+                                                                                       </xs:sequence>
+                                                                               </xs:complexType>
+                                       </xs:element>
+                    </xs:sequence>
+                    <xs:attribute name="supportContact" type="xs:string" use="optional"/>
+                    <xs:attribute name="logoLocation" type="xs:string" use="optional"/>
+                    <xs:attribute name="cacheType" type="xs:string" use="optional"/>
+                </xs:complexType>
+        </xs:element>
+</xs:schema>
diff --git a/webApplication/WEB-INF/conf/shibboleth.xml b/webApplication/WEB-INF/conf/shibboleth.xml
deleted file mode 100755 (executable)
index 5a66dcb..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-<?xml version="1.0"?>
-<ShibbolethConfig>
-
-       <CommonConfig>
-       <OriginSet name="Higher Education">
-               <Origin name="Carnegie Mellon" handleService="https://nada.andrew.cmu.edu/shibb/servlet/HandleServlet">
-                       <Alias name="cmu" />
-                       <Alias name="Tartans" />
-               </Origin>
-               <Origin name="The Ohio State University" handleService="https://usfs2.us.ohio-state.edu/webdev/Shibboleth/secure/servlet/HandleServlet">
-                       <Alias name="osu" />
-                       <Alias name="Buckeyes" />
-               </Origin>
-               <Origin name="University of Washington" handleService="https://abajo.cac.washington.edu/shibb/servlet/HandleServlet">
-                       <Alias name="uwash" />
-                       <Alias name="Huskies" />
-               </Origin>
-               <Origin name="Brown University" handleService="http://dilbert2.cis.brown.edu:1080/shibb/servlet/HandleServlet">
-                       <Alias name="Bears" />
-               </Origin>
-       </OriginSet>
-       <OriginSet name="Other">
-               <Origin name="Walter's Test" handleService="http://wassa.org:8080/shibb/servlet/HandleServlet">
-                       <Alias name="wassa" />
-                       <Alias name="columbia" />
-               </Origin>
-               <Origin name="Internet2" handleService="https://shib2.internet2.edu/shibb/servlet/HandleServlet">
-                       <Alias name="I2" />
-               </Origin>
-       </OriginSet>
-       </CommonConfig>
-       
-       <WayfConfig cache="COOKIES" 
-               supportContact="mailto:shib-test@internet2.org"
-               logoLocation="images/internet2.gif">
-               <SearchIgnore>
-                       <String>Institution</String>
-                       <String>University</String>
-                       <String>State </String>
-                       <String>School</String>
-               </SearchIgnore>
-       </WayfConfig>
-
-</ShibbolethConfig>
diff --git a/webApplication/WEB-INF/conf/sites.xml b/webApplication/WEB-INF/conf/sites.xml
new file mode 100755 (executable)
index 0000000..bf3842b
--- /dev/null
@@ -0,0 +1,25 @@
+<Sites xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://shibboleth.internet2.edu/wayf/alpha-2/wayfconfig.xsd">
+<SiteGroup Name="Test">
+       <OriginSite Name="demo.edu">
+               <Alias>Demo State University</Alias>
+               <HandleService Name="shib2.internet2.edu" Location="https://shib2.internet2.edu/shibboleth-origin/servlet/HS"/>
+       </OriginSite>
+</SiteGroup>
+       <OriginSite Name="cmu.edu">
+               <Alias>Carnegie Mellon University</Alias>
+               <Alias>cmu</Alias>
+               <Alias>Tartans</Alias>
+               <HandleService Name="nada.andrew.cmu.edu" Location="https://nada.andrew.cmu.edu/shibb/servlet/HandleServlet"/>
+       </OriginSite>
+       <OriginSite Name="osu.edu">
+               <Alias>Ohio State University</Alias>
+               <Alias>osu</Alias>
+               <Alias>Buckeyes</Alias>
+               <HandleService Name="usfs2.us.ohio-state.edu" Location="https://usfs2.us.ohio-state.edu/webdev/Shibboleth/secure/servlet/HandleServlet"/>
+       </OriginSite>
+       <OriginSite Name="brown.edu">
+               <Alias>Brown University</Alias>
+               <Alias>Bears</Alias>
+               <HandleService Name="dilbert2.cis.brown.edu" Location="http://dilbert2.cis.brown.edu:1080/shibb/servlet/HandleServlet"/>
+       </OriginSite>
+</Sites>
diff --git a/webApplication/WEB-INF/conf/wayfconfig.xml b/webApplication/WEB-INF/conf/wayfconfig.xml
new file mode 100755 (executable)
index 0000000..f8c12d9
--- /dev/null
@@ -0,0 +1,14 @@
+<?xml version="1.0"?>
+<WayfConfig xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://shibboleth.internet2.edu/wayf/alpha-2/wayfconfig.xsd" 
+       cacheType="COOKIES" 
+       supportContact="mailto:shib-test@internet2.org" 
+       logoLocation="images/internet2.gif">
+       <HelpText>This is the help text.</HelpText>
+       <SearchResultEmptyText>This is the search result empty text.</SearchResultEmptyText>
+       <SearchIgnore>
+               <IgnoreText>Institution</IgnoreText>
+               <IgnoreText>University</IgnoreText>
+               <IgnoreText>State </IgnoreText>
+               <IgnoreText>School</IgnoreText>
+       </SearchIgnore>
+</WayfConfig>
index f9217a5..9007adb 100755 (executable)
@@ -5,7 +5,7 @@
        <%@ taglib uri="/WEB-INF/tlds/struts-logic.tld" prefix="logic" %>
        <%@ taglib uri="/WEB-INF/tlds/struts-bean.tld" prefix="bean" %>
        <jsp:useBean id="originsets" scope="application" class="edu.internet2.middleware.shibboleth.wayf.OriginSet[]"/>
-       <jsp:useBean id="wayfLocation" scope="application" class="java.lang.String"/>
+       <jsp:useBean id="requestURL" scope="request" class="java.lang.String"/>
        <jsp:useBean id="helpText" scope="application" class="java.lang.String"/>
        <jsp:useBean id="supportContact" scope="application" class="java.lang.String"/>
        <jsp:useBean id="shire" scope="request" class="java.lang.String"/>
                <ul>
                <logic:iterate id="currResult" name="searchresults">
                        <li>
-                       <a href="<bean:write name="wayfLocation" />?action=selection&amp;origin=<jsp:getProperty name="currResult" property="urlEncodedName" />&amp;shire=<bean:write name="encodedShire" />&amp;target=<bean:write name="encodedTarget" />"><jsp:getProperty name="currResult" property="name" /></a>
+                       <a href="<bean:write name="requestURL" />?action=selection&amp;origin=<jsp:getProperty name="currResult" property="urlEncodedName" />&amp;shire=<bean:write name="encodedShire" />&amp;target=<bean:write name="encodedTarget" />"><jsp:getProperty name="currResult" property="name" /></a>
                        </li>
                </logic:iterate>
                </ul>           
        </logic:present>
-       <form method="get" action="<bean:write name="wayfLocation" />">
+       <form method="get" action="<bean:write name="requestURL" />">
                <p>
                        <input type="hidden" name="shire" value="<bean:write name="shire" />" />
                        <input type="hidden" name="target" value="<bean:write name="target" />" />
@@ -63,7 +63,7 @@
 
 <logic:iterate id="originset" name="originsets">
 <h2><jsp:getProperty name="originset" property="name" /></h2>
-<form method="get" action="<bean:write name="wayfLocation" />">
+<form method="get" action="<bean:write name="requestURL" />">
 <p>
 <input type="hidden" name="shire" value="<bean:write name="shire" />" />
 <input type="hidden" name="target" value="<bean:write name="target" />" />
index f288a27..a6770dc 100755 (executable)
@@ -5,7 +5,7 @@
        <%@ taglib uri="/WEB-INF/tlds/struts-logic.tld" prefix="logic" %>
        <%@ taglib uri="/WEB-INF/tlds/struts-bean.tld" prefix="bean" %>
        
-       <jsp:useBean id="wayfLocation" scope="application" class="java.lang.String"/>
+       <jsp:useBean id="requestURL" scope="application" class="java.lang.String"/>
        <jsp:useBean id="errorText" scope="request" class="java.lang.String"/>
        <jsp:useBean id="supportContact" scope="application" class="java.lang.String"/>
        <jsp:useBean id="logoLocation" scope="application" class="java.lang.String"/>
@@ -26,7 +26,7 @@
 
 <p>Please email <a href="mailto:<bean:write name="supportContact" />"><bean:write name="supportContact" /></a> and include the following error message:</p>
 
-<p class="error">WAYF failure at (<bean:write name="wayfLocation" />)</p>
+<p class="error">WAYF failure at (<bean:write name="requestURL" />)</p>
 
 <p><bean:write name="errorText" /></p>