返回更多用户信息继...
配置ssoAuth/WEB-INF/view/protocol/casServiceValidationSuccess.jsp下进行配置如完整页面如下:
<%@page pageEncoding="gbk"%> <%@ 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="${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> <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)-1}" step="1"> <%-- Produce output exactly as CAS client code expects it: <cas:attrName>attrValue</cas:attrName> 格式一定要按照这种形式写,要不然在客户端时你得不到数据,因为服务器无法识别,大多数文章所定的那种形式 --%> <cas:${fn:escapeXml(attr.key)}>${fn:escapeXml(attr.value)}</cas:${fn:escapeXml(attr.key)}> </c:forEach> </cas:attributes> </c:if> </cas:authenticationSuccess> </cas:serviceResponse>
然后就在客户端返回用户信息,如下:
client jsp 通过这种形式可以获取到全部的用户信息:
<% AttributePrincipal principal = (AttributePrincipal) request.getUserPrincipal(); Set attributeSet=principal.getAttributes().entrySet(); for(Iterator iter=attributeSet.iterator();iter.hasNext();){ Map.Entry attribute=(Map.Entry)iter.next(); out.println("key:("+attribute.getKey()+")--->"+"value:("+attribute.getValue()+")***"); out.println(); } %>
9,给登录页设置验证码
1,在服务器ssoAuth/login上设置验证码.(login-webflow.xml)
2,自定义的登录页设置验证码(remoteLogin-webflow.xml)
查看这篇文章:http://blog.chinaunix.net/u2/86974/showart_1997021.html
要根据以上两种方案在不同的webflow中设置
10,解决如qq上qq邮箱单点登陆,我们用的是spark/openfire
我采用的是httpclient 登陆到ssoAuth/login上进行验证,获取到CASTGC这个cookie 然后在把他设置进要打
开的浏览器上,不过有个bug没有解决就是打开浏览器时cookie是如何写入到浏览器中?
1,要把cookie放在url上,转到一个servelet上进行写入cookie再中转,这个方法有缺陷.得到那个url在任何
浏览器都可以登陆.
2,查看了一下阿里旺旺的实现方式,他采用的是自己在im上写个服务器,然后进行cookie写入