OCT REM: 1. 启用签名验证功能
This commit is contained in:
parent
701348be1f
commit
8223e294bd
|
@ -6,6 +6,17 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
|
|||
import org.springframework.cloud.context.config.annotation.RefreshScope;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* MwCoreConfig类用于配置与中间件核心相关的属性。
|
||||
*
|
||||
* <p>该类包含客户端ID和客户端密钥,用于与GZS服务进行身份验证。</p>
|
||||
*
|
||||
* <p>该配置类会在Spring容器启动时加载,并支持动态刷新配置。</p>
|
||||
*
|
||||
* @author huangxin@cmhi.chinamobile.com
|
||||
* @version 1.0.0
|
||||
* @since 2025-03-07
|
||||
*/
|
||||
@Configuration
|
||||
@RefreshScope
|
||||
@ConfigurationProperties(prefix = "mw.core")
|
||||
|
@ -13,7 +24,17 @@ import org.springframework.context.annotation.Configuration;
|
|||
@EnableSign
|
||||
public class MwCoreConfig {
|
||||
|
||||
/**
|
||||
* 内部客户端ID。
|
||||
*
|
||||
* <p>默认为"mw-open-82hsbmz8",可通过配置文件进行覆盖。</p>
|
||||
*/
|
||||
private String innerClientId = "mw-open-82hsbmz8";
|
||||
|
||||
/**
|
||||
* 内部客户端密钥。
|
||||
*
|
||||
* <p>默认为"98rnk8pz6j08fp6q",可通过配置文件进行覆盖。</p>
|
||||
*/
|
||||
private String innerClientSecret = "98rnk8pz6j08fp6q";
|
||||
}
|
||||
|
|
|
@ -4,17 +4,37 @@ import com.cmcc.hy.gzs.common.feign.GzsSignRequestInterceptor;
|
|||
import com.cmcc.magent.config.MwCoreConfig;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
/**
|
||||
* MwSignRequestInterceptor类实现了GzsSignRequestInterceptor接口。
|
||||
*
|
||||
* <p>该类用于拦截请求并提供客户端ID和客户端密钥,用于与GZS服务的身份验证。</p>
|
||||
*
|
||||
* @author huangxin@cmhi.chinamobile.com
|
||||
* @version 1.0.0
|
||||
* @since 2025-03-07
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
public class MwSignRequestInterceptor implements GzsSignRequestInterceptor {
|
||||
|
||||
private final MwCoreConfig mwCoreProperties;
|
||||
|
||||
/**
|
||||
* 获取客户端ID。
|
||||
*
|
||||
* @return 客户端ID
|
||||
*/
|
||||
@Override
|
||||
public String getClientId() {
|
||||
return "::";//mwCoreProperties.getInnerClientId();
|
||||
return mwCoreProperties.getInnerClientId();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取客户端密钥。
|
||||
*
|
||||
* @return 客户端密钥
|
||||
*/
|
||||
@Override
|
||||
public String getClientSecret() {
|
||||
return "::";//mwCoreProperties.getInnerClientSecret();
|
||||
return mwCoreProperties.getInnerClientSecret();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue