2016-06-24 2 views
0

CAS로 보호되는 웹 응용 프로그램이 있습니다. 이제 현재 로그인 한 사용자를 인쇄하려고합니다. 내가 CAS에서 웹 응용 프로그램으로 사용자 Attrinbutes 전달

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

으로 테스트하십시오.
관련 문제