Commit 445c43e9 authored by Valentin Suhnjov's avatar Valentin Suhnjov

RIHAKB-130. Remove user and authentication from FileServiceImpl

parent 7b4e1c72
......@@ -12,12 +12,9 @@ import org.springframework.beans.factory.annotation.Autowired;
import com.fasterxml.jackson.databind.node.ObjectNode;
import ee.eesti.riha.rest.auth.AuthInfo;
import ee.eesti.riha.rest.auth.TokenStore;
import ee.eesti.riha.rest.error.RihaRestException;
import ee.eesti.riha.rest.logic.ChangeLogic;
import ee.eesti.riha.rest.logic.MyExceptionHandler;
import ee.eesti.riha.rest.logic.TokenValidator;
import ee.eesti.riha.rest.logic.Validator;
import ee.eesti.riha.rest.logic.util.FileHelper;
import ee.eesti.riha.rest.logic.util.JsonHelper;
......@@ -35,9 +32,6 @@ public class FileServiceImpl implements FileService {
@Autowired
ChangeLogic changeLogic;
@Autowired
TokenStore tokenStore;
/*
* (non-Javadoc)
*
......@@ -47,11 +41,10 @@ public class FileServiceImpl implements FileService {
public Response getFile(Integer documentId, String token) {
try {
AuthInfo user = TokenValidator.isTokenOk(token, tokenStore);
String fields = "[\"document_id\", \"filename\"]";
ObjectNode jsonObject = (ObjectNode) changeLogic.doGet(Document.class, documentId, fields);
return getFileLogic(documentId, jsonObject, token);
return getFileLogic(documentId, jsonObject);
} catch (RihaRestException e) {
return Response.status(Status.BAD_REQUEST).entity(MyExceptionHandler.unmapped(e, "FileService error"))
......@@ -60,12 +53,7 @@ public class FileServiceImpl implements FileService {
}
private Response getFileLogic(Integer documentId, ObjectNode document, String token) throws RihaRestException {
// if doesn't throw then OK
// TokenValidator.isTokenOk(token, authServiceProvider.get());
// TokenValidator.isTokenOk(token, tokenStore);
// no need to currently authenticate for GET requests
private Response getFileLogic(Integer documentId, ObjectNode document) throws RihaRestException {
String filePath = FileHelper.createDocumentFilePathWithRoot(documentId);
File file = new File(filePath);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment