Skip to content

Commit 765ac91

Browse files
committed
feat:更新认证侧方法
1 parent 4d868be commit 765ac91

File tree

1 file changed

+46
-33
lines changed

1 file changed

+46
-33
lines changed

src/main/java/cn/authing/sdk/java/client/AuthenticationClient.java

Lines changed: 46 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -2336,6 +2336,19 @@ public Object authByCode(WechatMobileAuthByCodeInput reqDto) {
23362336
return deserialize(response, Object.class);
23372337
}
23382338

2339+
/**
2340+
* @summary 验证 MFA Token
2341+
* @description 验证 MFA Token
2342+
**/
2343+
public MfaTokenIntrospectResponse verifyMfaToken(MfaTokenIntrospectEndpointParams reqDto) {
2344+
AuthingRequestConfig config = new AuthingRequestConfig();
2345+
config.setUrl("/mfa/token/introspection");
2346+
config.setBody(reqDto);
2347+
config.setMethod("POST");
2348+
String response = request(config);
2349+
return deserialize(response, MfaTokenIntrospectResponse.class);
2350+
}
2351+
23392352
/**
23402353
* @summary 发起绑定 MFA 认证要素请求
23412354
* @description 当用户未绑定某个 MFA 认证要素时,可以发起绑定 MFA 认证要素请求。不同类型的 MFA 认证要素绑定请求需要发送不同的参数,详细见 profile
@@ -2429,40 +2442,40 @@ public MfaOtpVerityRespDto mfaOtpVerify(MfaOtpVerityDto reqDto) {
24292442
return deserialize(response, MfaOtpVerityRespDto.class);
24302443
}
24312444

2432-
// ==== AUTO GENERATED AUTHENTICATION METHODS END ====
2433-
@Override
2434-
public void subEvent(String eventCode, Receiver receiver) {
2435-
if (StrUtil.isBlank(eventCode)) {
2436-
throw new IllegalArgumentException("eventCode is required");
2437-
}
2438-
if (receiver == null) {
2439-
throw new IllegalArgumentException("receiver is required");
2440-
}
2441-
Assert.notNull(this.options.getAccessToken());
2442-
AuthenticationClientOptions options = (AuthenticationClientOptions) this.options;
2443-
String eventUri = options.getWebSocketHost()+options.getWebSocketEndpoint()
2444-
+"?code="+eventCode
2445-
+"&token="+this.options.getAccessToken();
2446-
URI wssUri = null;
2447-
try {
2448-
wssUri = new URI(eventUri);
2449-
} catch (URISyntaxException e) {
2450-
throw new RuntimeException(e);
2451-
}
2452-
HashMap<String,String> headers = new HashMap();
2453-
AuthingWebsocketClient client = new AuthingWebsocketClient(wssUri,headers,receiver);
2454-
client.connect();
2445+
// ==== AUTO GENERATED AUTHENTICATION METHODS END ====
2446+
@Override
2447+
public void subEvent(String eventCode, Receiver receiver) {
2448+
if (StrUtil.isBlank(eventCode)) {
2449+
throw new IllegalArgumentException("eventCode is required");
24552450
}
2456-
2457-
public CommonResponseDto pubtEvent(String eventCode,Object data){
2458-
Assert.notNull(eventCode);
2459-
Assert.notNull(data);
2460-
AuthingRequestConfig config = new AuthingRequestConfig();
2461-
config.setUrl("/api/v3/pub-userEvent");
2462-
config.setBody(new EventDto(eventCode,data));
2463-
config.setMethod("POST");
2464-
String response = request(config);
2465-
return deserialize(response, CommonResponseDto.class);
2451+
if (receiver == null) {
2452+
throw new IllegalArgumentException("receiver is required");
24662453
}
2454+
Assert.notNull(this.options.getAccessToken());
2455+
AuthenticationClientOptions options = (AuthenticationClientOptions) this.options;
2456+
String eventUri = options.getWebSocketHost() + options.getWebSocketEndpoint()
2457+
+ "?code=" + eventCode
2458+
+ "&token=" + this.options.getAccessToken();
2459+
URI wssUri = null;
2460+
try {
2461+
wssUri = new URI(eventUri);
2462+
} catch (URISyntaxException e) {
2463+
throw new RuntimeException(e);
2464+
}
2465+
HashMap<String, String> headers = new HashMap();
2466+
AuthingWebsocketClient client = new AuthingWebsocketClient(wssUri, headers, receiver);
2467+
client.connect();
2468+
}
2469+
2470+
public CommonResponseDto pubtEvent(String eventCode, Object data) {
2471+
Assert.notNull(eventCode);
2472+
Assert.notNull(data);
2473+
AuthingRequestConfig config = new AuthingRequestConfig();
2474+
config.setUrl("/api/v3/pub-userEvent");
2475+
config.setBody(new EventDto(eventCode, data));
2476+
config.setMethod("POST");
2477+
String response = request(config);
2478+
return deserialize(response, CommonResponseDto.class);
2479+
}
24672480

24682481
}

0 commit comments

Comments
 (0)