@@ -40,23 +40,23 @@ public static void main(String[] args) throws NoSuchAlgorithmException, InvalidK
4040 // TODO(developer): Replace these variables before running the sample.
4141 // Secret key as a base64 encoded string.
4242 byte [] base64Key = new byte []{};
43- // Algorithm can be either `SHA1` or ` SHA256` or ` Ed25519` .
43+ // Algorithm can be one of these: SHA1, SHA256, or Ed25519.
4444 String signatureAlgorithm = "ed25519" ;
4545 // (Optional) Start time as a UTC datetime object.
4646 DateTimeFormatter formatter = DateTimeFormatter .ISO_INSTANT ;
4747 Optional <Instant > startTime = Optional .empty ();
4848 // Expiration time as a UTC datetime object.
49- // If None, an expiration time 1 hour from now will be used.
49+ // If None, an expiration time that's an hour after the current time is used.
5050 Instant expiresTime = Instant .from (formatter .parse ("2022-09-13T12:00:00Z" ));
5151
5252 // ONE OF (`urlPrefix`, `fullPath`, `pathGlobs`) must be included in each input.
53- // The URL prefix to sign, including protocol .
53+ // The URL prefix and protocol to sign .
5454 // For example: http://example.com/path/ for URLs under /path or http://example.com/path?param=1
5555 Optional <String > urlPrefix = Optional .empty ();
5656 // A full path to sign, starting with the first '/'.
5757 // For example: /path/to/content.mp4
5858 Optional <String > fullPath = Optional .of ("http://10.20.30.40/" );
59- // A set of ','- or '!'-delimited path glob strings .
59+ // A set of path glob strings delimited by ',' or '!'.
6060 // For example: /tv/*!/film/* to sign paths starting with /tv/ or /film/ in any URL.
6161 Optional <String > pathGlobs = Optional .empty ();
6262
@@ -68,7 +68,7 @@ public static void main(String[] args) throws NoSuchAlgorithmException, InvalidK
6868 // May be specified more than once.
6969 // For example: [{'name': 'foo', 'value': 'bar'}, {'name': 'baz', 'value': 'qux'}]
7070 Optional <List <Header >> headers = Optional .empty ();
71- // (Optional) A list of comma separated ip ranges. Both IPv4 and IPv6 ranges are acceptable.
71+ // (Optional) A list of comma- separated IP ranges. Both IPv4 and IPv6 ranges are acceptable.
7272 // For example: "203.0.113.0/24,2001:db8:4a7f:a732/64"
7373 Optional <String > ipRanges = Optional .empty ();
7474
@@ -86,10 +86,10 @@ public static void main(String[] args) throws NoSuchAlgorithmException, InvalidK
8686 ipRanges );
8787 }
8888
89- // Gets the Signed URL Suffix string for the ' Media CDN' Short token URL requests.
89+ // Gets the signed URL suffix string for the Media CDN short token URL requests.
9090 // Result:
91- // The Signed URL appended with the query parameters based on the
92- // specified URL prefix and configuration.
91+ // The signed URL appended with the query parameters based on the
92+ // specified URL prefix and configuration.
9393 public static void signToken (
9494 byte [] base64Key , String signatureAlgorithm , Optional <Instant > startTime ,
9595 Instant expirationTime , Optional <String > urlPrefix , Optional <String > fullPath ,
@@ -100,9 +100,9 @@ public static void signToken(
100100 String field = "" ;
101101 byte [] decodedKey = Base64 .getUrlDecoder ().decode (base64Key );
102102
103- // For most fields, the value we put in the token and the value we must sign
104- // are the same. The FullPath and Headers use a different string for the
105- // value to be signed compared to the token . To illustrate this difference,
103+ // For most fields, the value in the token and the value to sign
104+ // are the same. Compared to the token, the FullPath and Headers
105+ // use a different string for the value to sign . To illustrate this difference,
106106 // we'll keep the token and the value to be signed separate.
107107 List <String > tokens = new ArrayList <>();
108108 List <String > toSign = new ArrayList <>();
@@ -204,7 +204,7 @@ public static void signToken(
204204 "Input Missing Error: `signatureAlgorithm` can only be one of `sha1`, `sha256` or "
205205 + "`ed25519`" );
206206 }
207- // The Signed URL appended with the query parameters based on the
207+ // The signed URL appended with the query parameters based on the
208208 // specified URL prefix and configuration.
209209 System .out .println (String .join ("~" , tokens ));
210210 }
0 commit comments