All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.ligoj.app.plugin.bt.jira.JiraSudoHttpResponseCallback Maven / Gradle / Ivy

There is a newer version: 1.1.0
Show newest version
package org.ligoj.app.plugin.bt.jira;

import org.apache.http.client.methods.CloseableHttpResponse;
import org.ligoj.app.resource.plugin.OnlyRedirectHttpResponseCallback;

/**
 * Jira Sudo response handler.
 */
public class JiraSudoHttpResponseCallback extends OnlyRedirectHttpResponseCallback {

	@Override
	protected boolean acceptResponse(final CloseableHttpResponse response) {
		// Check "X-Atlassian-WebSudo" header value equals to "Has-Authentication"
		return super.acceptResponse(response) && response.getFirstHeader("X-Atlassian-WebSudo") != null
				&& "Has-Authentication".equals(response.getFirstHeader("X-Atlassian-WebSudo").getValue());
	}

	@Override
	protected boolean acceptLocation(final String location) {
		// Always accept location since only HTTP headers are used to validate the response
		return true;
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy