* @return URI uri
* @throws URISyntaxException
* exception
*/
public URI buildUrl() throws URISyntaxException {
HttpClientURIBuilder ub = new HttpClientURIBuilder(getUrlPath());
ub.setHost(getHost());
ub.setScheme(getScheme());
ub.addParameter("response_type", getResponseType());
ub.addParameter("client_id", getClientId());
if (StringUtils.isNotEmpty(getOptionalState())) {
ub.addParameter(STATE, getOptionalState());
}
if (StringUtils.isNotEmpty(getRedirectUrl())) {
ub.addParameter("redirect_uri", getRedirectUrl());
}
for (Map.Entry<String, String> entry : extraQueryParams.entrySet()) {
ub.addParameter(entry.getKey(), entry.getValue());
}
HttpClientURLEncodedUtils.format(ub.getQueryParams(), "UTF-8");
return ub.build();
}