com.yubico.client.v2.HttpUtils Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of yubico-validation-client2 Show documentation
Show all versions of yubico-validation-client2 Show documentation
Client library written in Java for verifying Yubikey one-time passwords (OTPs) with validation protocol 2.
package com.yubico.client.v2;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.Map;
public class HttpUtils {
public static String toQueryString(Map requestMap) throws UnsupportedEncodingException {
String paramStr = "";
for(Map.Entry entry : requestMap.entrySet()) {
if(!paramStr.isEmpty()) {
paramStr += "&";
}
paramStr += entry.getKey() + "=" + URLEncoder.encode(entry.getValue(), "UTF-8");
}
return paramStr;
}
}