一、CAS客户端HTTPS改HTTP方式
1.修改所有使用到casclient.jar的项目中该jar包内edu.yale.its.tp.cas.util.SecureURL.class文件(需要进行反编译成java类文件“SecureURL.java”),将下边代码中对https访问方式的验证代码注释掉(绿色部分)。
public static String retrieve(String url) throws IOException {
if (log.isTraceEnabled())
log.trace("entering retrieve(" + url + ")");
BufferedReader r = null;
String s;
try {
URL u = new URL(url);
/*if (!u.getProtocol().equals("https")) {
log.error("retrieve(" + url
+ ") on an illegal URL since protocol was not https.");
throw new IOException(
"only 'https' URLs are valid for this method");
}*/
URLConnection uc = u.openConnection();
uc.setRequestProperty("Connection", "close");
r = new BufferedReader(new InputStreamReader(uc.getInputStream()));
StringBuffer buf = new StringBuffer();
String line;
while ((line = r.readLine()) != null)
buf.append(line + "\n");
s = buf.toString();
} finally {
try {
if (r != null)
r.close();
} catch (IOException ex) {
}
}
return s;
}
2.修改页面上的https开头的连接,改为http。
修改login.jsp页面内容
修改前:
<cas:auth var="netid" scope="session">
<cas:loginUrl>https://passport.com/login</cas:loginUrl>
<cas:validateUrl>https://passport.com/proxyValidate</cas:validateUrl>
</cas:auth>
修改后:
<cas:auth var="netid" scope="session">
<cas:loginUrl>http://passport.com:8080/login</cas:loginUrl>
<cas:validateUrl>http://passport.com:8080/proxyValidate</cas:validateUrl>
</cas:auth>
修改logout.jsp页面内容
修改前:
<cas:logout
var="netid"
scope="session" logoutUrl="https://passport.com/logout"/>
修改后:
<cas:logout
var="netid"
scope="session" logoutUrl="http://passport.com/logout"/>