简体   繁体   English

如何从 angular 8 应用程序的浏览器中的网络选项卡的 header 部分下获取具有 SAML 响应的表单数据详细信息?

[英]How to get Form-Data details having SAML Response under header section of network tab from Browser in angular 8 application?

I am trying to do IDP authentication in angular 8 application.so my angular application first redirect to idp server and then idp server gives me SAML response for further authorization.This SAML response is available in network tab of browser under form data section.I want to get this SAML response in my angular application to get my id and email details for further decoding it and using it same for authorization.so my question is, how can i get SAML response from browser and use same in angular app.Please help.I am able to see my SAML response in network tab of browser under header tab having form Data section.我正在尝试在 angular 8 应用程序中进行 IDP 身份验证。所以我的 angular 应用程序首先重定向到 idp 服务器,然后 idp 服务器给我 SAML 响应以进行进一步授权。此 SAML 响应在浏览器的网络选项卡中的表单数据部分可用。我想要在我的 angular 应用程序中获取此 SAML 响应以获取我的 id 和 email 详细信息以进一步对其进行解码并将其用于授权。所以我的问题是,如何从浏览器获取 SAML 响应并在 ZD18B8624A0F5F72DDZFC 应用程序中使用相同的响应。我可以在具有表单数据部分的 header 选项卡下的浏览器网络选项卡中看到我的 SAML 响应。 在此处输入图像描述

I achieved this by writing a index.jsp file in my angular project我通过在我的 angular 项目中编写 index.jsp 文件来实现这一点

<%
     String uiBaseUrl = "/ngApp";
     String samlResponse = request.getParameter("SAMLResponse");
     if (samlResponse == null) {
         String error = request.getParameter("error");
         String error_description = request.getParameter("error_description");
 %>
        <script>
            let url = '<%= uiBaseUrl %>' + '/?error='+encodeURIComponent(error)+'&error_description='+encodeURIComponent(error_description);
            window.location.href = url;
        </script>
 <% } else { %>
        <script>
            redirectToUI();
            function redirectToUI() {
                const samlResponse = '<%=samlResponse%>';
                localStorage.setItem('SAMLResponse', samlResponse);
                let url = '<%= uiBaseUrl %>';
                window.location.href = url;
                /*This will navigate to ng App base route with SAMLResponse in localStorage. Write logic in base route component to read this response*/
            }
        </script>
 <% } %>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 HTTP响应显示Accept = multipart / form-data但未设置此标头并设置CamelAcceptContentType,“application / json” - HTTP response shows Accept=multipart/form-data BUT not setting this header and settting CamelAcceptContentType, “application/json” 我们如何使用Selenium获取“网络”选项卡信息(标题,响应等) - How can we get Network tab information (Header, Response, etc) using Selenium 如何在Swing应用程序中从浏览器获取标头值? - How to get header values from browser in Swing Application? RestTemplate &amp; multipart/form-data 响应 - RestTemplate & multipart/form-data response 解析 spring 中的多部分/表单数据响应 - parse multipart/form-data response in spring JSOUP + multipart/form-data 响应 - JSOUP + multipart/form-data response 如何使用RESTeasy从multipart / form-data请求获取text / xml为UTF-8? - How to get text/xml as UTF-8 from a multipart/form-data request with RESTeasy? 我如何解析从 multipart/form-data 请求发送的内容以获取 java 中的文件? - How do i parse content sent from multipart/form-data request to get file in java? 如果我的数据在数组列表中,如何从 .network 获得响应 - How to get response from network if my data is in array list 如何从 Spring WebFlux 中的 Multipart/form-data 中的 stream 文件 - How to stream file from Multipart/form-data in Spring WebFlux
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM