首页  :: 新随笔  :: 管理

统一身份认证(CAS)客户端测试获取信息代码

Posted on 2011-08-29 10:53  季枫  阅读(3084)  评论(0编辑  收藏  举报

TestSSOClientStatus.jsp
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page  import="org.jasig.cas.client.util.AbstractCasFilter"%>
<%@ page  import="org.jasig.cas.client.validation.Assertion"%>
<%
String path 
= request.getContextPath();
String basePath 
= request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
Assertion assertion1
=(Assertion)session.getAttribute(AbstractCasFilter.CONST_CAS_ASSERTION);
if (assertion1!=null){
    
}
String ssoid
=null;
        
if (assertion1 != null) {
            ssoid 
= assertion1.getPrincipal().getName();
        }
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  
<head>
    
<base href="<%=basePath%>">
    
<script type="text/javascript">
        basePath
='<%=basePath%>';
    
</script>    
    
<title>My JSP 'TestSSOClientStatus.jsp' starting page</title>
    
    
<meta http-equiv="pragma" content="no-cache">
    
<meta http-equiv="cache-control" content="no-cache">
    
<meta http-equiv="expires" content="0">    
    
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    
<meta http-equiv="description" content="This is my page">
    
<!--
    
<link rel="stylesheet" type="text/css" href="styles.css">
    
-->

  
</head>
  
  
<body>
    SSO Say:
<%=ssoid%>
  
</body>
</html>
智读 | 成都会领科技有限公司官网 | 智读App下载 | 每天听本书的博客 | |