How to configure My Web Application as SAML Test Connector (SP) using Onelogin?
<p>I have added my web application into onelogin using <a href="https://support.onelogin.com/hc/en-us/articles/202673944-How-to-Use-the-OneLogin-SAML-Test-Connector" rel="nofollow">SAML Test Connector</a>.
In Configuration tab I have given the following values </p>

<blockquote>
  <p>Recipient : <a href="http://localhost:8080/em/live/pages/samlAuth/" rel="nofollow">http://localhost:8080/em/live/pages/samlAuth/</a></p>
  
  <p>ACS(Consumer) URL Validator* : ^ </p>
  
  <p>ACS (Consumer) URL* :<a href="http://localhost:8080/ws_em/rest/accounts/consume-saml" rel="nofollow">http://localhost:8080/ws_em/rest/accounts/consume-saml</a> </p>
  
  <p>Login URL : <a href="http://localhost:8080/ws_em/rest/accounts/produce-saml" rel="nofollow">http://localhost:8080/ws_em/rest/accounts/produce-saml</a></p>
</blockquote>

<p>Where <a href="http://localhost:8080/ws_em/rest/accounts/produce-saml" rel="nofollow">http://localhost:8080/ws_em/rest/accounts/produce-saml</a> creates an SAML Request by taking IssuerUrl, SAML EndPoint Copied From Onelogin SSO Tab and ACS url as <a href="http://localhost:8080/ws_em/rest/accounts/consume-saml" rel="nofollow">http://localhost:8080/ws_em/rest/accounts/consume-saml</a>.</p>

<pre><code>    @GET
    @Produces(MediaType.APPLICATION_JSON)
    @Path("/produce-saml")
    public com.virima.em.core.Response SAMLAuthentication(){
         com.Response resp = new com.Response();
         AppSettings appSettings = new AppSettings();
         appSettings.setAssertionConsumerServiceUrl(ACSUrl);
         appSettings.setIssuer(IssuerUrl));
         AccountSettings accSettings = new AccountSettings();
         accSettings.setIdpSsoTargetUrl(IdpSsoTargetUrl);
         AuthRequest authReq = new AuthRequest(appSettings,accSettings);
         Map&lt;String, String[]&gt; parameters = request.getParameterMap();
         String relayState = null;
         for(String parameter : parameters.keySet()) {
           if(parameter.equalsIgnoreCase("relaystate")) {
             String[] values = parameters.get(parameter);
             relayState = values[0];
           }
        }
        String reqString = authReq.getSSOurl(relayState);
        response.sendRedirect(reqString);
        resp.setResponse(reqString);
        return resp;
 }
</code></pre>

<p><a href="http://localhost:8080/ws_em/rest/accounts/consume-saml" rel="nofollow">http://localhost:8080/ws_em/rest/accounts/consume-saml</a> calls is supposed to take my SAML request and do the authentication . Here I am using the certificate generated in Onelogin SSO Tab</p>

<pre><code>    @GET
    @Produces(MediaType.APPLICATION_JSON)
    @Path("/consume-saml")
    public com.onelogin.saml.Response SAMLAuthenticationResponse(){
        com.onelogin.saml.Response samlResponse = null;
        String certificateS ="c"; //Certificate downloaded from Onelogin SSO Tab
        AccountSettings accountSettings = new AccountSettings();
        accountSettings.setCertificate(certificateS);
        samlResponse = new com.onelogin.saml.Response(accountSettings,request.getParameter("SAMLResponse"),request.getRequestURL().toString());
       if (samlResponse.isValid()) {
           // the signature of the SAML Response is valid. The source is trusted
            java.io.PrintWriter writer = response.getWriter();
            writer.write("OK!");
            String nameId = samlResponse.getNameId();
            writer.write(nameId);
            writer.flush();
      } else {
         // the signature of the SAML Response is not valid
        java.io.PrintWriter writer = response.getWriter();
        writer.write("Failed\n");
        writer.write(samlResponse.getError());
        writer.flush();
      }
            return samlResponse;
}
</code></pre>

<p>I am getting this error</p>

<blockquote>
  <p>Federation Exception: Malformed URL. Please contact your
  administrator.</p>
</blockquote>

<p>It doesn't seem to come inside the ACS url I have inside my app. </p>

<p>Is there any mistakes in my configuration ? Or is there  a better way to do this ?</p>