I'll try to give farther explanation:

I expect my multi-value Attribute: PERMISSION_NAME to be king of list or 
anything other type which hold multi valued results.

However I get only the first one: ROLE_PERMISSIONS_MY_EVENTS.

Any idea why ?



-----Original Message-----
From: ray [mailto:[email protected]]
Sent: Thursday, November 14, 2013 2:21 PM
To: [email protected]
Subject: [cas-user] how to Retrieve more than one result for multiple rows 
attributeRepository

Hi,
I am trying to setup CAS to return attributes(user permissions) related to an 
authenticated user.
These attributes reside in an oracle database.

I have managed to get some attributes returning correctly however the queries 
return only the first result.

I can see in the logs that I am getting multiple results per that attribute but 
for some reason it's not passed within the saml request:

2013-11-14 14:16:33,384 DEBUG 
[org.jasig.services.persondir.support.jdbc.SingleRowJdbcPersonAttributeDao] - 
<Executed 'select distinct p.PERMISSION_NAME from PERMISSIONS p,USERS_PROFILE 
u,ROLES_PERMISSIONS rp, USERNAME_ROLES ur     where Username=ur.LOGINNAME and 
ur.roleId=rp.ROLE_ID and rp.PERMISSION_ID=p.PERMISSION_ID and {0}' with 
arguments [ifridman] and got results
 [{PERMISSION_NAME=ROLE_PERMISSIONS_MY_EVENTS}, 
{PERMISSION_NAME=ROLE_PERMISSIONS_CREATE_EVENTS}]>

We can see here clearly we get two results from the DB:
ROLE_PERMISSIONS_MY_EVENTS
ROLE_PERMISSIONS_CREATE_EVENTS

However only the first one is returned:

2013-11-14 14:16:33,409 DEBUG

[org.jasig.services.persondir.support.MergingPersonAttributeDaoImpl] -  
<Retrieved 
attributes='[NamedPersonImpl[name=ifridman,attributes={PERMISSIONS=[ROLE_PERMISSIONS_MY_EVENTS]}]]'
for query='{username=[ifridman]}', isFirstQuery=false, 
currentlyConsidering='org.jasig.services.persondir.support.jdbc.SingleRowJdbcPersonAttribute
 ...

Also on the client side (spring security) I can see that I get only the first 
raw result which is: ROLE_PERMISSIONS_MY_EVENTS

 <saml1:Attribute AttributeName="PERMISSIONS" 
AttributeNamespace="http://www.ja-sig.org/products/cas/";>
            <saml1:AttributeValue xmlns:xs="http://www.w3.org/2001/XMLSchema"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:type="xs:string">ROLE_PERMISSIONS_MY_EVENTS</saml1:AttributeValue>



I expect to get here some list. Is it possible?

This is my code to retrieve attributes from deployerConfigContext.xml:

<bean 
class="org.jasig.services.persondir.support.jdbc.SingleRowJdbcPersonAttributeDao">
            <constructor-arg index="0" ref="dataSource"/>
            <constructor-arg index="1" value="select distinct p.PERMISSION_NAME 
from PERMISSIONS p,USERS_PROFILE u,ROLES_PERMISSIONS rp, USERNAME_ROLES ur
                        where Username=ur.LOGINNAME and ur.roleId=rp.ROLE_ID 
and rp.PERMISSION_ID=p.PERMISSION_ID and {0}"/>
            <property name="queryAttributeMapping">
              <map>
                <entry key="username" value="Username"/>
              </map>
            </property>
            <property name="resultAttributeMapping">
              <map>
                <entry key="PERMISSION_NAME" value="PERMISSIONS"/>
              </map>
            </property>
          </bean>


thanks.


--
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
This e-mail and the information it contains may be privileged and/or 
confidential. It is intended solely for the use of the named recipient(s). If 
you are not the intended recipient you may not disclose, copy, distribute or 
retain any part of this message or attachments. If you have received this 
e-mail in error please notify the sender immediately [by clicking 'Reply'] and 
delete this e-mail.
This e-mail and the information it contains may be privileged and/or 
confidential. It is intended solely for the use of the named recipient(s). If 
you are not the intended recipient you may not disclose, copy, distribute or 
retain any part of this message or attachments. If you have received this 
e-mail in error please notify the sender immediately [by clicking 'Reply'] and 
delete this e-mail.

-- 
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

Reply via email to