# HG changeset patch # User Raimund Renkert # Date 1427129160 -3600 # Node ID f36a415c7052edc903f39087c7103695bc3ac36e # Parent ec8b2d1173d8b3493b6bcbc3cc1fb6b21eb44f7c Updated authorization interface and its default implemenation. diff -r ec8b2d1173d8 -r f36a415c7052 src/main/java/de/intevation/lada/util/auth/Authorization.java --- a/src/main/java/de/intevation/lada/util/auth/Authorization.java Mon Mar 23 17:45:03 2015 +0100 +++ b/src/main/java/de/intevation/lada/util/auth/Authorization.java Mon Mar 23 17:46:00 2015 +0100 @@ -1,9 +1,12 @@ package de.intevation.lada.util.auth; -import java.util.Map; - -import javax.ws.rs.core.HttpHeaders; +import de.intevation.lada.util.rest.RequestMethod; +import de.intevation.lada.util.rest.Response; public interface Authorization { - public Map getInfo(HttpHeaders headers); + public UserInfo getInfo(Object source); + public Response filter(Object source, Response data, Class clazz); + public boolean isAuthorized( + Object source, Object data, RequestMethod method, Class clazz); + boolean isReadOnly(Integer probeId); } diff -r ec8b2d1173d8 -r f36a415c7052 src/main/java/de/intevation/lada/util/auth/DefaultAuthorization.java --- a/src/main/java/de/intevation/lada/util/auth/DefaultAuthorization.java Mon Mar 23 17:45:03 2015 +0100 +++ b/src/main/java/de/intevation/lada/util/auth/DefaultAuthorization.java Mon Mar 23 17:46:00 2015 +0100 @@ -1,19 +1,33 @@ package de.intevation.lada.util.auth; -import java.util.Map; - import javax.ejb.Stateless; -import javax.ws.rs.core.HttpHeaders; import de.intevation.lada.util.annotation.AuthorizationConfig; +import de.intevation.lada.util.rest.RequestMethod; +import de.intevation.lada.util.rest.Response; @Stateless @AuthorizationConfig(type=AuthorizationType.NONE) public class DefaultAuthorization implements Authorization { @Override - public Map getInfo(HttpHeaders headers) { - return null; + public UserInfo getInfo(Object source) { + return new UserInfo(); } + @Override + public Response filter(Object source, Response data, Class clazz) { + return data; + } + + @Override + public boolean isAuthorized( + Object source, Object data, RequestMethod method, Class clazz) { + return true; + } + + @Override + public boolean isReadOnly(Integer probeId) { + return false; + } }