title: Read SAML response received from azure active directory using java
body: <p>I am new to azure active directory(AAD), So far I have created Enterprise Application in azure AD and setting of this application  I have selected integrated windows auth(IWA) for <code>Single sign-on option</code>. I have configured app proxy in this and <code>pre-authentication</code> set to <code>AAD</code> and <code>internal URL</code> is my java based web application URL.</p>
  
  <p>On other side AAD connector is install with federation as ADFS.</p>
  
  <p>Now the flow is : when I hit <code>User access URL</code>(URL for enterprise application) it challenge for domain verification and after successful verification it redirect to my on-premises AD form. after successful authentication to ADFS it redirect to my web app.</p>
  
  <p>Now the response I receive is SAML response. </p>
  
  <p>My question is how can I read this SAML response using java, AFA I found is ADAL is one way to do so. <a href="https://github.com/Azure-Samples/active-directory-java-webapp-openidconnect" rel="nofollow noreferrer">here</a> is sample project I found  .</p>
  
  <p>But don't found this usefull in my case. Is any other way to read this response, or any modification.</p>
  
  <p>The question might be broad: then any suggetion or reference link for the same?</p>
  
  <p>Update:</p>
  
  <p>My application not receive <code>SAML</code> response directly. the response received via app proxy which is not <code>SAML</code>. Or can we add some custom headers in response send by app proxy. Please find image below for better understanding </p>
  
  <p><a href="https://i.stack.imgur.com/kZ6MN.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/kZ6MN.png" alt="SAML tracer: trace for login sequence"></a></p>
  
  <p>Update2:</p>
  
  <p>Is it possible to send custom header in response send by azure app proxy?</p>
  
  <p>Currently receiving headers are </p>
  
  <ol>
  <li>connection</li>
  <li>authorizationNegotiate</li>
  <li>cookie</li>
  <li>host</li>
  <li>others like x-forwarded-by, language, encoding</li>
  </ol>