Merge branch 'DEVELOP' of ssh://git.eclipse.org:29418/openk-usermodules/org.eclipse.openk-usermodules.gridFailureInformation.backend into SI-540-Direkter-Email-Link

# Conflicts:
#	gfsBackendService/src/main/resources/application_localdev.yml
diff --git a/gfsBackendService/src/main/java/org/eclipse/openk/gridfailureinformation/GridFailureInformationApplication.java b/gfsBackendService/src/main/java/org/eclipse/openk/gridfailureinformation/GridFailureInformationApplication.java
index 65d544c..7972ecb 100644
--- a/gfsBackendService/src/main/java/org/eclipse/openk/gridfailureinformation/GridFailureInformationApplication.java
+++ b/gfsBackendService/src/main/java/org/eclipse/openk/gridfailureinformation/GridFailureInformationApplication.java
@@ -8,7 +8,6 @@
 import springfox.documentation.swagger2.annotations.EnableSwagger2;
 
 @SpringBootApplication
-@EnableSwagger2
 @EnableFeignClients
 @EnableJpaAuditing(modifyOnCreate=true, auditorAwareRef="auditProvider")
 @EnableConfigurationProperties
diff --git a/gfsBackendService/src/main/java/org/eclipse/openk/gridfailureinformation/api/AuthNAuthApi.java b/gfsBackendService/src/main/java/org/eclipse/openk/gridfailureinformation/api/AuthNAuthApi.java
index 21467a4..520575f 100644
--- a/gfsBackendService/src/main/java/org/eclipse/openk/gridfailureinformation/api/AuthNAuthApi.java
+++ b/gfsBackendService/src/main/java/org/eclipse/openk/gridfailureinformation/api/AuthNAuthApi.java
@@ -15,17 +15,30 @@
 package org.eclipse.openk.gridfailureinformation.api;
 
 
+import org.eclipse.openk.gridfailureinformation.model.JwtToken;
+import org.eclipse.openk.gridfailureinformation.model.LoginCredentials;
+import org.eclipse.openk.gridfailureinformation.viewmodel.UserModulePortalDto;
 import org.springframework.cloud.openfeign.FeignClient;
 import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestHeader;
 
+import java.util.List;
+
 @FeignClient(name = "${services.authNAuth.name}")
 public interface AuthNAuthApi {
 
     @GetMapping(value= "/portal/rest/beservice/checkAuth")
     feign.Response isTokenValid(@RequestHeader("Authorization") String token);
 
+    @PostMapping( value="/portal/rest/beservice/login")
+    JwtToken login(@RequestBody LoginCredentials loginCredentials);
+
     @GetMapping( value="/portal/rest/beservice/logout")
     feign.Response logout(@RequestHeader("Authorization") String token);
 
+    @GetMapping( value="/portal/rest/beservice/userModulesForUser")
+    List<UserModulePortalDto> userModulesForUser(@RequestHeader("Authorization") String token);
+
 }
diff --git a/gfsBackendService/src/main/java/org/eclipse/openk/gridfailureinformation/controller/LogoutController.java b/gfsBackendService/src/main/java/org/eclipse/openk/gridfailureinformation/controller/AuthNAuthController.java
similarity index 62%
rename from gfsBackendService/src/main/java/org/eclipse/openk/gridfailureinformation/controller/LogoutController.java
rename to gfsBackendService/src/main/java/org/eclipse/openk/gridfailureinformation/controller/AuthNAuthController.java
index cdfb5f1..e391f56 100644
--- a/gfsBackendService/src/main/java/org/eclipse/openk/gridfailureinformation/controller/LogoutController.java
+++ b/gfsBackendService/src/main/java/org/eclipse/openk/gridfailureinformation/controller/AuthNAuthController.java
@@ -18,29 +18,41 @@
 import io.swagger.annotations.ApiResponse;
 import io.swagger.annotations.ApiResponses;
 import lombok.extern.log4j.Log4j2;
-import org.eclipse.openk.gridfailureinformation.service.LogoutService;
+import org.eclipse.openk.gridfailureinformation.service.AuthNAuthService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.ResponseEntity;
 import org.springframework.security.access.annotation.Secured;
 import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
+import javax.servlet.http.HttpServletRequest;
+import java.util.UUID;
+
 @Log4j2
 @RestController
-@RequestMapping("/logout")
-public class LogoutController {
+public class AuthNAuthController {
 
     @Autowired
-    private LogoutService logoutService;
+    private AuthNAuthService authNAuthService;
 
     @ApiOperation(value = "Logout vom Auth-und-Auth-Modul")
     @ApiResponses(value = {@ApiResponse(code = 204, message = "Erfolgreich durchgeführt")})
-    @GetMapping
+    @GetMapping("/logout")
     @Secured({"ROLE_GRID-FAILURE-ADMIN", "ROLE_GRID-FAILURE-READER", "ROLE_GRID-FAILURE-CREATOR", "ROLE_GRID-FAILURE-QUALIFIER", "ROLE_GRID-FAILURE-PUBLISHER"})
     public ResponseEntity logout() {
-        logoutService.logout();
+        authNAuthService.logout();
         return ResponseEntity.ok().build();
     }
 
+    @ApiOperation(value = "Test für GetDirectMeasureLink")
+    @ApiResponses(value = {@ApiResponse(code = 204, message = "Erfolgreich durchgeführt")})
+    @GetMapping("/test-directmeasurelink/{uuid}")
+    @Secured({"ROLE_GRID-FAILURE-ADMIN", "ROLE_GRID-FAILURE-READER", "ROLE_GRID-FAILURE-CREATOR", "ROLE_GRID-FAILURE-QUALIFIER", "ROLE_GRID-FAILURE-PUBLISHER"})
+    public ResponseEntity testGetDirectMeasureLink(HttpServletRequest request, @PathVariable UUID uuid) {
+        String directMeasureLink = authNAuthService.getDirectMeasureLink(uuid.toString());
+        return ResponseEntity.ok(directMeasureLink);
+    }
+
 }
diff --git a/gfsBackendService/src/main/java/org/eclipse/openk/gridfailureinformation/model/LoginCredentials.java b/gfsBackendService/src/main/java/org/eclipse/openk/gridfailureinformation/model/LoginCredentials.java
new file mode 100644
index 0000000..95fc662
--- /dev/null
+++ b/gfsBackendService/src/main/java/org/eclipse/openk/gridfailureinformation/model/LoginCredentials.java
@@ -0,0 +1,41 @@
+/**
+******************************************************************************
+* Copyright © 2017-2018 PTA GmbH.
+* All rights reserved. This program and the accompanying materials
+* are made available under the terms of the Eclipse Public License v1.0
+* which accompanies this distribution, and is available at
+* 
+*     http://www.eclipse.org/legal/epl-v10.html
+* 
+******************************************************************************
+*/
+package org.eclipse.openk.gridfailureinformation.model;
+
+public class LoginCredentials {
+    private String userName;
+    private String password;
+
+    public LoginCredentials() {
+    }
+
+    public LoginCredentials(String userName, String password) {
+        this.userName = userName;
+        this.password = password;
+    }
+
+    public String getUserName() {
+        return userName;
+    }
+
+    public void setUserName(String userName) {
+        this.userName = userName;
+    }
+
+    public String getPassword() {
+        return password;
+    }
+
+    public void setPassword(String password) {
+        this.password = password;
+    }
+}
diff --git a/gfsBackendService/src/main/java/org/eclipse/openk/gridfailureinformation/service/AuthNAuthService.java b/gfsBackendService/src/main/java/org/eclipse/openk/gridfailureinformation/service/AuthNAuthService.java
new file mode 100644
index 0000000..ab913f4
--- /dev/null
+++ b/gfsBackendService/src/main/java/org/eclipse/openk/gridfailureinformation/service/AuthNAuthService.java
@@ -0,0 +1,110 @@
+/*
+ *******************************************************************************
+ * Copyright (c) 2019 Contributors to the Eclipse Foundation
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *******************************************************************************
+*/
+package org.eclipse.openk.gridfailureinformation.service;
+
+import feign.Response;
+import lombok.extern.log4j.Log4j2;
+import org.eclipse.openk.gridfailureinformation.api.AuthNAuthApi;
+import org.eclipse.openk.gridfailureinformation.model.JwtToken;
+import org.eclipse.openk.gridfailureinformation.model.LoginCredentials;
+import org.eclipse.openk.gridfailureinformation.viewmodel.UserModulePortalDto;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.boot.context.event.ApplicationReadyEvent;
+import org.springframework.context.event.ContextRefreshedEvent;
+import org.springframework.context.event.EventListener;
+import org.springframework.security.core.context.SecurityContextHolder;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.PostConstruct;
+import java.io.UnsupportedEncodingException;
+import java.net.URLEncoder;
+import java.util.List;
+
+@Log4j2
+@Service
+public class AuthNAuthService {
+
+    @Autowired
+    AuthNAuthApi authNAuthApi;
+
+    @Value(("${portalFeLoginURL}"))
+    private String portalFeLoginUrl;
+
+    @Value(("${portalFeModulename}"))
+    private String portalFeModulename;
+
+    @Value("${services.authNAuth.technical-username}")
+    private String technicalUsername;
+
+    @Value("${services.authNAuth.technical-userpassword}")
+    private String technicalUserPassword;
+
+    private String portalFeUrl;
+
+    public List<UserModulePortalDto> getUserModulePortalList() {
+        LoginCredentials loginCredentials = new LoginCredentials(technicalUsername, technicalUserPassword);
+        JwtToken jwtToken = authNAuthApi.login(loginCredentials);
+        List<UserModulePortalDto> usemodulePortalLists = authNAuthApi.userModulesForUser(jwtToken.getAccessToken());
+        authNAuthApi.logout(jwtToken.getAccessToken());
+        return usemodulePortalLists;
+    }
+
+    public void logout() {
+        String bearerToken = (String) SecurityContextHolder.getContext().getAuthentication().getDetails();
+        authNAuthApi.logout(bearerToken);
+    }
+
+    public String getDirectMeasureLink(String gfiUUID) {
+        // Example Link old: http://localhost:4220/#/gridMeasureDetail/5/edit?fwdUrl=http%3A%2F%2Flocalhost%3A4201%2F%23%2Flogin%3FfwdUrl%3Dhttp%3A%2F%2Flocalhost%3A4220%2F%26fwdId%3D5
+        // new: http://entdockergss:4223/grid-failures/6432a9c9-0384-44af-9bb8-34f2878d7b49?fwdUrl=http%3A%2F%2Flocalhost%3A4201%2F%23%2Flogin%3FfwdUrl%3Dhttp%3A%2F%2Flocalhost%3A4220%2F%26fwdId%3D5
+
+        String stdGridmeasureURL = portalFeUrl + "/grid-failures/" + gfiUUID;
+        String fwdURL = "fwdUrl=" + portalFeUrl + "&fwdId=" + gfiUUID;
+        String fwdURLEncoded = "";
+        String finalFwdUrl = portalFeLoginUrl + "?" + fwdURL;
+        try {
+            fwdURLEncoded = URLEncoder.encode(finalFwdUrl, "UTF-8");
+        } catch (UnsupportedEncodingException e) {
+            log.error("Error in getDirectMeasureLink", e);
+            return "";
+        }
+
+        return stdGridmeasureURL + "?fwdUrl=" + fwdURLEncoded;
+    }
+
+    //Startet erst nachdem die Applikation komplett geladen ist (ApplicationReadyEvent)
+    @EventListener
+    public void onApplicationEvent(ApplicationReadyEvent event) {
+        initPortalFeUrl();
+    }
+
+    public void initPortalFeUrl()  {
+                List<UserModulePortalDto> userModulePortalList = getUserModulePortalList();
+                portalFeUrl = extractPortalFE(userModulePortalList);
+    }
+
+    private String extractPortalFE(List<UserModulePortalDto> userModulePortalList ) {
+        String portalFeURL = "<PortalFE-URL>";
+        for (UserModulePortalDto userModulePortal : userModulePortalList) {
+            if (userModulePortal.getName().equalsIgnoreCase(portalFeModulename)){
+                portalFeURL = userModulePortal.getLink();
+                break;
+            }
+        }
+
+        return portalFeURL;
+    }
+}
diff --git a/gfsBackendService/src/main/java/org/eclipse/openk/gridfailureinformation/service/ExportService.java b/gfsBackendService/src/main/java/org/eclipse/openk/gridfailureinformation/service/ExportService.java
index 4d2c44a..aae6f5b 100644
--- a/gfsBackendService/src/main/java/org/eclipse/openk/gridfailureinformation/service/ExportService.java
+++ b/gfsBackendService/src/main/java/org/eclipse/openk/gridfailureinformation/service/ExportService.java
@@ -33,6 +33,8 @@
 import org.springframework.stereotype.Service;
 import org.springframework.validation.annotation.Validated;
 
+import java.io.UnsupportedEncodingException;
+import java.net.URLEncoder;
 import java.text.DateFormat;
 import java.text.SimpleDateFormat;
 import java.util.ArrayList;
@@ -88,7 +90,8 @@
     @Autowired
     private ResourceConfig resourceConfig;
 
-    private @Autowired Environment environment;
+    @Autowired
+    AuthNAuthService authNAuthService;
 
     private static final String SUBJECT_DATE_PATTERN_APPLIED = "EEEE', den' dd.MM.yy 'um' HH:mm:ss";
     protected Map<String,String> contentReplaceMap;
@@ -407,6 +410,10 @@
         if (radius != null) {
             contentReplaceMap.put(placeholderDto.getRadius(), radius.getRadius().toString());
         }
+
+        String directFailureLink = authNAuthService.getDirectMeasureLink(tblFailureInfo.getUuid().toString());
+        contentReplaceMap.put(placeholderDto.getDirectFailureLink(), directFailureLink);
+
     }
 
 }
diff --git a/gfsBackendService/src/main/java/org/eclipse/openk/gridfailureinformation/service/LogoutService.java b/gfsBackendService/src/main/java/org/eclipse/openk/gridfailureinformation/service/LogoutService.java
deleted file mode 100644
index e6c8dcb..0000000
--- a/gfsBackendService/src/main/java/org/eclipse/openk/gridfailureinformation/service/LogoutService.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- *******************************************************************************
- * Copyright (c) 2019 Contributors to the Eclipse Foundation
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information regarding copyright ownership.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v. 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0.
- *
- * SPDX-License-Identifier: EPL-2.0
- *******************************************************************************
-*/
-package org.eclipse.openk.gridfailureinformation.service;
-
-import org.eclipse.openk.gridfailureinformation.api.AuthNAuthApi;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.security.core.context.SecurityContextHolder;
-import org.springframework.stereotype.Service;
-
-@Service
-public class LogoutService {
-    @Autowired
-    AuthNAuthApi authNAuthApi;
-
-    public void logout() {
-        String bearerToken = (String) SecurityContextHolder.getContext().getAuthentication().getDetails();
-        authNAuthApi.logout(bearerToken);
-    }
-}
diff --git a/gfsBackendService/src/main/java/org/eclipse/openk/gridfailureinformation/viewmodel/DistributionTextPlaceholderDto.java b/gfsBackendService/src/main/java/org/eclipse/openk/gridfailureinformation/viewmodel/DistributionTextPlaceholderDto.java
index 9682d1d..e36d967 100644
--- a/gfsBackendService/src/main/java/org/eclipse/openk/gridfailureinformation/viewmodel/DistributionTextPlaceholderDto.java
+++ b/gfsBackendService/src/main/java/org/eclipse/openk/gridfailureinformation/viewmodel/DistributionTextPlaceholderDto.java
@@ -46,4 +46,6 @@
     private String stationDescription;
     private String radius;
 
+    private String directFailureLink;
+
 }
diff --git a/gfsBackendService/src/main/java/org/eclipse/openk/gridfailureinformation/viewmodel/UserModulePortalDto.java b/gfsBackendService/src/main/java/org/eclipse/openk/gridfailureinformation/viewmodel/UserModulePortalDto.java
new file mode 100644
index 0000000..505471a
--- /dev/null
+++ b/gfsBackendService/src/main/java/org/eclipse/openk/gridfailureinformation/viewmodel/UserModulePortalDto.java
@@ -0,0 +1,30 @@
+/*
+ *******************************************************************************
+ * Copyright (c) 2019 Contributors to the Eclipse Foundation
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *******************************************************************************
+ */
+package org.eclipse.openk.gridfailureinformation.viewmodel;
+
+import lombok.Data;
+
+@Data
+public class UserModulePortalDto {
+
+    private String name;
+    private Integer cols;
+    private Integer rows;
+    private String color;
+    private String link;
+    private String pictureLink;
+    private String requiredRole;
+
+}
diff --git a/gfsBackendService/src/main/resources/DistributionTextPlaceholder.json b/gfsBackendService/src/main/resources/DistributionTextPlaceholder.json
index 4b42964..dcd2449 100644
--- a/gfsBackendService/src/main/resources/DistributionTextPlaceholder.json
+++ b/gfsBackendService/src/main/resources/DistributionTextPlaceholder.json
@@ -18,5 +18,7 @@
   "street": "$Straße$",
   "housenumber": "$Hausnummer$",
   "stationDescription": "$Station_Bezeichnung$",
-  "radius": "$Radius$"
+  "radius": "$Radius$",
+  "directFailureLink": "$Direkter_Link_zur_Störung$"
+
 }
diff --git a/gfsBackendService/src/main/resources/application.yml b/gfsBackendService/src/main/resources/application.yml
index 6ebc693..43020f3 100644
--- a/gfsBackendService/src/main/resources/application.yml
+++ b/gfsBackendService/src/main/resources/application.yml
@@ -69,6 +69,8 @@
 services:
   authNAuth:
     name: authNAuthService
+    technical-username: admin_technical_portal
+    technical-userpassword: admin_technical_portal
   contacts:
     name: contactService
     communicationType:
@@ -76,6 +78,8 @@
     useModuleNameForFilter: false
     moduleName: Störungsinformationstool
 
+portalFeLoginURL: http://entopkon:8880/portalFE/#/login
+portalFeModulename: SIT DEV
 authNAuthService:
   ribbon:
     listOfServers: http://entopkon:8880
@@ -295,9 +299,13 @@
   useStaticJwt: false
   staticJwt: eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICJIYlI3Z2pobmE2eXJRZnZJTWhUSV9tY2g3ZmtTQWVFX3hLTjBhZVl0bjdjIn0.eyJqdGkiOiJlMmQ2YjE3Zi1iMWUyLTQxMzUtOTM1YS0zOWRiMmFkMzE5MjYiLCJleHAiOjE1ODYwMTI1MzUsIm5iZiI6MCwiaWF0IjoxNTg2MDEyMjM1LCJpc3MiOiJodHRwOi8vbG9jYWxob3N0OjgwODAvYXV0aC9yZWFsbXMvRWxvZ2Jvb2siLCJhdWQiOiJlbG9nYm9vay1iYWNrZW5kIiwic3ViIjoiMzMzMmRmOWItYmYyMy00Nzg5LThmMmQtM2JhZTM2MzA4YzNkIiwidHlwIjoiQmVhcmVyIiwiYXpwIjoiZWxvZ2Jvb2stYmFja2VuZCIsImF1dGhfdGltZSI6MCwic2Vzc2lvbl9zdGF0ZSI6IjYxMzRmN2RhLTdlNjQtNDJjNy05NjYyLTY0ZGNhZTk1MjQ5YSIsImFjciI6IjEiLCJhbGxvd2VkLW9yaWdpbnMiOlsiKiJdLCJyZWFsbV9hY2Nlc3MiOnsicm9sZXMiOlsiZ3JpZC1mYWlsdXJlLXF1YWxpZmllciIsImdyaWQtZmFpbHVyZS1jcmVhdG9yIiwiZ3JpZC1mYWlsdXJlLWFjY2VzcyIsImdyaWQtZmFpbHVyZS1hZG1pbiIsImdyaWQtZmFpbHVyZS1wdWJsaXNoZXIiXX0sInJlc291cmNlX2FjY2VzcyI6e30sIm5hbWUiOiJTdGF0aWMgSldUIiwicHJlZmVycmVkX3VzZXJuYW1lIjoidGVzdHVzZXJfZ2ZpX3N0YXRpY2p3dCIsImdpdmVuX25hbWUiOiJTdGF0aWMiLCJmYW1pbHlfbmFtZSI6IkpXVCJ9.SWpekZHxlDNWbaaZ2fHlts00c1Xi6yIb0ZMr9f8ujSI_6LVYuHx8FTt6g9tinyVcx5gQKfrooRW28Cdq1EVuexNtTtZ7ciKk4iEo_kgqUgRvHCwO7HQl2igpoGErheYD0kj3-u4Te6NPHKtXWIEfGyl0ZQBD2c4vtaCTQAy5Ilb146G7p_IcLYaZgpJPlGG0Bf2oZ0UqTQsrXxRJkXWARDz8D4lIrN84lAbqNlPlSZDN-8xp_z6mXgWpvgeZuFoYHItJMg2cjR0SXH-ycbWVXctRNQJfTWR0acIhp_nB_Xe6JlUx2vls99EVw-WUrd0hc8Y9658HdeyktvpQLDxP2g
 
+portalFeLoginURL: http://169.50.13.154/portalFE/#/login
+portalFeModulename: Störungsinformationstool
 services:
   authNAuth:
     name: authNAuthService
+    technical-username: admin_technical_portal
+    technical-userpassword: admin_technical_portal
   contacts:
     name: contactService
     communicationType:
diff --git a/gfsBackendService/src/main/resources/application_localdev.yml b/gfsBackendService/src/main/resources/application_localdev.yml
index d1933e7..a95e3dc 100644
--- a/gfsBackendService/src/main/resources/application_localdev.yml
+++ b/gfsBackendService/src/main/resources/application_localdev.yml
@@ -73,13 +73,17 @@
 services:
   authNAuth:
     name: authNAuthService
+    technical-username: admin_technical_portal
+    technical-userpassword: admin_technical_portal
   contacts:
     name: contactService
     communicationType:
       mobile: Mobil
     useModuleNameForFilter: false
-    moduleName: Störungsinformationstool DEV
+    moduleName: Störungsinformationstool
 
+portalFeLoginURL: http://entopkon:8880/portalFE/#/login
+portalFeModulename: SIT DEV
 authNAuthService:
   ribbon:
     listOfServers: http://entopkon:8880
@@ -134,6 +138,3 @@
       - name: Störungsauskunft.de
         exportQueue: sit_stoerungsauskunft_export_queue_localdev
         exportKey: sit_stoerungsauskunft_export_key_localdev
-#jwt:
-#  tokenHeader: Authorization
-#  useStaticJwt: false
\ No newline at end of file
diff --git a/gfsBackendService/src/test/java/org/eclipse/openk/gridfailureinformation/config/TestConfiguration.java b/gfsBackendService/src/test/java/org/eclipse/openk/gridfailureinformation/config/TestConfiguration.java
index cf7525c..5d2a52c 100644
--- a/gfsBackendService/src/test/java/org/eclipse/openk/gridfailureinformation/config/TestConfiguration.java
+++ b/gfsBackendService/src/test/java/org/eclipse/openk/gridfailureinformation/config/TestConfiguration.java
@@ -16,6 +16,7 @@
 
 import com.fasterxml.jackson.databind.ObjectMapper;
 import org.eclipse.openk.gridfailureinformation.GridFailureInformationApplication;
+import org.eclipse.openk.gridfailureinformation.api.AuthNAuthApi;
 import org.eclipse.openk.gridfailureinformation.api.ContactApi;
 import org.eclipse.openk.gridfailureinformation.bpmn.base.ProcessException;
 import org.eclipse.openk.gridfailureinformation.bpmn.impl.GfiGrid;
@@ -24,6 +25,7 @@
 import org.eclipse.openk.gridfailureinformation.config.rabbitMq.RabbitMqConfig;
 import org.eclipse.openk.gridfailureinformation.config.rabbitMq.RabbitMqProperties;
 import org.eclipse.openk.gridfailureinformation.mapper.*;
+import org.eclipse.openk.gridfailureinformation.model.JwtToken;
 import org.eclipse.openk.gridfailureinformation.service.*;
 import org.eclipse.openk.gridfailureinformation.util.ImportDataValidator;
 import org.mockito.Mockito;
@@ -33,6 +35,7 @@
 import org.springframework.amqp.rabbit.core.RabbitAdmin;
 import org.springframework.amqp.rabbit.core.RabbitTemplate;
 import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.boot.autoconfigure.domain.EntityScan;
 import org.springframework.boot.test.context.ConfigFileApplicationContextInitializer;
 import org.springframework.context.annotation.Bean;
@@ -41,6 +44,7 @@
 import org.springframework.test.context.ContextConfiguration;
 import org.springframework.test.context.TestPropertySource;
 
+import static org.mockito.ArgumentMatchers.any;
 import static org.mockito.Mockito.doNothing;
 import static org.mockito.Mockito.when;
 
@@ -50,6 +54,9 @@
 @TestPropertySource("spring.config.location=classpath:application.yml")
 public class TestConfiguration {
 
+    @Value("${jwt.staticJwt}")
+    private String staticJwt;
+
     @Bean
     SettingsService settingsService(){return new SettingsService();}
 
@@ -90,7 +97,17 @@
         return Mockito.mock(RabbitMqProperties.class);
     }
 
+    @Bean
+    AuthNAuthService authNAuthService(){return new AuthNAuthService();}
 
+    @Bean
+    AuthNAuthApi authNAuthApi(){
+        AuthNAuthApi authNAuthApiMock = Mockito.mock(AuthNAuthApi.class);
+        JwtToken jwtToken = new JwtToken();
+        jwtToken.setAccessToken(staticJwt);
+        when(authNAuthApiMock.login(any())).thenReturn(jwtToken);
+        return authNAuthApiMock;
+    }
 
     @Bean
     ResourceConfig resourceConfig(){return new ResourceConfig();}