private long generateExpirationDate ( Date expirationDate ) { long expirationInSeconds = expirationDate != null ? ( ( expirationDate . getTime ( ) - clock . currentTimeMillis ( ) ) / 1000L ) : PRESIGN_URL_MAX_EXPIRATION_SECONDS ; if ( expirationInSeconds > PRESIGN_URL_MAX_EXPIRATION_SECONDS ) { throw new SdkClientException ( "Requests that are pre-signed by SigV4 algorithm are valid for at most 7 days. " + "The expiration date set on the current request [" + AWS4SignerUtils . formatTimestamp ( expirationDate . getTime ( ) ) + "] has exceeded this limit." ) ; } return expirationInSeconds ; }
Generates an expiration date for the presigned url . If user has specified an expiration date check if it is in the given limit .