Did you release the attributes to your application from the Services
Management tool?


On Thu, Feb 3, 2011 at 4:11 PM, pranav garg <pranav.garg...@gmail.com>wrote:

> Hi All,
>
>
> I know I am doing something wrong however not able to figure out which
> step. I need to get the extra attributes of user namely name, etc for which
> I followed the following steps.
>
> The user is successfully authenticated from CAS, but I am not getting any
> user attributes. Can somebody point out what's missing?
>
>
> Setup: CAS 3.4.5 with database MYSQL
>
>
> Steps taken at the CAS-Server:
>
> 1)   deployerConfigContext.xml
>
>
>
> <bean id="attributeRepository"
> class="org.jasig.services.persondir.support.jdbc.SingleRowJdbcPersonAttributeDao">
>
>       <constructor-arg index="0" ref="dataSource" />
>
>       <constructor-arg index="1" value="SELECT * FROM users WHERE {0}" />
>
>       <property name="queryAttributeMapping">
>
>           <map>
>
>               <entry key="username" value="id" />
>
>           </map>
>
>       </property>
>
>       <property name="resultAttributeMapping">
>
>           <map>
>
>               <entry key="id" value="username" />
>
>               <entry key="firstname" value="first_name" />
>
>               <entry key="lastname" value="last_name" />
>
>               <entry key="date_created" value="date_created" />
>
>           </map>
>
>       </property>
>
> </bean>
>
>
>
> 2)   The casServiceValidationSuccess.jsp is instrumented to display all
> the extra attributes like first_name, last_name, date_created
>
>
>
> <%@ page session="false" pageEncoding="UTF-8"
>
> %><%@ 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:if
>
>  
> test="${fn:length(assertion.chainedAuthentications[fn:length(assertion.chainedAuthentications)-1].principal.attributes)
> > 0}">     <cas:attributes>
>
> <c:forEach var="attr"
> items="${assertion.chainedAuthentications[fn:length(assertion.chainedAuthentications)-1].principal.attributes}"
>
>   varStatus="loopStatus" begin="0"
> end="${fn:length(assertion.chainedAuthentications[fn:length(assertion.chainedAuthentications)-1].principal.attributes)}"
> step="1">
>
>         <cas:attribute>
>
>           <cas:name>${fn:escapeXml(attr.key)}</cas:name>
>
>           <cas:value>${fn:escapeXml(attr.value)}</cas:value>
>
>         </cas:attribute>
>
> </c:forEach>        </cas:attributes>
>
> </c:if>
>
> <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>
>
>
>
> On the CAS-Client side I am using phpCAS. Where I am taking the following
> steps as outlined in the documentation to get the extra attributes:
>
>
> <?php
>
> foreach (phpCAS::getAttributes() as $key => $value) {
>
>   if (is_array($value)) {
>
>     echo '<li>', $key, ':<ol>';
>
>     foreach($value as $item) {
>
>       echo '<li><strong>', $item, '</strong></li>';
>
>     }
>
>     echo '</ol></li>';
>
>   } else {
>
>     echo '<li>', $key, ': <strong>', $value, '</strong></li>';
>
>   }
>
> }
>
> ?>
>
>
> The user gets successfully authenticated when I call phpCAS::getUser().
> However getAttributes() doesn't return anything.
>
>
> Any help appreciated in this regard.
>
> - Pranav
>
> --
> You are currently subscribed to cas-dev@lists.jasig.org as: 
> scott.battag...@gmail.com
>
> To unsubscribe, change settings or access archives, see 
> http://www.ja-sig.org/wiki/display/JSG/cas-dev
>
>

-- 
You are currently subscribed to cas-dev@lists.jasig.org as: 
arch...@mail-archive.com
To unsubscribe, change settings or access archives, see 
http://www.ja-sig.org/wiki/display/JSG/cas-dev

Reply via email to