[Lada-commits] [PATCH 07 of 15] Updated authorization interface and its default implemenation

Wald Commits scm-commit at wald.intevation.org
Mon Mar 23 17:59:59 CET 2015


# HG changeset patch
# User Raimund Renkert <raimund.renkert at intevation.de>
# 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<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);
 }
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<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;
+    }
 }


More information about the Lada-commits mailing list