[Lada-commits] [PATCH] Send mst and netzbetreiber in login response

Wald Commits scm-commit at wald.intevation.org
Wed May 20 11:45:15 CEST 2015


# HG changeset patch
# User Raimund Renkert <raimund.renkert at intevation.de>
# Date 1432115101 -7200
# Node ID 6739e857da57a1742a8dcd60e2075b9c3e7756ec
# Parent  db1c69416eb676160bb8749013d3adbcbbdde1bf
Send mst and netzbetreiber in login response.

diff -r db1c69416eb6 -r 6739e857da57 src/main/java/de/intevation/lada/rest/LoginService.java
--- a/src/main/java/de/intevation/lada/rest/LoginService.java	Wed May 20 10:14:24 2015 +0200
+++ b/src/main/java/de/intevation/lada/rest/LoginService.java	Wed May 20 11:45:01 2015 +0200
@@ -12,6 +12,7 @@
 import java.util.Map;
 
 import javax.enterprise.context.RequestScoped;
+import javax.inject.Inject;
 import javax.servlet.http.HttpServletRequest;
 import javax.ws.rs.GET;
 import javax.ws.rs.Path;
@@ -20,6 +21,10 @@
 import javax.ws.rs.core.HttpHeaders;
 import javax.ws.rs.core.UriInfo;
 
+import de.intevation.lada.util.annotation.AuthorizationConfig;
+import de.intevation.lada.util.auth.Authorization;
+import de.intevation.lada.util.auth.AuthorizationType;
+import de.intevation.lada.util.auth.UserInfo;
 import de.intevation.lada.util.rest.Response;
 
 /**
@@ -51,6 +56,10 @@
 @RequestScoped
 public class LoginService {
 
+    @Inject
+    @AuthorizationConfig(type=AuthorizationType.OPEN_ID)
+    private Authorization authorization;
+
     /**
      * Get login data.
      * <pre>
@@ -85,6 +94,9 @@
         response.put("username", request.getAttribute("lada.user.name"));
         response.put("roles", request.getAttribute("lada.user.roles"));
         response.put("servertime", new Date().getTime());
+        UserInfo userInfo = authorization.getInfo(request);
+        response.put("mst", userInfo.getMessstellen());
+        response.put("netzbetreiber", userInfo.getNetzbetreiber());
         return new Response(true, 200, response);
     }
 }


More information about the Lada-commits mailing list