diff --git a/scfs-api-core/src/main/java/com/czcb/scfs/api/core/cipher/DefaultValidator.java b/scfs-api-core/src/main/java/com/czcb/scfs/api/core/cipher/DefaultValidator.java index 7333f1d..e761cbc 100644 --- a/scfs-api-core/src/main/java/com/czcb/scfs/api/core/cipher/DefaultValidator.java +++ b/scfs-api-core/src/main/java/com/czcb/scfs/api/core/cipher/DefaultValidator.java @@ -6,6 +6,7 @@ import com.czcb.scfs.api.core.exception.TimestampException; import com.czcb.scfs.api.core.exception.ValidationException; import com.czcb.scfs.api.core.http.HttpLogger; import com.czcb.scfs.api.core.http.OriginalResponse; +import com.czcb.scfs.api.core.util.Strings; import java.time.Duration; import java.time.Instant; @@ -63,6 +64,10 @@ public final class DefaultValidator implements Validator { // 校验时间戳 validateTimestamp(response); + if (!headerContainsSecretKey(response)) { + return; + } + // 待签名串 String message = profile.getSignature().getCredential().buildResponseMessage(response, channel); try { @@ -82,4 +87,8 @@ public final class DefaultValidator implements Validator { response.getHttpHeaders().getHeader(REQUEST_ID)), e); } } + + private boolean headerContainsSecretKey(OriginalResponse response) { + return Strings.isEmpty(response.getHttpHeaders().getHeader(SECRET_KEY)); + } } diff --git a/scfs-api-service/src/main/java/com/czcb/scfs/api/service/health/model/EchoResponse.java b/scfs-api-service/src/main/java/com/czcb/scfs/api/service/health/model/EchoResponse.java index b9837cf..d63bfe5 100644 --- a/scfs-api-service/src/main/java/com/czcb/scfs/api/service/health/model/EchoResponse.java +++ b/scfs-api-service/src/main/java/com/czcb/scfs/api/service/health/model/EchoResponse.java @@ -1,24 +1,43 @@ package com.czcb.scfs.api.service.health.model; import com.czcb.scfs.api.core.ApiResponse; +import com.google.gson.annotations.SerializedName; +import lombok.Data; /** * @author wangwei * @since 2.0.0 */ +@Data public class EchoResponse implements ApiResponse { + @SerializedName("message") private String message; - public String getMessage() { - return message; - } + /** + * 000000:表示成功 + */ + @SerializedName("recode") + private String recode; - public void setMessage(String message) { - this.message = message; - } + /** + * 结果信息 + */ + @SerializedName("recode_info") + private String recodeInfo; + + /** + * 系统日期(YYYY-MM-DD) + */ + @SerializedName("sys_date") + private String sysDate; + + /** + * 系统时间(YYYY-MM-DD hh:mm:ss) + */ + @SerializedName("sys_time") + private String sysTime; public boolean ok() { return "ok".equals(getMessage()); } - }