Index: lams_build/build.xml =================================================================== diff -u -r7d1d03e0cfc056fdca09be177bc1639893740403 -r4e96134b3cbfa0ee095029f40d528d821a6e2dd9 --- lams_build/build.xml (.../build.xml) (revision 7d1d03e0cfc056fdca09be177bc1639893740403) +++ lams_build/build.xml (.../build.xml) (revision 4e96134b3cbfa0ee095029f40d528d821a6e2dd9) @@ -311,6 +311,12 @@ + + + + + + - + Index: lams_build/conf/windows/authentication/lamsauthentication.xml =================================================================== diff -u -r30e760aea89a9cdcb92d8d2cf4bf8bc48bf62804 -r4e96134b3cbfa0ee095029f40d528d821a6e2dd9 --- lams_build/conf/windows/authentication/lamsauthentication.xml (.../lamsauthentication.xml) (revision 30e760aea89a9cdcb92d8d2cf4bf8bc48bf62804) +++ lams_build/conf/windows/authentication/lamsauthentication.xml (.../lamsauthentication.xml) (revision 4e96134b3cbfa0ee095029f40d528d821a6e2dd9) @@ -1,5 +1,5 @@ - + Index: lams_build/lib/lams/lams.jar =================================================================== diff -u -r186f3f31c5716f7805f67125e2cb7620c68f6e6a -r4e96134b3cbfa0ee095029f40d528d821a6e2dd9 Binary files differ Index: lams_central/src/java/org/lamsfoundation/lams/security/AuthenticationMethodConfigurer.java =================================================================== diff -u -r08950e1090443c3423a3d1c587416a2fccd8bbdf -r4e96134b3cbfa0ee095029f40d528d821a6e2dd9 --- lams_central/src/java/org/lamsfoundation/lams/security/AuthenticationMethodConfigurer.java (.../AuthenticationMethodConfigurer.java) (revision 08950e1090443c3423a3d1c587416a2fccd8bbdf) +++ lams_central/src/java/org/lamsfoundation/lams/security/AuthenticationMethodConfigurer.java (.../AuthenticationMethodConfigurer.java) (revision 4e96134b3cbfa0ee095029f40d528d821a6e2dd9) @@ -39,6 +39,7 @@ import org.lamsfoundation.lams.usermanagement.AuthenticationMethodParameter; import org.lamsfoundation.lams.usermanagement.AuthenticationMethod; import org.lamsfoundation.lams.util.XmlFileLoader; +import org.lamsfoundation.lams.util.AuthEntityResolver; /** *

@@ -70,7 +71,7 @@ throws IOException,SAXException,SAXParseException,ParserConfigurationException{ if(authConfigureDoc==null){ - authConfigureDoc = XmlFileLoader.getDocumentFromFilePath(configFilePath); + authConfigureDoc = XmlFileLoader.getDocumentFromFilePath(configFilePath, new AuthEntityResolver()); } } Index: lams_common/build.xml =================================================================== diff -u -re136309c831c4509819e7651ce2f565747bccb57 -r4e96134b3cbfa0ee095029f40d528d821a6e2dd9 --- lams_common/build.xml (.../build.xml) (revision e136309c831c4509819e7651ce2f565747bccb57) +++ lams_common/build.xml (.../build.xml) (revision 4e96134b3cbfa0ee095029f40d528d821a6e2dd9) @@ -152,6 +152,7 @@ + @@ -163,7 +164,19 @@ - + + + + + + + + + + + + + @@ -178,6 +191,11 @@ + + + + + Index: lams_common/src/java/org/lamsfoundation/lams/util/AuthEntityResolver.java =================================================================== diff -u --- lams_common/src/java/org/lamsfoundation/lams/util/AuthEntityResolver.java (revision 0) +++ lams_common/src/java/org/lamsfoundation/lams/util/AuthEntityResolver.java (revision 4e96134b3cbfa0ee095029f40d528d821a6e2dd9) @@ -0,0 +1,50 @@ +/**************************************************************** + * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org) + * ============================================================= + * License Information: http://lamsfoundation.org/licensing/lams/2.0/ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2.0 + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 + * USA + * + * http://www.gnu.org/licenses/gpl.txt + * **************************************************************** + */ +/* $$Id$$ */ +package org.lamsfoundation.lams.util; + +import java.io.InputStream; +import org.xml.sax.InputSource; +import org.xml.sax.SAXException; +import org.xml.sax.EntityResolver; + +/** + * AuthEntityResolver + * + * @author Mitchell Seaton + */ + +public class AuthEntityResolver implements EntityResolver{ + + public InputSource resolveEntity(String publicId, String systemId) throws SAXException { + if ( publicId.equals( "-//LAMS//DTD LAMS//EN" ) ) { + InputStream in = getClass().getResourceAsStream( + "org/lamsfoundation/lams/resources/lamsauthentication.dtd" + ); + return new InputSource(in); + } + return null; + } + +} + Index: lams_common/src/java/org/lamsfoundation/lams/util/XmlFileLoader.java =================================================================== diff -u -r08950e1090443c3423a3d1c587416a2fccd8bbdf -r4e96134b3cbfa0ee095029f40d528d821a6e2dd9 --- lams_common/src/java/org/lamsfoundation/lams/util/XmlFileLoader.java (.../XmlFileLoader.java) (revision 08950e1090443c3423a3d1c587416a2fccd8bbdf) +++ lams_common/src/java/org/lamsfoundation/lams/util/XmlFileLoader.java (.../XmlFileLoader.java) (revision 4e96134b3cbfa0ee095029f40d528d821a6e2dd9) @@ -37,6 +37,7 @@ import org.xml.sax.InputSource; import org.xml.sax.SAXException; import org.xml.sax.SAXParseException; +import org.xml.sax.EntityResolver; /** @@ -74,20 +75,33 @@ InputStream is = null; is = url.openStream(); - return getDocument(is); + return getDocument(is, null); } /** Get the xml file from the File Path and parse it into a Document object. * * @param filePath the file path from which the xml doc is to be obtained. * @return Document */ + public static Document getDocumentFromFilePath(String filePath, EntityResolver resolver) + throws IOException,SAXException,SAXParseException,ParserConfigurationException { + + InputStream is = null; + is = new FileInputStream(new File(filePath)); + return getDocument(is, resolver); + } + + /** Get the xml file from the File Path and parse it into a Document object. + * + * @param filePath the file path from which the xml doc is to be obtained. + * @return Document + */ public static Document getDocumentFromFilePath(String filePath) throws IOException,SAXException,SAXParseException,ParserConfigurationException { InputStream is = null; is = new FileInputStream(new File(filePath)); - return getDocument(is); + return getDocument(is, null); } /** Parses the xml document in is to create a DOM Document. DTD validation @@ -96,12 +110,12 @@ * @param is the InputStream containing the xml descriptor to parse * @return Document */ - private static Document getDocument(InputStream is) + private static Document getDocument(InputStream is, EntityResolver resolver) throws IOException,SAXException,SAXParseException,ParserConfigurationException { try{ InputSource is2 = new InputSource(is); - return getDocument(is2); + return getDocument(is2, resolver); } finally{ is.close(); @@ -114,16 +128,17 @@ * @param is the InputSource containing the xml descriptor to parse * @return Document */ - private static Document getDocument(InputSource is) + private static Document getDocument(InputSource is, EntityResolver resolver) throws IOException,SAXException,SAXParseException,ParserConfigurationException { DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory .newInstance(); // Enable DTD validation based on our validating flag docBuilderFactory.setValidating(validating); DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder(); + if(resolver != null) docBuilder.setEntityResolver(resolver); return docBuilder.parse(is); } - + }