我有一个受CAS保护的网络应用。现在我想打印当前登录的用户,但是。我懂了
javax.net.ssl.SSLHandshakeException: java.security.cert.CertificateException:No name matching localhost found
这是我的代码
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
request.getServletContext().log("T1");
System.out.println("T2");
PrintWriter writer = response.getWriter();
String userID = request.getRemoteUser();
HttpSession session = request.getSession(true);
writer.println("<html>");
writer.println("<head><title>Hello World Servlet</title></head>");
writer.println("<body>");
writer.println("<h1>Congratulations! You are logged in " + userID + "</h1>");if(request.getUserPrincipal() != null) {
AttributePrincipal principal = (AttributePrincipal) request.getUserPrincipal();
writer.println("<h1>P: " + principal.getName() + "</h1>");
Map<String, Object> attributes = principal.getAttributes();
Iterator<String> attributeNames = attributes.keySet().iterator();
writer.print("<p>");
writer.println();
while(attributeNames.hasNext()) {
String attributeName = attributeNames.next();
writer.print(attributeName + ": ");
writer.print(attributes.get(attributeName));
writer.println();
}
writer.print("<p>");
}
writer.println("<body>");
writer.println("</html>");
writer.close();
}
在我的web.xml中,我正确使用了SAMLValidationFilter和SAMLAuthentication Filter。有谁知道我在做什么错。还是有一个可行的例子?
问题不在于示例代码。这是你的环境。您试图到达运行时Java环境不信任的HTTPS端点。使用https://github.com/UniconLabs/java-keystore-ssl-test测试该端点
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句