Log response entity when submitting IDP form

This will allow to troubleshoot the intermittent errors in
SamlAuthneticationIT

Relates to https://github.com/elastic/elasticsearch/issues/40025
This commit is contained in:
Ioannis Kakavas 2019-03-14 09:51:57 +02:00
parent 4d1305b6df
commit 2361947731
1 changed files with 2 additions and 0 deletions

View File

@ -34,6 +34,7 @@ import org.apache.http.protocol.HTTP;
import org.apache.http.protocol.HttpContext; import org.apache.http.protocol.HttpContext;
import org.apache.http.protocol.HttpCoreContext; import org.apache.http.protocol.HttpCoreContext;
import org.apache.http.util.CharArrayBuffer; import org.apache.http.util.CharArrayBuffer;
import org.apache.http.util.EntityUtils;
import org.apache.logging.log4j.message.ParameterizedMessage; import org.apache.logging.log4j.message.ParameterizedMessage;
import org.elasticsearch.ElasticsearchException; import org.elasticsearch.ElasticsearchException;
import org.elasticsearch.cli.SuppressForbidden; import org.elasticsearch.cli.SuppressForbidden;
@ -373,6 +374,7 @@ public class SamlAuthenticationIT extends ESRestTestCase {
form.setEntity(new UrlEncodedFormEntity(params)); form.setEntity(new UrlEncodedFormEntity(params));
final String redirect = execute(client, form, context, response -> { final String redirect = execute(client, form, context, response -> {
logger.debug(EntityUtils.toString(response.getEntity()));
assertThat(response.getStatusLine().getStatusCode(), equalTo(302)); assertThat(response.getStatusLine().getStatusCode(), equalTo(302));
return response.getFirstHeader("Location").getValue(); return response.getFirstHeader("Location").getValue();
}); });