<commit_before>package com.atlassian.sal.api.net.auth;

import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.HttpMethod;

import com.atlassian.sal.api.component.ComponentLocator;
import com.atlassian.sal.api.trusted.CertificateFactory;
import com.atlassian.security.auth.trustedapps.EncryptedCertificate;
import com.atlassian.security.auth.trustedapps.TrustedApplicationUtils;
import com.atlassian.security.auth.trustedapps.request.commonshttpclient.CommonsHttpClientTrustedRequest;

public class TrustedTokenAuthenticator implements HttpClientAuthenticator
{
	private final EncryptedCertificate userCertificate;

	public TrustedTokenAuthenticator(String username)
	{
		final CertificateFactory certificateFactory = ComponentLocator.getComponent(CertificateFactory.class);
		if (username != null && !username.equals(""))
		{
			this.userCertificate = certificateFactory.createCertificate(username);
		} else
		{
			this.userCertificate = null;
		}
	}

	/**
	 * @param httpClient
	 * @param method
	 */
	public void process(HttpClient httpClient, HttpMethod method)
	{
		if (this.userCertificate!=null)
		{
			final CommonsHttpClientTrustedRequest commonsHttpClientTrustedRequest = new CommonsHttpClientTrustedRequest(method);
			TrustedApplicationUtils.addRequestParameters(userCertificate, commonsHttpClientTrustedRequest);
		}
	}

}
<commit_msg>Removing seraph protocol version from header request<commit_after>package com.atlassian.sal.api.net.auth;

import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.HttpMethod;

import com.atlassian.sal.api.component.ComponentLocator;
import com.atlassian.sal.api.trusted.CertificateFactory;
import com.atlassian.security.auth.trustedapps.EncryptedCertificate;
import com.atlassian.security.auth.trustedapps.TrustedApplicationUtils;
import com.atlassian.security.auth.trustedapps.request.commonshttpclient.CommonsHttpClientTrustedRequest;

public class TrustedTokenAuthenticator implements HttpClientAuthenticator
{
	private final EncryptedCertificate userCertificate;

	public TrustedTokenAuthenticator(String username)
	{
		final CertificateFactory certificateFactory = ComponentLocator.getComponent(CertificateFactory.class);
		if (username != null && !username.equals(""))
		{
			this.userCertificate = certificateFactory.createCertificate(username);
		} else
		{
			this.userCertificate = null;
		}
	}

	/**
	 * @param httpClient
	 * @param method
	 */
	public void process(HttpClient httpClient, HttpMethod method)
	{
		if (this.userCertificate!=null)
		{
			final CommonsHttpClientTrustedRequest commonsHttpClientTrustedRequest = new CommonsHttpClientTrustedRequest(method);
			TrustedApplicationUtils.addRequestParameters(userCertificate, commonsHttpClientTrustedRequest);
			method.removeRequestHeader("X-Seraph-Trusted-App-Version");
		}
	}

}

{'fraction_non_alphanumeric': 0.08665269042627533, 'fraction_numerical': 0.0, 'mean_word_length': 6.53421052631579, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5034808', 'n_tokens_mistral': 847, 'n_tokens_neox': 798, 'n_words': 127}