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

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>
原文地址:https://www.cnblogs.com/jifeng/p/2157951.html