@Override
 public Response login(LoginParameters parameters) {
   try {
     BackendResponse login = backend.login(parameters.getUsername(), parameters.getPassword());
     return Response.ok(login).build();
   } catch (BadRequestException | UnauthorizedException | ForbiddenResourceException ex) {
     Logger.getLogger(this.getClass().getName()).log(Level.WARNING, null, ex);
     return Response.status(ex.getStatus())
         .entity(new BackendResponse(ex.getStatus(), ex.getMessage(), null))
         .build();
   } catch (InternalServerErrorException ex) {
     Logger.getLogger(this.getClass().getName()).log(Level.SEVERE, null, ex);
     return makeInternalErrorResponse(ex);
   }
 }
 @Override
 public Response logout() {
   try {
     String auth = null;
     if (headers != null) {
       auth = headers.getHeaderString("auth_token");
     }
     backend.logout(auth);
     return Response.noContent().build();
   } catch (BadRequestException | UnauthorizedException | ForbiddenResourceException ex) {
     Logger.getLogger(this.getClass().getName()).log(Level.WARNING, null, ex);
     return Response.status(ex.getStatus())
         .entity(new BackendResponse(ex.getStatus(), ex.getMessage(), null))
         .build();
   } catch (InternalServerErrorException ex) {
     Logger.getLogger(this.getClass().getName()).log(Level.SEVERE, null, ex);
     return makeInternalErrorResponse(ex);
   }
 }