Skip to content

Commit

Permalink
71672: Authorization for Downloads of restricted Bitstreams
Browse files Browse the repository at this point in the history
- Fix checkstyle
  • Loading branch information
peter-atmire committed Jul 1, 2020
1 parent be89cc8 commit 9044daf
Showing 1 changed file with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -804,7 +804,8 @@ public void testShortLivedTokenToDowloadBitstream() throws Exception {
Bitstream bitstream = createPrivateBitstream();
String shortLivedToken = getShortLivedToken(eperson);

getClient().perform(get("/api/core/bitstreams/" + bitstream.getID() + "/content?authentication-token=" + shortLivedToken))
getClient().perform(get("/api/core/bitstreams/" + bitstream.getID()
+ "/content?authentication-token=" + shortLivedToken))
.andExpect(status().isOk());
}

Expand All @@ -821,7 +822,8 @@ public void testShortLivedTokenToDowloadBitstreamUnauthorized() throws Exception
context.restoreAuthSystemState();

String shortLivedToken = getShortLivedToken(testEPerson);
getClient().perform(get("/api/core/bitstreams/" + bitstream.getID() + "/content?authentication-token=" + shortLivedToken))
getClient().perform(get("/api/core/bitstreams/" + bitstream.getID()
+ "/content?authentication-token=" + shortLivedToken))
.andExpect(status().isForbidden());
}

Expand All @@ -830,7 +832,8 @@ public void testLoginTokenToDowloadBitstream() throws Exception {
Bitstream bitstream = createPrivateBitstream();

String loginToken = getAuthToken(eperson.getEmail(), password);
getClient().perform(get("/api/core/bitstreams/" + bitstream.getID() + "/content?authentication-token=" + loginToken))
getClient().perform(get("/api/core/bitstreams/" + bitstream.getID()
+ "/content?authentication-token=" + loginToken))
.andExpect(status().isForbidden());
}

Expand All @@ -840,7 +843,8 @@ public void testExpiredShortLivedTokenToDowloadBitstream() throws Exception {
configurationService.setProperty("jwt.shortLived.token.expiration", "1");
String shortLivedToken = getShortLivedToken(eperson);
Thread.sleep(1);
getClient().perform(get("/api/core/bitstreams/" + bitstream.getID() + "/content?authentication-token=" + shortLivedToken))
getClient().perform(get("/api/core/bitstreams/" + bitstream.getID()
+ "/content?authentication-token=" + shortLivedToken))
.andExpect(status().isForbidden());
}

Expand Down

0 comments on commit 9044daf

Please sign in to comment.