use of com.nimbusds.oauth2.sdk.SerializeException in project microsoft-authentication-library-for-java by AzureAD.
the class ClientAuthenticationPost method applyTo.
@Override
public void applyTo(HTTPRequest httpRequest) throws SerializeException {
if (httpRequest.getMethod() != HTTPRequest.Method.POST)
throw new SerializeException("The HTTP request method must be POST");
String ct = String.valueOf(httpRequest.getEntityContentType());
if (ct == null)
throw new SerializeException("Missing HTTP Content-Type header");
if (!ct.equals(HTTPContentType.ApplicationURLEncoded.contentType))
throw new SerializeException("The HTTP Content-Type header must be " + HTTPContentType.ApplicationURLEncoded.contentType);
Map<String, List<String>> params = httpRequest.getQueryParameters();
params.putAll(toParameters());
String queryString = URLUtils.serializeParameters(params);
httpRequest.setQuery(queryString);
}
Aggregations