Mercurial > lada > lada-server
changeset 578:f36a415c7052
Updated authorization interface and its default implemenation.
author | Raimund Renkert <raimund.renkert@intevation.de> |
---|---|
date | Mon, 23 Mar 2015 17:46:00 +0100 |
parents | ec8b2d1173d8 |
children | fb1f7418e1fc |
files | src/main/java/de/intevation/lada/util/auth/Authorization.java src/main/java/de/intevation/lada/util/auth/DefaultAuthorization.java |
diffstat | 2 files changed, 26 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- 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<String, Object> getInfo(HttpHeaders headers); + public UserInfo getInfo(Object source); + public <T> Response filter(Object source, Response data, Class<T> clazz); + public <T> boolean isAuthorized( + Object source, Object data, RequestMethod method, Class<T> clazz); + boolean isReadOnly(Integer probeId); }
--- 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<String, Object> getInfo(HttpHeaders headers) { - return null; + public UserInfo getInfo(Object source) { + return new UserInfo(); } + @Override + public <T> Response filter(Object source, Response data, Class<T> clazz) { + return data; + } + + @Override + public <T> boolean isAuthorized( + Object source, Object data, RequestMethod method, Class<T> clazz) { + return true; + } + + @Override + public boolean isReadOnly(Integer probeId) { + return false; + } }