casServiceValidationSuccess.jsp返回内容为
Java代码
<cas:serviceResponse xmlns:cas='http://www.yale.edu/tp/cas'>
<cas:authenticationSuccess>
<cas:user>jack</cas:user>
没有列出我希望列出的全部的登录用户属性,如email,group,fullname
</cas:authenticationSuccess>
</cas:serviceResponse>
下面是我在deployerConfigContext.xml中的配置
Java代码
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:p="http://www.springframework.org/schema/p"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
<bean id="authenticationManager" class="org.jasig.cas.authentication.AuthenticationManagerImpl">
<property name="credentialsToPrincipalResolvers">
<list>
<bean class="org.jasig.cas.authentication.principal.UsernamePasswordCredentialsToPrincipalResolver">
<property name="attributeRepository">
<ref local="attributeRepository"/>
//[color=red]在这里增加一个属性[/color]
</property>
</bean>
<bean class="org.jasig.cas.authentication.principal.HttpBasedServiceCredentialsToPrincipalResolver"/>
</list>
</property>
<property name="authenticationHandlers">
<list>
<bean class="org.jasig.cas.authentication.handler.support.HttpBasedServiceCredentialsAuthenticationHandler"
p:httpClient-ref="httpClient" />
<bean class="org.jasig.cas.adaptors.jdbc.QueryDatabaseAuthenticationHandler">
<property name="dataSource" ref="mydataSource" />
<property name="sql" value="select password from User where userid=?" />
<property name="passwordEncoder" ref="myPasswordEncoder"/>
</bean>
</list>
</property>
</bean>
<bean id="myPasswordEncoder" class="org.jasig.cas.authentication.handler.DefaultPasswordEncoder">
<constructor-arg value="MD5"/>
</bean>
<bean id="mydataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName">
<value>com.microsoft.jdbc.sqlserver.SQLServerDriver</value>
</property>
<property name="url">
<value>jdbc:microsoft:sqlserver://10.45.12.32databasename=MyDatabase</value>
</property>
<property name="username">
<value>sa</value>
</property>
<property name="password">
<value>pass</value>
</property>
</bean>
<bean id="userDetailsService" class="org.springframework.security.userdetails.memory.InMemoryDaoImpl">
<property name="userMap">
<value>
</value>
</property>
</bean>
//[color=red]这里定义attributeRepository[/color]
<bean id="attributeRepository" class="org.jasig.services.persondir.support.jdbc.SingleRowJdbcPersonAttributeDao">
<constructor-arg index="0" ref="mydataSource"/>
<constructor-arg index="1">
<list>
<value>userid</value>
</list>
</constructor-arg>
<constructor-arg index="2" value="select userid,fullname,groupid from User where userid = ?"/>
<property name="columnsToAttributes">
<map>
<entry key="UserID" value="userid"/>
<entry key="FullName" value="FullName"/>
<entry key="GroupID" value="GroupID"/>
</map>
</property>
</bean>
<bean id="serviceRegistryDao" class="org.jasig.cas.services.InMemoryServiceRegistryDaoImpl">
</bean>
</beans>
casServiceValidationSuccess.jsp中的内容修改如下
Java代码
<%@ 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: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}">
<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>
</cas:authenticationSuccess>
</cas:serviceResponse>
化学文摘社提供若干化学相关信息数据库,其中两个最基本的数据库是CAplus和Registry: CAplus包含世界范围内的化学期刊和其他科学期刊上的化学相关文章的文献目录检索信息以及摘要,超过2千7百万条文献和1.7亿引用记录。 Registry包含3千4百万种无机及有机化学物质的15亿余条属性数据、1千4百万条反应以及5千9百万DNA序列。 化学物质属性信息来自化学文摘社,使用CAS号对物质进行检索。 DNA序列信息由化学文摘社和美国国家生物技术信息中心的GenBank共同提供。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)