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

后端 未结 1 1731
别那么骄傲
别那么骄傲 2021-01-28 05:46

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 autho

相关标签:
1条回答
  • 2021-01-28 06:10

    I achieved this by writing a index.jsp file in my angular project

    <%
         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>
     <% } %>
    
    0 讨论(0)
提交回复
热议问题