|
|
@@ -123,22 +123,20 @@ public class Oauth2Api {
|
|
|
String hostAddress = this.systemConfigService.getStringValue("OAUTH2_API_CONFIG", "hostAddress");
|
|
|
String clientSecret = this.systemConfigService.getStringValue("OAUTH2_API_CONFIG", "clientSecret");
|
|
|
|
|
|
- Map<String, String> paramValues = new HashMap<>();
|
|
|
- paramValues.put("code", request.getCode());
|
|
|
- FormBody.Builder formBuilder = new FormBody.Builder();
|
|
|
- paramValues.forEach(formBuilder::add);
|
|
|
-
|
|
|
-
|
|
|
Request.Builder builder = new Request.Builder();
|
|
|
|
|
|
- String url = String.format("%s/blade-auth/oauth/callback/%s?code=%s&appId=%s",
|
|
|
- hostAddress,
|
|
|
- request.getSource(),
|
|
|
- request.getCode(),
|
|
|
- request.getAppId()
|
|
|
- );
|
|
|
- log.info(url);
|
|
|
- builder.url(url);
|
|
|
+ HttpUrl.Builder urlBuilder = Objects.requireNonNull(HttpUrl.parse(String.format("%s/blade-auth/oauth/auth-login/%s", hostAddress, request.getSource()))).newBuilder();
|
|
|
+ urlBuilder.addQueryParameter("uuid", request.getUuid());
|
|
|
+ urlBuilder.addQueryParameter("name", request.getName());
|
|
|
+ urlBuilder.addQueryParameter("realName", request.getRealName());
|
|
|
+ if (request.getSex() != null) {
|
|
|
+ urlBuilder.addQueryParameter("sex", request.getSex().toString());
|
|
|
+ }
|
|
|
+ urlBuilder.addQueryParameter("email", request.getEmail());
|
|
|
+ urlBuilder.addQueryParameter("phone", request.getPhone());
|
|
|
+
|
|
|
+ log.info(urlBuilder.build().toString());
|
|
|
+ builder.url(urlBuilder.build());
|
|
|
builder.header("Authorization", "Basic " + clientSecret);
|
|
|
builder.header("Content-Type", "application/x-www-form-urlencode");
|
|
|
builder.get();
|
|
|
@@ -146,49 +144,49 @@ public class Oauth2Api {
|
|
|
return this.getResponse(builder);
|
|
|
}
|
|
|
|
|
|
- @ServiceMethod(method = "oauth2.wechat.mp.bind", title = "微信公众号账号绑定")
|
|
|
- public OapResponse oauthWechatBind(Oauth2WechatMpBindRequest request) throws IOException {
|
|
|
-
|
|
|
- String hostAddress = this.systemConfigService.getStringValue("OAUTH2_API_CONFIG", "hostAddress");
|
|
|
- String clientSecret = this.systemConfigService.getStringValue("OAUTH2_API_CONFIG", "clientSecret");
|
|
|
-
|
|
|
- Map<String, String> paramValues = new HashMap<>();
|
|
|
- paramValues.put("uuid", request.getUuid());
|
|
|
- paramValues.put("username", request.getUsername());
|
|
|
- paramValues.put("password", request.getPassword());
|
|
|
-
|
|
|
- RequestBody body = RequestBody.create(JSON.toJSONString(paramValues), MediaType.parse("application/json; charset=utf-8"));
|
|
|
-
|
|
|
- Request.Builder builder = new Request.Builder();
|
|
|
- builder.url(String.format("%s/blade-auth/oauth/bind/%s", hostAddress, request.getSource()));
|
|
|
- builder.header("Authorization", "Basic " + clientSecret);
|
|
|
- builder.header("Content-Type", "application/json");
|
|
|
- builder.post(body);
|
|
|
-
|
|
|
- return this.getResponse(builder);
|
|
|
- }
|
|
|
-
|
|
|
- @ServiceMethod(method = "oauth2.wechat.mp.register.bind", title = "微信公众号注册绑定")
|
|
|
- public OapResponse oauthWechatRegisterBind(Oauth2WechatMpRegisterBindRequest request) throws IOException {
|
|
|
-
|
|
|
- String hostAddress = this.systemConfigService.getStringValue("OAUTH2_API_CONFIG", "hostAddress");
|
|
|
- String clientSecret = this.systemConfigService.getStringValue("OAUTH2_API_CONFIG", "clientSecret");
|
|
|
-
|
|
|
- Map<String, String> paramValues = new HashMap<>();
|
|
|
- paramValues.put("uuid", request.getUuid());
|
|
|
- paramValues.put("username", request.getUsername());
|
|
|
- paramValues.put("password", request.getPassword());
|
|
|
-
|
|
|
- RequestBody body = RequestBody.create(JSON.toJSONString(paramValues), MediaType.parse("application/json; charset=utf-8"));
|
|
|
-
|
|
|
- Request.Builder builder = new Request.Builder();
|
|
|
- builder.url(String.format("%s/blade-auth/oauth/register/bind/%s", hostAddress, request.getSource()));
|
|
|
- builder.header("Authorization", "Basic " + clientSecret);
|
|
|
- builder.header("Content-Type", "application/json");
|
|
|
- builder.post(body);
|
|
|
-
|
|
|
- return this.getResponse(builder);
|
|
|
- }
|
|
|
+// @ServiceMethod(method = "oauth2.wechat.mp.bind", title = "微信公众号账号绑定")
|
|
|
+// public OapResponse oauthWechatBind(Oauth2WechatMpBindRequest request) throws IOException {
|
|
|
+//
|
|
|
+// String hostAddress = this.systemConfigService.getStringValue("OAUTH2_API_CONFIG", "hostAddress");
|
|
|
+// String clientSecret = this.systemConfigService.getStringValue("OAUTH2_API_CONFIG", "clientSecret");
|
|
|
+//
|
|
|
+// Map<String, String> paramValues = new HashMap<>();
|
|
|
+// paramValues.put("uuid", request.getUuid());
|
|
|
+// paramValues.put("username", request.getUsername());
|
|
|
+// paramValues.put("password", request.getPassword());
|
|
|
+//
|
|
|
+// RequestBody body = RequestBody.create(JSON.toJSONString(paramValues), MediaType.parse("application/json; charset=utf-8"));
|
|
|
+//
|
|
|
+// Request.Builder builder = new Request.Builder();
|
|
|
+// builder.url(String.format("%s/blade-auth/oauth/bind/%s", hostAddress, request.getSource()));
|
|
|
+// builder.header("Authorization", "Basic " + clientSecret);
|
|
|
+// builder.header("Content-Type", "application/json");
|
|
|
+// builder.post(body);
|
|
|
+//
|
|
|
+// return this.getResponse(builder);
|
|
|
+// }
|
|
|
+//
|
|
|
+// @ServiceMethod(method = "oauth2.wechat.mp.register.bind", title = "微信公众号注册绑定")
|
|
|
+// public OapResponse oauthWechatRegisterBind(Oauth2WechatMpRegisterBindRequest request) throws IOException {
|
|
|
+//
|
|
|
+// String hostAddress = this.systemConfigService.getStringValue("OAUTH2_API_CONFIG", "hostAddress");
|
|
|
+// String clientSecret = this.systemConfigService.getStringValue("OAUTH2_API_CONFIG", "clientSecret");
|
|
|
+//
|
|
|
+// Map<String, String> paramValues = new HashMap<>();
|
|
|
+// paramValues.put("uuid", request.getUuid());
|
|
|
+// paramValues.put("username", request.getUsername());
|
|
|
+// paramValues.put("password", request.getPassword());
|
|
|
+//
|
|
|
+// RequestBody body = RequestBody.create(JSON.toJSONString(paramValues), MediaType.parse("application/json; charset=utf-8"));
|
|
|
+//
|
|
|
+// Request.Builder builder = new Request.Builder();
|
|
|
+// builder.url(String.format("%s/blade-auth/oauth/register/bind/%s", hostAddress, request.getSource()));
|
|
|
+// builder.header("Authorization", "Basic " + clientSecret);
|
|
|
+// builder.header("Content-Type", "application/json");
|
|
|
+// builder.post(body);
|
|
|
+//
|
|
|
+// return this.getResponse(builder);
|
|
|
+// }
|
|
|
|
|
|
/**
|
|
|
* 已经对接成功
|