2016-06-24 15 views
0

CASで保護されているWebアプリケーションがあります。今私は現在のログに記録されたユーザーを印刷したい。私はここでCASからWebアプリケーションへのユーザーアトリビュートの受け渡し

javax.net.ssl.SSLHandshakeException: java.security.cert.CertificateException:No name matching localhost found 

は私のコード私が正しくSAMLValidationFilterとSAMLAuthenticationフィルターを使用して、私のweb.xmlに

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();   
} 

で取得します。誰かに私が何をしているのかを考えさせてください。それとも、実例がありますか?

答えて

0

問題はサンプルコードではありません。あなたの環境です。ランタイムJava環境によって信頼されていないHTTPSエンドポイントに到達しようとしています。そのエンドポイントをhttps://github.com/UniconLabs/java-keystore-ssl-testでテストします。

関連する問題