类 SignOptions


  • public class SignOptions
    extends Object
    Options for signing the request.

    There are 3 options available:

    Option Description
    headersToSign The set of headers to be signed. If this option is not set or set to null, only the following headers are signed
    • Host
    • Content-Length
    • Content-Type
    • Content-MD5
    • All headers starts with "x-bce-"
    timestamp The time when the signature was created. If this option is not set or set to null, the signer will use the time when the sign method is invoked.
    expirationInSeconds The time until the signature will expire, which starts from the timestamp. By default, it is set to 1800 (half an hour).
    • 字段详细资料

      • DEFAULT

        public static final SignOptions DEFAULT
        The default sign options, which is {headersToSign:null, timestamp:null, expirationInSeconds:1800}.
      • DEFAULT_EXPIRATION_IN_SECONDS

        public static final int DEFAULT_EXPIRATION_IN_SECONDS
        另请参阅:
        常量字段值
      • DEFAULT_MIN_EXPIRATION_IN_SECONDS

        @Deprecated
        public static final int DEFAULT_MIN_EXPIRATION_IN_SECONDS
        已过时。
        另请参阅:
        常量字段值
      • DEFAULT_MAX_EXPIRATION_IN_SECONDS

        @Deprecated
        public static final int DEFAULT_MAX_EXPIRATION_IN_SECONDS
        已过时。
        另请参阅:
        常量字段值
    • 构造器详细资料

      • SignOptions

        public SignOptions()
    • 方法详细资料

      • getHeadersToSign

        public Set<String> getHeadersToSign()
        Returns the set of headers to be signed.
        返回:
        the set of headers to be signed.
      • setHeadersToSign

        public void setHeadersToSign​(Set<String> headersToSign)
        Sets the set of headers to be signed.
        参数:
        headersToSign - the set of headers to be signed.
      • addHeadersToSign

        public void addHeadersToSign​(String headerKey)
        Add the key of headers to be signed.
        参数:
        headerKey - the key of headers to be signed.
      • getTimestamp

        public Date getTimestamp()
        Returns the time when the signature was created.
        返回:
        the time when the signature was created.
      • setTimestamp

        public void setTimestamp​(Date timestamp)
        Sets the time when the signature was created.
        参数:
        timestamp - the time when the signature was created.
      • getExpirationInSeconds

        public int getExpirationInSeconds()
        Returns the time until the signature will expire.
        返回:
        the time until the signature will expire.
      • setExpirationInSeconds

        public void setExpirationInSeconds​(int expirationInSeconds)
        Sets the time until the signature will expire.
        参数:
        expirationInSeconds - The time until the signature will expire.
      • getUseStsHeader

        public Boolean getUseStsHeader()
        Get the options of whether add header(x-bce-security-token)
        返回:
        The set of headers to be signed.
      • setUseStsHeader

        public void setUseStsHeader​(Boolean useStsHeader)
        Set stsHeader options
        参数:
        useStsHeader - The set of headers to be signed.