将用户属性从CAS传递到Web应用程序

still帕特里克

我有一个受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。有谁知道我在做什么错。还是有一个可行的例子?

米沙·莫耶德(Misagh Moayyed)

问题不在于示例代码。这是你的环境。您试图到达运行时Java环境不信任的HTTPS端点。使用https://github.com/UniconLabs/java-keystore-ssl-test测试该端点

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

如何将用户uid从登录页面传递到Web应用程序中的其他页面

如何将用户帐户集成到应用程序?

将用户登录到Web API应用程序

如何将用户从FB canvas应用程序的feed中重定向到FB canvas应用程序

IOS/Objective-C:点击通知时将用户定向到应用程序的特定屏幕

如何将用户号码重定向到电话应用程序颤振

重置密码时将用户重定向到iOS应用程序

将用户数据从 PHP 同步到meteor 应用程序

如何将用户从浏览器重定向到iOS中的应用程序?

将用户的评论功能修复到后期-Flask应用程序

如何将用户输入从 android 应用程序存储到 IBM Cloudant

在卸载 uwp 应用程序时将用户重定向到网页

如何手动将用户添加到Web应用程序?

Flask Web应用程序-努力将用户提交的信息导入MySQL数据库

如何将数据从Windows应用程序传递到Web应用程序?

将用户上传的数据存储在Shiny应用程序中

无法将用户存储在默认的MVC应用程序中

将用户相机输入插入 IOS 应用程序

在Spring应用程序中使用onAuthenticationSuccess将用户重定向到登录页面后的原始URL

Java-无法将用户输入注入到空数组(用于注册产品的基于文本的应用程序)

在应用程序启动时将用户定向到不同视图控制器的最快方法

从身份服务器注销后如何将用户重定向到客户端应用程序?

在Java Spring 4中执行从应用程序A到应用程序B的休息或soap api调用时,将用户名存储在数据库中

自动将用户分配到应用程序中的特定应用程序角色

将用户名添加到我的Rails Web应用程序时出错(设计gem)

环境属性未传递到Elastic Beanstalk中的应用程序

Vue:使用计算属性将参数从应用程序传递到组件并返回

Java应用程序的Web用户界面

如何将适量的数据传递到Web API应用程序?