Hello all, I'm wondering if someone more familiar with JSP might be able to help me solve a problem I'm having returning attributes that contain commas.
The DisplayName attribute in my Active Directory is a string that happens to be formatted as "Lastname, Firstname MiddleInitial.". I've been debugging my CAS server in Eclipse and have verified that I'm getting a single value for the attribute that looks like a string all the way through SimplePrincipal.getAttributes(). For some reason the JSP prints this string as two separate "DisplayName" attributes, the first containing just "Lastname" and the second containing "Firstname MiddleInitial." rather than a single attribute. *Some background:* I'm returning attributes in the CAS 2.0 response with the addition of the bold section to my casServiceValidationSuccess.jsp. <%@ page session="false" %><%@ taglib prefix="c" uri=" http://java.sun.com/jsp/jstl/core" %><%@ taglib uri=" http://java.sun.com/jsp/jstl/functions" prefix="fn" %><cas:serviceResponse xmlns:cas='http://www.yale.edu/tp/cas'> <cas:authenticationSuccess> <cas:user>${fn:escapeXml(assertion.chainedAuthentications[fn:length(assertion.chainedAuthentications)-1]. principal.id)}</cas:user> *<c:forEach var="auth" items="${assertion.chainedAuthentications}"> <c:forEach var="attr" items="${auth.principal.attributes}" > <c:forEach var="attrVal" items="${attr.value}"> <cas:attribute name="${fn:escapeXml(attr.key)}" value="${fn:escapeXml(attrVal)}"/> </c:forEach> </c:forEach> </c:forEach>* <c:if test="${not empty pgtIou}"> <cas:proxyGrantingTicket>${pgtIou}</cas:proxyGrantingTicket> </c:if> <c:if test="${fn:length(assertion.chainedAuthentications) > 1}"> <cas:proxies> <c:forEach var="proxy" items="${assertion.chainedAuthentications}" varStatus="loopStatus" begin="0" end="${fn:length(assertion.chainedAuthentications)-2}" step="1"> <cas:proxy>${fn:escapeXml(proxy.principal.id)}</cas:proxy> </c:forEach> </cas:proxies> </c:if> </cas:authenticationSuccess> </cas:serviceResponse> The inner *<c:forEach var="attrVal" items="${attr.value}">* loop was added because some attributes (such as "MemberOf") are multi-valued collections of strings. My problem is that strings that contain commas also get split up into multiple attributes. For example, even though my "DisplayName" attribute is properly returned as a single 15 character string "Franco, Adam S.", it gets split into two separate attributes: <cas:serviceResponse xmlns:cas='http://www.yale.edu/tp/cas'> <cas:authenticationSuccess> <cas:user>B0F836FCDADFDDFF7A17C02C62CDB227</cas:user> <cas:attribute name="Status" value="Staff"/> <cas:attribute name="EMail" value="[email protected]"/> <cas:attribute name="MemberOf" value="CN=All Staff,OU=General,OU=Groups,DC=middlebury,DC=edu"/> <cas:attribute name="MemberOf" value="CN=Blog Administrators,OU=General,OU=Groups,DC=middlebury,DC=e du"/> <cas:attribute name="FirstName" value="Adam"/> <cas:attribute name="DisplayName" value="Franco"/> <cas:attribute name="DisplayName" value=" Adam S."/> <cas:attribute name="LastName" value="Franco"/> </cas:authenticationSuccess> </cas:serviceResponse> Can anyone provide insight on how to print multiple attribute entries for collections but not for strings that just happen to contain a comma? Thanks! Adam -- Adam Franco Senior Software Engineer - Web Applications Library and Information Services Middlebury College Middlebury, VT 05753 [email protected] 802.443.2244 -- You are currently subscribed to [email protected] as: [email protected] To unsubscribe, change settings or access archives, see http://www.ja-sig.org/wiki/display/JSG/cas-user
