CAS 配置多条SQL语句来返回登录成功后的数据问题
CAS 服务端在登录成功会返回客户端一些信息,以下配置是返回信息的配置
[code=text][/code]现在我又这样的需求就是根据不同的类型返回不同的数据,查不同的表,也就是说上述配置中
<bean
class="org.jasig.services.persondir.support.jdbc.MultiRowJdbcPersonAttributeDao"
id="attributeRepository">
<constructor-arg index="0" ref="dataSource" />
<constructor-arg index="1"
value="SELECT 'att_usertype' AS att_usertype,0 AS usertype,'att_name' AS att_name,u.user_name,'att_dept' AS att_dept,u.dept_id,'att_msisdn' AS att_msisdn,u.user_msisdn,'att_email' AS att_email,u.user_email,'att_roleId' AS att_roleId,r.role_id,'att_sysCode' AS att_sysCode,r.sys_code FROM table1 a,table2 r WHERE r.user_id = u.user_id and {0}" />
<property name="queryAttributeMapping">
<map>
<!-- 这里的key需写username,value对应数据库用户名字段 -->
<entry key="username" value="u.user_id" />
</map>
</property>
<property name="nameValueColumnMappings">
<map>
<entry key="att_usertype" value="usertype" />
<entry key="att_name" value="user_name" />
<entry key="att_dept" value="dept_id" />
<entry key="att_msisdn" value="user_msisdn" />
<entry key="att_email" value="user_email" />
<entry key="att_roleId" value="role_id" />
<entry key="att_sysCode" value="sys_code" />
</map>
</property>
</bean>
<!-- Sample, in-memory data store for the ServiceRegistry. A real implementation
would probably want to replace this with the JPA-backed ServiceRegistry DAO
The name of this bean should remain "serviceRegistryDao". -->
<bean id="serviceRegistryDao" class="org.jasig.cas.services.InMemoryServiceRegistryDaoImpl">
<property name="registeredServices">
<list>
<bean class="org.jasig.cas.services.RegexRegisteredService">
<property name="id" value="0" />
<property name="name" value="HTTP and IMAP" />
<property name="description" value="Allows HTTP(S) and IMAP(S) protocols" />
<property name="serviceId" value="^(https?|imaps?)://.*" />
<property name="evaluationOrder" value="10000001" />
<property name="allowedAttributes">
<list>
<!-- <value>att_email</value> <value>att_name</value> <value>att_role</value>
<value>att_sys</value> -->
<value>att_usertype</value>
<value>att_name</value>
<value>att_dept</value>
<value>att_msisdn</value>
<value>att_email</value>
<value>att_roleId</value>
<value>att_sysCode</value>
</list>
</property>
</bean>
<!-- Use the following definition instead of the above to further restrict
access to services within your domain (including subdomains). Note that example.com
must be replaced with the domain you wish to permit. -->
</list>
</property>
</bean>
<constructor-arg index="1"不一定是这个sql语句可能还有一个备用的sql配置一下,然后根据需求来选择执行哪一个SQL语句,请问这个怎么修改cas的源码?或者是配置
value="SELECT 'att_usertype' AS att_usertype,0 AS usertype,'att_name' AS att_name,u.user_name,'att_dept' AS att_dept,u.dept_id,'att_msisdn' AS att_msisdn,u.user_msisdn,'att_email' AS att_email,u.user_email,'att_roleId' AS att_roleId,r.role_id,'att_sysCode' AS att_sysCode,r.sys_code FROM table1 a,table2 r WHERE r.user_id = u.user_id and {0}" />