All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.feingto.cloud.constants.SdkConstants Maven / Gradle / Ivy

There is a newer version: 2.3.5.RELEASE
Show newest version
package com.feingto.cloud.constants;

import org.springframework.http.HttpHeaders;
import org.springframework.security.oauth2.common.OAuth2AccessToken;

import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;

/**
 * sdk常量
 *
 * @author longfei
 */
public class SdkConstants {
    /**
     * 参与签名的系统Header前缀,只有指定前缀的Header才会参与到签名中
     */
    public static final String API_X_CA_HEADER_TO_SIGN_PREFIX = "X-Ca-";

    /**
     * 签名Header
     * 将Request中的httpMethod、headers、path、queryParam、formParam合成一个字符串
     * 用hmacSha256算法双向加密进行签名并把签名内容放到Http头中,用作服务器校验
     */
    public static final String API_X_CA_SIGNATURE = "X-Ca-Signature";

    /**
     * 所有参与签名的Header
     */
    public static final String API_X_CA_SIGNATURE_HEADERS = "X-Ca-Signature-Headers";

    /**
     * X-Ca-Stage Header
     */
    public static final String API_X_CA_STAGE_HEADER = "X-Ca-Stage";

    /**
     * APP_DATA KEY
     */
    public static final String API_X_CA_KEY = "X-Ca-Key";

    /**
     * ACCESS_TOKEN for OAuth2 (请求 API 开启了安全认证的 Token)
     *
     * @see org.springframework.cloud.security.oauth2.proxy.OAuth2TokenRelayFilter
     */
    public static final String API_ACCESS_TOKEN = OAuth2AccessToken.ACCESS_TOKEN;

    /**
     * Authorization Header
     */
    public static final String API_AUTHORIZATION_HEADER = HttpHeaders.AUTHORIZATION;

    /**
     * 编码UTF-8
     */
    public static final Charset API_ENCODING = StandardCharsets.UTF_8;

    /**
     * Header头的编码
     */
    public static final Charset API_HEADER_ENCODING = StandardCharsets.US_ASCII;
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy