Fixed Create Team

This commit is contained in:
Maximilian Leopold 2019-05-09 13:06:41 +02:00
parent eb0483af21
commit 525e705bf9
4 changed files with 10 additions and 6 deletions

View File

@ -58,6 +58,9 @@ dependencies {
compile group: 'io.springfox', name: 'springfox-swagger-ui', version: '2.0.2'
// https://mvnrepository.com/artifact/com.mashape.unirest/unirest-java
compile group: 'com.mashape.unirest', name: 'unirest-java', version: '1.3.1'
}
node {

View File

@ -111,12 +111,12 @@ module.exports = function (ctx) {
? { // Base URL for API-Calls: DEV
API: JSON.stringify('http://localhost:8080'),
// API: JSON.stringify('https://seserver.se.hs-heilbronn.de:8443/buga19geocaching'),
USER_API: JSON.stringify('https://seserver.se.hs-heilbronn.de:8443/buga19usermanagement')
USER_API: JSON.stringify('https://seserver.se.hs-heilbronn.de:9443/buga19usermanagement')
}
: { // Base URL for API-Calls: PRODUCTION (build)
API: JSON.stringify('http://localhost:8080'),
//API: JSON.stringify('https://seserver.se.hs-heilbronn.de:8443/buga19geocaching'),
USER_API: JSON.stringify('https://seserver.se.hs-heilbronn.de:8443/buga19usermanagement')
USER_API: JSON.stringify('https://seserver.se.hs-heilbronn.de:9443/buga19usermanagement')
}
},

View File

@ -1,6 +1,7 @@
package hhn.labsw.bugageocaching.controller;
import com.google.gson.Gson;
import com.mashape.unirest.http.exceptions.UnirestException;
import hhn.labsw.bugageocaching.entities.*;
import hhn.labsw.bugageocaching.helper.POI;
import hhn.labsw.bugageocaching.helper.RankingListHelper;
@ -57,7 +58,7 @@ public class Controller {
TeamInviteRepository teamInviteRepository;
@PostConstruct
public void init() {
public void init(){
fetchPublicKey();
}
@ -544,6 +545,7 @@ public class Controller {
Team team = new Team();
team.setName(name);
team.setTeamStatus("");
teamRepository.save(team);
user_info.setTeam(team);

View File

@ -4,7 +4,6 @@ import hhn.labsw.bugageocaching.fetchObjects.PublicKey;
import io.jsonwebtoken.Claims;
import io.jsonwebtoken.ExpiredJwtException;
import io.jsonwebtoken.Jwts;
import org.springframework.http.HttpHeaders;
import org.springframework.http.ResponseEntity;
import org.springframework.web.client.RestTemplate;
@ -17,10 +16,10 @@ public class VerificationUtil {
public static Key publicKey;
public static void fetchPublicKey() {
public static void fetchPublicKey(){
RestTemplate restTemplate = new RestTemplate();
try {
PublicKey response = restTemplate.getForObject("http://seserver.se.hs-heilbronn.de:8090/buga19usermanagement/token/publickey", PublicKey.class);
PublicKey response = restTemplate.getForObject("http://seserver.se.hs-heilbronn.de:9080/buga19usermanagement/token/publickey", PublicKey.class);
byte[] decodedKey = Base64.getDecoder().decode(response.getMessage());
KeyFactory factory = KeyFactory.getInstance("RSA");
X509EncodedKeySpec publicKeySpec = new X509EncodedKeySpec(decodedKey);