diff --git a/src/main/java/org/ntlab/citrusserver/resources/FavoritedRest.java b/src/main/java/org/ntlab/citrusserver/resources/FavoritedRest.java index 3d5fcf6..9c5714c 100644 --- a/src/main/java/org/ntlab/citrusserver/resources/FavoritedRest.java +++ b/src/main/java/org/ntlab/citrusserver/resources/FavoritedRest.java @@ -2,6 +2,7 @@ import jakarta.ws.rs.*; import jakarta.ws.rs.core.MediaType; +import jakarta.ws.rs.core.Response; import org.ntlab.citrusserver.repositories.AccountManager; import org.ntlab.citrusserver.repositories.FavoriteManager; import org.springframework.beans.factory.annotation.Autowired; @@ -38,6 +39,9 @@ if(accountManager.checkToken(other_account_id,token)) { favoriteManager.putFavorited(account_id, book_id, other_account_id); favoriteManager.putFavorites(other_account_id, account_id, book_id);//変更点(要検討) + }else{ + var response = Response.status(Response.Status.FORBIDDEN).entity("認証失敗"); + throw new WebApplicationException(response.build()); } } @@ -48,6 +52,9 @@ if(accountManager.checkToken(other_account_id,token)) { favoriteManager.removeFavorited(account_id, book_id, other_account_id); favoriteManager.removeFavorites(other_account_id, account_id, book_id);//変更点(要検討) + }else{ + var response = Response.status(Response.Status.FORBIDDEN).entity("認証失敗"); + throw new WebApplicationException(response.build()); } } }