title: How to implement Java soap client when server uses ADFS authentication?
body: <p>We are implementing a soap client in Java (using cxf wsdl2java). In previous projects the authentication has been based on either WS-Security or Basic HTTP Authentication. These are both easy to test in SoapUI and implement in java.</p>
  
  <p>This time however, the server uses a Web Application Proxy which works as a reverse proxy, and ADFS (Active Directory Federation Services) for authentication purpose. I don't know the details of what this means, but what happens when opening the wsdl endpoint URL in a browser is that we get redirected to a login page similar to the office login page <a href="https://login.microsoftonline.com/" rel="nofollow noreferrer">https://login.microsoftonline.com/</a> where you have manually click on the account type before entering credentials.</p>
  
  <p>When logging in manually, we get redirected back to the wsdl endpoint with an appended ?authToken=xxx at the end and I think the token lasts for 1 hour. We have tried to ask the provider to use a more standard authentication, but for now this is the only thing we have. How do we approach this? </p>
  
  <p>When trying to do a test request from SoapUI, we just get the complete html code of the login page in response. I see there is a Form Based Authentication option in SoapUI but it won't work since the login page has multiple account types and multiple username/password fields. The workaround for testing is just to login manually and use the authToken. But how can we automate this in the Java cxf client?</p>
  
  <p>When connecting to the endpoint url in a browser, this is how the url looks after redirected to the login page:</p>
  
  <p>[url to adfs seriver]/adfs/ls?version=1.0&amp;action=signin&amp;realm=urn%3AAppProxy%3Acom&amp;appRealm=a10037ed-ca1e-e711-9436-00215a9b01ac&amp;returnUrl=[wsdl endpoint url]&amp;client-request-id=13A5B5A6-B574-0000-6FBA-A51374B5D201</p>