成功验证后,我需要将某些属性(例如,人类可读的用户名)从服务器发送到客户端。服务器部分已完成。现在属性已发送给客户端。从日志中,我可以看到:
2010-03-28 23:48:56,669 调试 Cas20ServiceTicketValidator:185 - 服务器响应:http://www.yale.edu/tp/cas'> a@b.com
<cas:proxyGrantingTicket>PGTIOU-1-QZgcN61oAZcunsC9aKxj-cas</cas:proxyGrantingTicket> <cas:attributes> <cas:FullName>Test account 1</cas:FullName> </cas:attributes> </cas:authenticationSuccess> </cas:serviceResponse>
但是,我不知道如何访问客户端中的属性(我使用的是 Spring security 2.0.5)。
在 authenticationProvider 中,将 userDetailsService 配置为读取经过身份验证的主体的 db。
<bean id="casAuthenticationProvider" class="org.springframework.security.providers.cas.CasAuthenticationProvider">
<sec:custom-authentication-provider />
<property name="userDetailsService" ref="clerkManager"/>
<!-- other stuff goes here -->
</bean>
现在在我的控制器中,我可以轻松地做到这一点:
Clerk currentClerk = (Clerk)SecurityContextHolder.getContext().getAuthentication().getPrincipal();
理想情况下,我可以以某种方式将此 Clerk 对象的属性作为另一个属性填充。这该怎么做?
或者,在 CAS 的集中式性质下,在所有应用程序之间共享属性的推荐方法是什么?