Skip to content

Commit

Permalink
71410: Authorization for Downloads of restricted Bitstreams
Browse files Browse the repository at this point in the history
- Add test that the ePerson session salt isn't updated when requesting a short lived token
  • Loading branch information
peter-atmire committed Jun 25, 2020
1 parent 6a88ef5 commit 9f77864
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.notNullValue;
import static org.hamcrest.Matchers.startsWith;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotEquals;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
Expand Down Expand Up @@ -779,10 +780,16 @@ public void testPasswordAuthenticationDoesNotWorkWithShibOnly() throws Exception
@Test
public void testShortLivedToken() throws Exception {
String token = getAuthToken(eperson.getEmail(), password);

// Verify the main session salt doesn't change
String salt = eperson.getSessionSalt();

getClient(token).perform(post("/api/authn/shortlivedtokens"))
.andExpect(jsonPath("$.token", notNullValue()))
.andExpect(jsonPath("$.type", is("shortlivedtoken")))
.andExpect(jsonPath("$._links.self.href", Matchers.containsString("/api/authn/shortlivedtokens")));

assertEquals(salt, eperson.getSessionSalt());
}

@Test
Expand Down

0 comments on commit 9f77864

Please sign in to comment.