changeset 669:6739e857da57

Send mst and netzbetreiber in login response.
author Raimund Renkert <raimund.renkert@intevation.de>
date Wed, 20 May 2015 11:45:01 +0200
parents db1c69416eb6
children 196e8c67b8a0
files src/main/java/de/intevation/lada/rest/LoginService.java
diffstat 1 files changed, 12 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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);
     }
 }
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)