Skip to content

Commit e94c23b

Browse files
michalkcloudinaynitzanj
authored andcommitted
Ignore URL in AuthToken generation if ACL is provided (#184)
1 parent 48e64f7 commit e94c23b

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

cloudinary-core/src/test/java/com/cloudinary/AuthTokenTest.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,4 +116,14 @@ public void testUrlInTag() {
116116
assertThat(url, Matchers.matchesPattern("<img.*src='http://res.cloudinary.com/test123/image/authenticated/v1486020273/sample.jpg\\?__cld_token__=st=11111111~exp=11111411~hmac=9bd6f41e2a5893da8343dc8eb648de8bf73771993a6d1457d49851250caf3b80.*>"));
117117

118118
}
119-
}
119+
120+
@Test
121+
public void testIgnoreUrlIfAclIsProvided() {
122+
String user = "foobar"; // username taken from elsewhere
123+
AuthToken token = new AuthToken(KEY).duration(300).acl("/*/t_" + user).startTime(222222222);
124+
String cookieToken = token.generate();
125+
AuthToken aclToken = new AuthToken(KEY).duration(300).acl("/*/t_" + user).startTime(222222222);
126+
String cookieAclToken = aclToken.generate("http://res.cloudinary.com/test123/image/upload/v1486020273/sample.jpg");
127+
assertEquals(cookieToken, cookieAclToken);
128+
}
129+
}

0 commit comments

Comments
 (0)