⬆️ Upgrading simple-http

This commit is contained in:
yadong.zhang 2021-09-15 10:32:27 +08:00
parent 58d57225b1
commit 1b8cf609d9
2 changed files with 6 additions and 4 deletions

View File

@ -25,6 +25,7 @@ import com.fujieid.jap.core.exception.JapOauth2Exception;
import com.fujieid.jap.http.JapHttpRequest;
import com.fujieid.jap.oauth2.pkce.PkceCodeChallengeMethod;
import com.xkcoding.http.HttpUtil;
import com.xkcoding.http.support.SimpleHttpResponse;
import com.xkcoding.json.JsonUtil;
import com.xkcoding.json.util.Kv;
@ -212,12 +213,12 @@ public class Oauth2Util {
*/
public static Kv request(Oauth2EndpointMethodType endpointMethodType, String url, Map<String, String> params) {
String res = null;
SimpleHttpResponse res = null;
if (null == endpointMethodType || Oauth2EndpointMethodType.GET == endpointMethodType) {
res = HttpUtil.get(url, params, false);
} else {
res = HttpUtil.post(url, params, false);
}
return JsonUtil.parseKv(res);
return JsonUtil.parseKv(res.getBody());
}
}

View File

@ -19,6 +19,7 @@ import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.StrUtil;
import com.fujieid.jap.core.exception.OidcException;
import com.xkcoding.http.HttpUtil;
import com.xkcoding.http.support.SimpleHttpResponse;
import com.xkcoding.json.JsonUtil;
import com.xkcoding.json.util.Kv;
@ -43,13 +44,13 @@ public class OidcUtil {
}
String discoveryUrl = issuer.concat(DISCOVERY_URL);
String response = null;
SimpleHttpResponse response = null;
try {
response = HttpUtil.get(discoveryUrl);
} catch (Exception e) {
throw new OidcException("Cannot access discovery url: " + discoveryUrl);
}
Kv oidcDiscoveryInfo = JsonUtil.parseKv(response);
Kv oidcDiscoveryInfo = JsonUtil.parseKv(response.getBody());
if (CollectionUtil.isEmpty(oidcDiscoveryInfo)) {
throw new OidcException("Unable to parse IDP service discovery configuration information.");
}