jasig CAS項目本身就是一個完整的CAS單點登錄服務
1、服務端需要把 認證處理類、用戶屬性返回值處理類 調整成我們自己處理類即可實現單點登錄
2、java客戶端需要引入cas-client-core客戶端jar包,添加所需的過濾器即可(如果原項目具有驗證登錄的過濾器/攔截器,需要根據具體需要進行小調整)
3、部署到linux服務器,登錄成功后跳轉異常
[http-nio-21300-exec-4] ERROR org.apache.catalina.core.ContainerBase.[Tomcat].[localhost].[/].[dispatcherServlet] - Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [org.jasig.cas.client.validation.TicketValidationException: No principal was found in the response from the CAS server.] with root cause
org.jasig.cas.client.validation.TicketValidationException: No principal was found in the response from the CAS server............
[http-nio-21300-exec-4] ERROR org.jasig.cas.client.util.XmlUtils - 元素類型 "meta" 必須由匹配的結束標記 "</meta>" 終止。
org.xml.sax.SAXParseException: 元素類型 "meta" 必須由匹配的結束標記 "</meta>" 終止。..............
找了好久,本地沒有此異常,服務器異常定位不清晰,最后才想到web服務器要調用CAS服務器驗證ticket,忘了配置host。
CAS4.0 參考文獻:
http://www.cnblogs.com/vhua/p/cas_1.html
http://blog.csdn.net/frinder/article/details/7969925
PHP客戶端:
http://blog.csdn.net/fei1502816/article/details/6695117
http://www.bubuko.com/infodetail-1145996.html
http://blog.csdn.net/haiqiao_2010/article/details/38365733
讓其他文件支持php代碼:
http://laoxiege.blog.sohu.com/116742025.html
php單點退出方式:phpCAS::handleLogoutRequests(mode, casHost, casIp));
1、mode是ip是否外網解析,值為true或false
2、casHost是cas服務器的域名,casIp是cas服務器的ip。如果不加這兩個參數,當handleLogoutRequests校驗登出請求時就會失敗,也就使得應用不能登出了。
3、如果退出攔截成功會自動清除session數據
百般折磨嘗試后的成功示例:phpCAS::handleLogoutRequests(false,'login.mr-world.com',"117.78.35.137");
php端非常奇怪的問題:跳轉登錄多出參數gateway=true導致無限循環來回跳轉,無法正確跳轉登錄頁
使用nginx服務器有問題,使用apache服務器沒問題
驗證登錄頁與登錄成功回跳頁一樣的情況下也會出現一次gateway=true