public class SignOptions extends Object
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
|
| 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). |
| Modifier and Type | Field and Description |
|---|---|
static SignOptions |
DEFAULT
The default sign options, which is {headersToSign:null, timestamp:null, expirationInSeconds:1800}.
|
static int |
DEFAULT_EXPIRATION_IN_SECONDS |
static int |
DEFAULT_MAX_EXPIRATION_IN_SECONDS
Deprecated.
|
static int |
DEFAULT_MIN_EXPIRATION_IN_SECONDS
Deprecated.
|
| Constructor and Description |
|---|
SignOptions() |
| Modifier and Type | Method and Description |
|---|---|
void |
addHeadersToSign(String headerKey)
Add the key of headers to be signed.
|
int |
getExpirationInSeconds()
Returns the time until the signature will expire.
|
Set<String> |
getHeadersToSign()
Returns the set of headers to be signed.
|
Date |
getTimestamp()
Returns the time when the signature was created.
|
Boolean |
getUseStsHeader()
Get the options of whether add header(x-bce-security-token)
|
void |
setExpirationInSeconds(int expirationInSeconds)
Sets the time until the signature will expire.
|
void |
setHeadersToSign(Set<String> headersToSign)
Sets the set of headers to be signed.
|
void |
setTimestamp(Date timestamp)
Sets the time when the signature was created.
|
void |
setUseStsHeader(Boolean useStsHeader)
Set stsHeader options
|
String |
toString() |
public static final SignOptions DEFAULT
public static final int DEFAULT_EXPIRATION_IN_SECONDS
@Deprecated public static final int DEFAULT_MIN_EXPIRATION_IN_SECONDS
@Deprecated public static final int DEFAULT_MAX_EXPIRATION_IN_SECONDS
public Set<String> getHeadersToSign()
public void setHeadersToSign(Set<String> headersToSign)
headersToSign - the set of headers to be signed.public void addHeadersToSign(String headerKey)
headerKey - the key of headers to be signed.public Date getTimestamp()
public void setTimestamp(Date timestamp)
timestamp - the time when the signature was created.public int getExpirationInSeconds()
public void setExpirationInSeconds(int expirationInSeconds)
expirationInSeconds - The time until the signature will expire.public Boolean getUseStsHeader()
public void setUseStsHeader(Boolean useStsHeader)
useStsHeader - The set of headers to be signed.Copyright © 2023. All rights reserved.