Skip to content

Commit

Permalink
addressed remarks from PR review #252
Browse files Browse the repository at this point in the history
  • Loading branch information
overheadhunter committed Jan 26, 2024
1 parent 94b3483 commit ff0967e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public Response updateMyAccessTokens(@NotEmpty Map<UUID, String> tokens) {
var user = User.<User>findById(jwt.getSubject());
for (var entry : tokens.entrySet()) {
var vault = Vault.<Vault>findById(entry.getKey());
if (vault == null || vault.archived) {
if (vault == null) {
continue; // skip
}
var token = AccessToken.<AccessToken>findById(new AccessToken.AccessId(user.id, vault.id));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,17 @@ public void testGetLegacyAccessTokens1() {

@Test
@Order(1)
@DisplayName("GET /devices/legacyDevice3/legacy-access-tokens returns 200")
@DisplayName("GET /devices/legacyDevice2/legacy-access-tokens returns empty list (owned by different user)")
public void testGetLegacyAccessTokens2() {
given().when().get("/devices/{deviceId}/legacy-access-tokens", "legacyDevice2")
.then().statusCode(200)
.body(is("{}"));
}

@Test
@Order(1)
@DisplayName("GET /devices/legacyDevice3/legacy-access-tokens returns 200")
public void testGetLegacyAccessTokens3() {
given().when().get("/devices/{deviceId}/legacy-access-tokens", "legacyDevice3")
.then().statusCode(200)
.body("7e57c0de-0000-4000-8000-000100002222", is("legacy.jwe.jwe.vault2.device3"));
Expand Down

0 comments on commit ff0967e

Please sign in to comment.