类 BaiduUtils
java.lang.Object
org.dromara.sms4j.baidu.utils.BaiduUtils
-
构造器概要
构造器 -
方法概要
修饰符和类型方法说明private static StringauthStringPrefix(String accessKeyId) 创建前缀字符串buildBody(String mobile, String template, String signatureId, LinkedHashMap<String, String> contentVar, String custom, String userExtId) 构造 HTTP Body 请求体buildHeaders(BaiduConfig config, String clientToken) 构造 HTTP Headers请求头private static StringcanonicalHeaders(String host) Formatting the headers from the request based on signing protocol.private static StringcanonicalQueryString(String clientToken) Formatting the query string with signing protocol.private static StringcanonicalRequest(String host, String action, String clientToken) 创建规范请求private static StringcanonicalURI(String action) Formatting the URL with signing protocol.private static StringHMAC-SHA256-HEX
-
构造器详细资料
-
BaiduUtils
public BaiduUtils()
-
-
方法详细资料
-
authStringPrefix
创建前缀字符串- 参数:
accessKeyId- 访问密钥ID- 返回:
- bce-auth-v1/{accessKeyId}/{timestamp}/{expirationPeriodInSeconds }
-
canonicalRequest
创建规范请求- 参数:
host- Host域action- 接口名称clientToken- 幂等性参数- 返回:
- HTTP Method + "\n" + CanonicalURI + "\n" + CanonicalQueryString + "\n" + CanonicalHeaders
-
canonicalURI
Formatting the URL with signing protocol.- 参数:
action- URI- 返回:
- UriEncodeExceptSlash
-
canonicalQueryString
Formatting the query string with signing protocol.- 参数:
clientToken- 幂等性参数- 返回:
- String
-
canonicalHeaders
Formatting the headers from the request based on signing protocol.- 参数:
host- only host- 返回:
- String
-
sha256Hex
HMAC-SHA256-HEX- 参数:
key- 密钥str- 要加密的字符串- 返回:
- 小写形式的十六进制字符串
-
buildHeaders
构造 HTTP Headers请求头- 参数:
config- 百度智能云配置clientToken- 幂等性参数- 返回:
- Headers请求头
-
buildBody
public static Map<String,Object> buildBody(String mobile, String template, String signatureId, LinkedHashMap<String, String> contentVar, String custom, String userExtId) 构造 HTTP Body 请求体- 参数:
mobile- 手机号码 支持单个或多个手机号,多个手机号之间以英文逗号分隔template- 短信模板ID,模板申请成功后自动创建,全局内唯一signatureId- 短信签名ID,签名表申请成功后自动创建,全局内唯一contentVar- 模板变量内容,用于替换短信模板中定义的变量custom- 用户自定义参数,格式为字符串,状态回调时会回传该值userExtId- 通道自定义扩展码,上行回调时会回传该值,其格式为纯数字串。默认为不开通,请求时无需设置该参数。如需开通请联系SMS帮助申请- 返回:
- Body 请求体
-