From 87022ad2a0349859b6a0995178b57a04eb235e86 Mon Sep 17 00:00:00 2001 From: Juan Carlos Luciani Date: Thu, 7 Jun 2007 22:29:11 +0000 Subject: [PATCH] More fixes to take care of the issue of authenticating users which exist in containers with names that contain reserved XML characters. --- .../server-java/Svc/linux/Makefile.am | 2 +- .../casa/authtoksvc/CasaIdentityToken.java | 63 ++++++++----------- .../Svc/tomcat5/conf/catalina.properties | 2 +- 3 files changed, 27 insertions(+), 40 deletions(-) diff --git a/CASA-auth-token/server-java/Svc/linux/Makefile.am b/CASA-auth-token/server-java/Svc/linux/Makefile.am index 15b4ebf2..1387b490 100644 --- a/CASA-auth-token/server-java/Svc/linux/Makefile.am +++ b/CASA-auth-token/server-java/Svc/linux/Makefile.am @@ -145,7 +145,7 @@ CLASSES = $(addprefix $(BUILDDIR)/, $(JAVAFILES:%.java=%.class)) XMLSEC_LIBS = $(XMLSEC_JARS_DIR)/xmlsec-1.4.0.jar -LIBS = /usr/share/java/servletapi5.jar:/usr/share/java/xerces-j2.jar:/usr/share/java/log4j.jar +LIBS = /usr/share/java/servletapi5.jar:/usr/share/java/xerces-j2.jar:/usr/share/java/log4j.jar:/usr/share/java/jakarta-commons-lang.jar if LIB64 CASA_JAR = /usr/lib64/miCASA.jar else diff --git a/CASA-auth-token/server-java/Svc/src/com/novell/casa/authtoksvc/CasaIdentityToken.java b/CASA-auth-token/server-java/Svc/src/com/novell/casa/authtoksvc/CasaIdentityToken.java index 6152084a..cfccab8c 100644 --- a/CASA-auth-token/server-java/Svc/src/com/novell/casa/authtoksvc/CasaIdentityToken.java +++ b/CASA-auth-token/server-java/Svc/src/com/novell/casa/authtoksvc/CasaIdentityToken.java @@ -336,9 +336,6 @@ public final class CasaIdentityToken implements IdentityToken // Verify that we are processing the expected tag if (idElementName.equalsIgnoreCase(qName)) { - // Un-escape the identity id - m_casaIdentToken.m_identityId = StringEscapeUtils.unescapeXml(m_casaIdentToken.m_identityId); - // Advance to the next state m_state = AWAITING_SOURCE_NAME_ELEMENT_START; } @@ -406,40 +403,6 @@ public final class CasaIdentityToken implements IdentityToken break; case AWAITING_ATTRIBUTE_END: - - // If necessary, un-escape the attribute data. - if (!m_encryptedAttrs) - { - Attribute attrib = m_casaIdentToken.m_attributes.remove(m_currAttribute); - if (attrib != null) - { - try - { - String attribData = (String) attrib.get(); - if (attribData != null) - { - m_casaIdentToken.m_attributes.put(m_currAttribute, - StringEscapeUtils.unescapeXml(attribData)); - } - else - { - m_log.error("SAXHandler.endElement()- Attribute data not found"); - throw new SAXException("Attribute data not found"); - } - } - catch (NamingException e) - { - m_log.error("SAXHandler.endElement()- Attribute data not found"); - throw new SAXException("Attribute data not found", e); - } - } - else - { - m_log.error("SAXHandler.endElement()- Attribute not found"); - throw new SAXException("Attribute not found"); - } - } - // Advance to the next state m_state = AWAITING_ATTRIBUTE_START; break; @@ -511,7 +474,6 @@ public final class CasaIdentityToken implements IdentityToken // Proceed based on our state switch (m_state) { - case AWAITING_ID_DATA: // Consume the data m_casaIdentToken.m_identityId = new String(ch, start, length); @@ -520,6 +482,11 @@ public final class CasaIdentityToken implements IdentityToken m_state = AWAITING_ID_ELEMENT_END; break; + case AWAITING_ID_ELEMENT_END: + // Consume the data + m_casaIdentToken.m_identityId = m_casaIdentToken.m_identityId.concat(new String(ch, start, length)); + break; + case AWAITING_SOURCE_NAME_DATA: // Consume the data m_casaIdentToken.m_sourceName = new String(ch, start, length); @@ -528,6 +495,11 @@ public final class CasaIdentityToken implements IdentityToken m_state = AWAITING_SOURCE_NAME_ELEMENT_END; break; + case AWAITING_SOURCE_NAME_ELEMENT_END: + // Consume the data + m_casaIdentToken.m_sourceName = m_casaIdentToken.m_sourceName.concat(new String(ch, start, length)); + break; + case AWAITING_SOURCE_URL_DATA: // Consume the data m_casaIdentToken.m_sourceUrl = new String(ch, start, length); @@ -536,6 +508,11 @@ public final class CasaIdentityToken implements IdentityToken m_state = AWAITING_SOURCE_URL_ELEMENT_END; break; + case AWAITING_SOURCE_URL_ELEMENT_END: + // Consume the data + m_casaIdentToken.m_sourceUrl = m_casaIdentToken.m_sourceUrl.concat(new String(ch, start, length)); + break; + case AWAITING_TARGET_SERVICE_DATA: // Consume the data m_casaIdentToken.m_service = new String(ch, start, length); @@ -544,6 +521,11 @@ public final class CasaIdentityToken implements IdentityToken m_state = AWAITING_TARGET_SERVICE_ELEMENT_END; break; + case AWAITING_TARGET_SERVICE_ELEMENT_END: + // Consume the data + m_casaIdentToken.m_service = m_casaIdentToken.m_service.concat(new String(ch, start, length)); + break; + case AWAITING_TARGET_HOST_DATA: // Consume the data m_casaIdentToken.m_host = new String(ch, start, length); @@ -560,6 +542,11 @@ public final class CasaIdentityToken implements IdentityToken m_state = AWAITING_TARGET_HOST_ELEMENT_END; break; + case AWAITING_TARGET_HOST_ELEMENT_END: + // Consume the data + m_casaIdentToken.m_host = m_casaIdentToken.m_host.concat(new String(ch, start, length)); + break; + case AWAITING_ATTRIBUTE_DATA: // Consume the data // diff --git a/CASA-auth-token/server-java/Svc/tomcat5/conf/catalina.properties b/CASA-auth-token/server-java/Svc/tomcat5/conf/catalina.properties index cf01fde5..9657833d 100644 --- a/CASA-auth-token/server-java/Svc/tomcat5/conf/catalina.properties +++ b/CASA-auth-token/server-java/Svc/tomcat5/conf/catalina.properties @@ -54,4 +54,4 @@ server.loader=${catalina.home}/server/classes,${catalina.home}/server/lib/*.jar # "foo/*.jar": Add all the JARs of the specified folder as class # repositories # "foo/bar.jar": Add bar.jar as a class repository -shared.loader=${catalina.base}/shared/classes,${catalina.base}/shared/lib/*.jar,/usr/share/java/identity-abstraction/*.jar,/usr/share/java/CASA/*.jar +shared.loader=${catalina.base}/shared/classes,${catalina.base}/shared/lib/*.jar,/usr/share/java/identity-abstraction/*.jar,/usr/share/java/CASA/*.jar,/usr/share/java/*.jar