houzhongjian
2025-03-06 37cb8688dc8e320a40b51c6d6128f64800706413
iailab-plat-sdk/src/main/java/com/iailab/sdk/auth/client/IailabAuthClient.java
@@ -2,7 +2,7 @@
import com.iailab.sdk.auth.client.dto.TokenDTO;
import com.iailab.sdk.auth.config.AuthProperties;
import com.iailab.sdk.auth.constants.ErrorCodeConstants;
import com.iailab.sdk.auth.constants.SdkErrorCodeConstants;
import org.springframework.core.ParameterizedTypeReference;
import org.springframework.http.*;
import org.springframework.stereotype.Component;
@@ -72,18 +72,18 @@
        Assert.isTrue(exchange.getStatusCode().is2xxSuccessful(), "响应必须是 200 成功");
        Map<String, Object> authMap = exchange.getBody();
        Object code = authMap.get("code");
        if(ErrorCodeConstants.AUTH_BAD_CREDENTIALS.getCode().equals(code)) {
            throw exception(ErrorCodeConstants.AUTH_BAD_CREDENTIALS);
        } else if(ErrorCodeConstants.AUTH_LOGIN_BAD_CREDENTIALS.getCode().equals(code)) {
            throw exception(ErrorCodeConstants.AUTH_LOGIN_BAD_CREDENTIALS);
        } else if(ErrorCodeConstants.OAUTH2_CLIENT_REDIRECT_URI_NOT_MATCH.getCode().equals(code)) {
            throw exception(ErrorCodeConstants.OAUTH2_CLIENT_REDIRECT_URI_NOT_MATCH);
        } else if(ErrorCodeConstants.OAUTH2_CLIENT_CLIENT_SECRET_ERROR.getCode().equals(code)) {
            throw exception(ErrorCodeConstants.OAUTH2_CLIENT_CLIENT_SECRET_ERROR);
        } else if(ErrorCodeConstants.OAUTH2_CLIENT_NOT_EXISTS.getCode().equals(code)) {
            throw exception(ErrorCodeConstants.OAUTH2_CLIENT_NOT_EXISTS);
        } else if(ErrorCodeConstants.OAUTH2_CLIENT_DISABLE.getCode().equals(code)) {
            throw exception(ErrorCodeConstants.OAUTH2_CLIENT_DISABLE);
        if(SdkErrorCodeConstants.AUTH_BAD_CREDENTIALS.getCode().equals(code)) {
            throw exception(SdkErrorCodeConstants.AUTH_BAD_CREDENTIALS);
        } else if(SdkErrorCodeConstants.AUTH_LOGIN_BAD_CREDENTIALS.getCode().equals(code)) {
            throw exception(SdkErrorCodeConstants.AUTH_LOGIN_BAD_CREDENTIALS);
        } else if(SdkErrorCodeConstants.OAUTH2_CLIENT_REDIRECT_URI_NOT_MATCH.getCode().equals(code)) {
            throw exception(SdkErrorCodeConstants.OAUTH2_CLIENT_REDIRECT_URI_NOT_MATCH);
        } else if(SdkErrorCodeConstants.OAUTH2_CLIENT_CLIENT_SECRET_ERROR.getCode().equals(code)) {
            throw exception(SdkErrorCodeConstants.OAUTH2_CLIENT_CLIENT_SECRET_ERROR);
        } else if(SdkErrorCodeConstants.OAUTH2_CLIENT_NOT_EXISTS.getCode().equals(code)) {
            throw exception(SdkErrorCodeConstants.OAUTH2_CLIENT_NOT_EXISTS);
        } else if(SdkErrorCodeConstants.OAUTH2_CLIENT_DISABLE.getCode().equals(code)) {
            throw exception(SdkErrorCodeConstants.OAUTH2_CLIENT_DISABLE);
        }
        accessToken = authMap.get("access_token").toString();
        refreshToken = authMap.get("refresh_token").toString();
@@ -113,7 +113,7 @@
            if (code == 401) {
                authenticate();
            } else {
                throw exception(ErrorCodeConstants.AUTH_REFRESH_TOKEN_ERROR);
                throw exception(SdkErrorCodeConstants.AUTH_REFRESH_TOKEN_ERROR);
            }
        } else {
            accessToken = authMap.get("access_token").toString();