类 SignOptions
- java.lang.Object
-
- com.baidubce.auth.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).
-
-
字段概要
字段 修饰符和类型 字段 说明 static SignOptionsDEFAULTThe default sign options, which is {headersToSign:null, timestamp:null, expirationInSeconds:1800}.static intDEFAULT_EXPIRATION_IN_SECONDSstatic intDEFAULT_MAX_EXPIRATION_IN_SECONDS已过时。static intDEFAULT_MIN_EXPIRATION_IN_SECONDS已过时。
-
构造器概要
构造器 构造器 说明 SignOptions()
-
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 voidaddHeadersToSign(String headerKey)Add the key of headers to be signed.intgetExpirationInSeconds()Returns the time until the signature will expire.Set<String>getHeadersToSign()Returns the set of headers to be signed.DategetTimestamp()Returns the time when the signature was created.BooleangetUseStsHeader()Get the options of whether add header(x-bce-security-token)voidsetExpirationInSeconds(int expirationInSeconds)Sets the time until the signature will expire.voidsetHeadersToSign(Set<String> headersToSign)Sets the set of headers to be signed.voidsetTimestamp(Date timestamp)Sets the time when the signature was created.voidsetUseStsHeader(Boolean useStsHeader)Set stsHeader optionsStringtoString()
-
-
-
字段详细资料
-
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
已过时。- 另请参阅:
- 常量字段值
-
-
方法详细资料
-
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.
-
-