com.baidubce.auth
Class SignOptions

java.lang.Object
  extended by 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).


Field Summary
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 Summary
SignOptions()
           
 
Method Summary
 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.
 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.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

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
See Also:
Constant Field Values

DEFAULT_MIN_EXPIRATION_IN_SECONDS

@Deprecated
public static final int DEFAULT_MIN_EXPIRATION_IN_SECONDS
Deprecated. 
See Also:
Constant Field Values

DEFAULT_MAX_EXPIRATION_IN_SECONDS

@Deprecated
public static final int DEFAULT_MAX_EXPIRATION_IN_SECONDS
Deprecated. 
See Also:
Constant Field Values
Constructor Detail

SignOptions

public SignOptions()
Method Detail

getHeadersToSign

public Set<String> getHeadersToSign()
Returns the set of headers to be signed.

Returns:
the set of headers to be signed.

setHeadersToSign

public void setHeadersToSign(Set<String> headersToSign)
Sets the set of headers to be signed.

Parameters:
headersToSign - the set of headers to be signed.

getTimestamp

public Date getTimestamp()
Returns the time when the signature was created.

Returns:
the time when the signature was created.

setTimestamp

public void setTimestamp(Date timestamp)
Sets the time when the signature was created.

Parameters:
timestamp - the time when the signature was created.

getExpirationInSeconds

public int getExpirationInSeconds()
Returns the time until the signature will expire.

Returns:
the time until the signature will expire.

setExpirationInSeconds

public void setExpirationInSeconds(int expirationInSeconds)
Sets the time until the signature will expire.

Parameters:
expirationInSeconds - The time until the signature will expire.

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2018. All rights reserved.