Ejemplo n.º 1
0
    @Test
    public void itReturnsASessionWithTheUserAndKeySet() throws Exception {
      final Session session = creds.buildSession(userDAO, "woo");

      assertThat(session.getUser()).isEqualTo(user);
      assertThat(session.getKeySet()).isEqualTo(unlockedKeySet);
    }
Ejemplo n.º 2
0
  @DELETE
  @Transactional
  public Response deleteLink(
      @Context Credentials credentials,
      @PathParam("user_id") String userId,
      @PathParam("name") String name,
      @PathParam("reader_id") String readerId) {

    final Session session = credentials.buildSession(userDAO, userId);
    final User reader = findUser(readerId);
    final Document doc = findDocument(session.getUser(), name);

    doc.unlinkUser(reader);
    reEncrypt(doc, session.getKeySet());

    documentDAO.saveOrUpdate(doc);

    return Response.noContent().build();
  }