mirror of
https://gitee.com/fujieid/jap.git
synced 2024-11-30 02:27:34 +08:00
⬆️ Upgrading simple-http
This commit is contained in:
parent
58d57225b1
commit
1b8cf609d9
@ -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());
|
||||
}
|
||||
}
|
||||
|
@ -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.");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user